Skip to content

Commit 91c2d42

Browse files
authored
Merge pull request #1037 from plotly/gl2d-tests
gl2d image tests (finally)
2 parents 95c56e8 + 1e04e9f commit 91c2d42

File tree

69 files changed

+180
-14884
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+180
-14884
lines changed

circle.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies:
2121
test:
2222
override:
2323
- npm run test-image
24+
- npm run test-image-gl2d
2425
- npm run test-export
2526
- npm run citest-jasmine
2627
- npm run test-bundle

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"test-jasmine": "karma start test/jasmine/karma.conf.js",
3636
"citest-jasmine": "karma start test/jasmine/karma.ciconf.js",
3737
"test-image": "node tasks/test_image.js",
38+
"test-image-gl2d": "node tasks/test_image.js gl2d_* --queue",
3839
"test-export": "node tasks/test_export.js",
3940
"test-syntax": "node tasks/test_syntax.js",
4041
"test-bundle": "node tasks/test_bundle.js",

test/image/baselines/gl2d_10.png

-6.38 KB

test/image/baselines/gl2d_12.png

-386 Bytes

test/image/baselines/gl2d_14.png

-4.81 KB

test/image/baselines/gl2d_17.png

-15.3 KB

test/image/baselines/gl2d_22.png

-37.8 KB
Binary file not shown.

test/image/baselines/gl2d_24.png

-31 KB
Binary file not shown.

test/image/baselines/gl2d_28.png

-71.7 KB
Binary file not shown.

test/image/baselines/gl2d_30.png

-31.8 KB
Binary file not shown.

test/image/baselines/gl2d_32.png

-63.9 KB
Binary file not shown.
-9.47 KB
-11.3 KB
-12.1 KB
-5.28 KB
-1.47 KB
-5.93 KB
-23.7 KB
Binary file not shown.
-21.5 KB
Binary file not shown.
Binary file not shown.
24.3 KB
-5.87 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
-38.5 KB
Binary file not shown.
24.6 KB

test/image/baselines/gl2d_fonts.png

-1.15 KB
-28.7 KB
Binary file not shown.
-40.5 KB
Binary file not shown.
-38.2 KB
Binary file not shown.
-39.8 KB
Binary file not shown.
-40.7 KB
Binary file not shown.
-29.5 KB
Binary file not shown.
5.15 KB
29.8 KB
-25.9 KB
Binary file not shown.
-3.4 KB
-2.71 KB
1.99 KB

test/image/compare_pixels_test.js

+68-4
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,33 @@ var QUEUE_WAIT = 10;
5151
var pattern = process.argv[2];
5252
var mockList = getMockList(pattern);
5353
var isInQueue = (process.argv[3] === '--queue');
54+
var isCI = process.env.CIRCLECI;
5455

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

5960
// filter out untestable mocks if no pattern is specified
6061
if(!pattern) {
61-
console.log('Filtering out untestable mocks\n');
62+
console.log('Filtering out untestable mocks:');
6263
mockList = mockList.filter(untestableFilter);
64+
console.log('\n');
65+
}
66+
67+
// gl2d have limited image-test support
68+
if(pattern === 'gl2d_*') {
69+
70+
if(!isInQueue) {
71+
console.log('WARN: Running gl2d image tests in batch may lead to unwanted results\n');
72+
}
73+
74+
if(isCI) {
75+
console.log('Filtering out multiple-subplot gl2d mocks:');
76+
mockList = mockList
77+
.filter(untestableGL2DonCIfilter)
78+
.sort(sortForGL2DonCI);
79+
console.log('\n');
80+
}
6381
}
6482

6583
// main
@@ -81,18 +99,64 @@ else {
8199
*
82100
*/
83101
function untestableFilter(mockName) {
84-
return !(
102+
var cond = !(
85103
mockName === 'font-wishlist' ||
86104
mockName.indexOf('gl2d_') !== -1 ||
87105
mockName.indexOf('mapbox_') !== -1
88106
);
107+
108+
if(!cond) console.log(' -', mockName);
109+
110+
return cond;
111+
}
112+
113+
/* gl2d mocks that have multiple subplots
114+
* can't be generated properly on CircleCI
115+
* at the moment.
116+
*
117+
* For more info see:
118+
* https://github.com/plotly/plotly.js/pull/980
119+
*
120+
*/
121+
function untestableGL2DonCIfilter(mockName) {
122+
var cond = [
123+
'gl2d_multiple_subplots',
124+
'gl2d_simple_inset',
125+
'gl2d_stacked_coupled_subplots',
126+
'gl2d_stacked_subplots'
127+
].indexOf(mockName) === -1;
128+
129+
if(!cond) console.log(' -', mockName);
130+
131+
return cond;
132+
}
133+
134+
/* gl2d pointcloud mock(s) must be tested first
135+
* on CircleCI in order to work; sort them here.
136+
*
137+
* Pointcloud relies on [email protected] whereas
138+
* other gl2d trace modules rely on [email protected],
139+
* we suspect that the lone gl context on CircleCI is
140+
* having issues with dealing with the two different
141+
* gl-shader versions.
142+
*
143+
* More info here:
144+
* https://github.com/plotly/plotly.js/pull/1037
145+
*/
146+
function sortForGL2DonCI(a, b) {
147+
var root = 'gl2d_pointcloud',
148+
ai = a.indexOf(root),
149+
bi = b.indexOf(root);
150+
151+
if(ai < bi) return 1;
152+
if(ai > bi) return -1;
153+
154+
return 0;
89155
}
90156

91157
function runInBatch(mockList) {
92158
var running = 0;
93159

94-
// remove mapbox mocks if circle ci
95-
96160
test('testing mocks in batch', function(t) {
97161
t.plan(mockList.length);
98162

test/image/export_test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ var test = require('tape');
1818
var FORMATS = ['svg', 'pdf', 'eps'];
1919

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

2325
// return dimensions [in px]
2426
var WIDTH = 700;

0 commit comments

Comments
 (0)