Skip to content

gl2d image tests (finally) #1037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 19, 2016
1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies:
test:
override:
- npm run test-image
- npm run test-image-gl2d
- npm run test-export
- npm run citest-jasmine
- npm run test-bundle
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"test-jasmine": "karma start test/jasmine/karma.conf.js",
"citest-jasmine": "karma start test/jasmine/karma.ciconf.js",
"test-image": "node tasks/test_image.js",
"test-image-gl2d": "node tasks/test_image.js gl2d_* --queue",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run npm run test-image-gl2d to run gl2d image tests locally.

"test-export": "node tasks/test_export.js",
"test-syntax": "node tasks/test_syntax.js",
"test-bundle": "node tasks/test_bundle.js",
Expand Down
Binary file modified test/image/baselines/gl2d_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/gl2d_12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/gl2d_14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/gl2d_17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed test/image/baselines/gl2d_22.png
Binary file not shown.
Binary file removed test/image/baselines/gl2d_24.png
Binary file not shown.
Binary file removed test/image/baselines/gl2d_28.png
Binary file not shown.
Binary file removed test/image/baselines/gl2d_30.png
Binary file not shown.
Binary file removed test/image/baselines/gl2d_32.png
Binary file not shown.
Binary file modified test/image/baselines/gl2d_axes_booleans.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/gl2d_axes_labels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/gl2d_axes_lines.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/gl2d_axes_range_manual.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/gl2d_axes_range_mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/gl2d_axes_range_type.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed test/image/baselines/gl2d_basic_error_bar.png
Binary file not shown.
Binary file removed test/image/baselines/gl2d_bubble_markersize0.png
Binary file not shown.
Binary file not shown.
Binary file added test/image/baselines/gl2d_connect_gaps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/gl2d_date_axes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file removed test/image/baselines/gl2d_error_bar_horizontal.png
Binary file not shown.
Binary file removed test/image/baselines/gl2d_error_bar_style.png
Binary file not shown.
Binary file added test/image/baselines/gl2d_error_bars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/gl2d_fonts.png
Binary file removed test/image/baselines/gl2d_global_font.png
Diff not rendered.
Binary file removed test/image/baselines/gl2d_legend_inside.png
Diff not rendered.
Binary file removed test/image/baselines/gl2d_legend_labels.png
Diff not rendered.
Binary file removed test/image/baselines/gl2d_legend_outside.png
Diff not rendered.
Binary file removed test/image/baselines/gl2d_legend_style.png
Diff not rendered.
Binary file removed test/image/baselines/gl2d_line_style.png
Diff not rendered.
Binary file modified test/image/baselines/gl2d_multiple_subplots.png
Binary file added test/image/baselines/gl2d_pointcloud-basic.png
Binary file modified test/image/baselines/gl2d_scatter-colorscale-colorbar.png
Binary file modified test/image/baselines/gl2d_scatter-marker-line-colorscales.png
Binary file removed test/image/baselines/gl2d_show_legend.png
Diff not rendered.
Binary file modified test/image/baselines/gl2d_simple_inset.png
Binary file modified test/image/baselines/gl2d_size_margins.png
Binary file modified test/image/baselines/gl2d_stacked_coupled_subplots.png
Binary file modified test/image/baselines/gl2d_stacked_subplots.png
72 changes: 68 additions & 4 deletions test/image/compare_pixels_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,33 @@ var QUEUE_WAIT = 10;
var pattern = process.argv[2];
var mockList = getMockList(pattern);
var isInQueue = (process.argv[3] === '--queue');
var isCI = process.env.CIRCLECI;

if(mockList.length === 0) {
throw new Error('No mocks found with pattern ' + pattern);
}

// filter out untestable mocks if no pattern is specified
if(!pattern) {
console.log('Filtering out untestable mocks\n');
console.log('Filtering out untestable mocks:');
mockList = mockList.filter(untestableFilter);
console.log('\n');
}

// gl2d have limited image-test support
if(pattern === 'gl2d_*') {

if(!isInQueue) {
console.log('WARN: Running gl2d image tests in batch may lead to unwanted results\n');
}

if(isCI) {
console.log('Filtering out multiple-subplot gl2d mocks:');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be a slightly more general log entry b/c the pointcloud test is in this set too -- or we might want to alter the pointcloud test such that it doesn't test the blending effect (I can do it in a separate small PR) but even then, at least most of the pointcloud stuff would be tested, vs. no pointcloud test on CI right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to alter the pointcloud test such that it doesn't test the blending effect (I can do it in a separate small PR)

that would be great!

mockList = mockList
.filter(untestableGL2DonCIfilter)
.sort(sortForGL2DonCI);
console.log('\n');
}
}

// main
Expand All @@ -81,18 +99,64 @@ else {
*
*/
function untestableFilter(mockName) {
return !(
var cond = !(
mockName === 'font-wishlist' ||
mockName.indexOf('gl2d_') !== -1 ||
mockName.indexOf('mapbox_') !== -1
);

if(!cond) console.log(' -', mockName);

return cond;
}

/* gl2d mocks that have multiple subplots
* can't be generated properly on CircleCI
* at the moment.
*
* For more info see:
* https://github.com/plotly/plotly.js/pull/980
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice doc reference in the code!

*
*/
function untestableGL2DonCIfilter(mockName) {
var cond = [
'gl2d_multiple_subplots',
'gl2d_simple_inset',
'gl2d_stacked_coupled_subplots',
'gl2d_stacked_subplots'
].indexOf(mockName) === -1;

if(!cond) console.log(' -', mockName);

return cond;
}

/* gl2d pointcloud mock(s) must be tested first
* on CircleCI in order to work; sort them here.
*
* Pointcloud relies on gl-shader@4.2.1 whereas
* other gl2d trace modules rely on gl-shader@4.2.0,
* we suspect that the lone gl context on CircleCI is
* having issues with dealing with the two different
* gl-shader versions.
*
* More info here:
* https://github.com/plotly/plotly.js/pull/1037
*/
function sortForGL2DonCI(a, b) {
var root = 'gl2d_pointcloud',
ai = a.indexOf(root),
bi = b.indexOf(root);

if(ai < bi) return 1;
if(ai > bi) return -1;

return 0;
}

function runInBatch(mockList) {
var running = 0;

// remove mapbox mocks if circle ci

test('testing mocks in batch', function(t) {
t.plan(mockList.length);

Expand Down
4 changes: 3 additions & 1 deletion test/image/export_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ var test = require('tape');
var FORMATS = ['svg', 'pdf', 'eps'];

// non-exhaustive list of mocks to test
var DEFAULT_LIST = ['0', 'geo_first', 'gl3d_z-range', 'text_export', 'layout_image'];
var DEFAULT_LIST = [
'0', 'geo_first', 'gl3d_z-range', 'text_export', 'layout_image', 'gl2d_12'
];

// return dimensions [in px]
var WIDTH = 700;
Expand Down
Loading