@@ -42,9 +42,13 @@ if(argv._.length === 0) {
4242// Build list of mocks to compare
4343var allMockList = [ ] ;
4444var mathjax3 ;
45+ var virtualWebgl = false ;
4546argv . _ . forEach ( function ( pattern ) {
4647 if ( pattern === 'mathjax3' ) {
4748 mathjax3 = true ;
49+ } else if ( pattern === 'virtual-webgl' ) {
50+ virtualWebgl = true ;
51+ allMockList = getMockList ( '' ) ;
4852 } else {
4953 var mockList = getMockList ( pattern ) ;
5054
@@ -66,6 +70,12 @@ allMockList = allMockList.filter(function(a) {
6670 ) ;
6771} ) ;
6872
73+ if ( virtualWebgl ) {
74+ allMockList = allMockList . filter ( function ( a ) {
75+ return a . slice ( 0 , 2 ) === 'gl' || a . slice ( 0 , 6 ) === 'mapbox' ;
76+ } ) ;
77+ }
78+
6979if ( mathjax3 ) {
7080 allMockList = [
7181 'legend_mathjax_title_and_items' ,
@@ -91,6 +101,7 @@ var fail = function(mockName) {
91101 failed . push ( mockName ) ;
92102 }
93103} ;
104+
94105for ( var i = 0 ; i < allMockList . length ; i ++ ) {
95106 var mockName = allMockList [ i ] ;
96107
@@ -102,6 +113,18 @@ for(var i = 0; i < allMockList.length; i++) {
102113 continue ;
103114 }
104115
116+ // the following mocks than only have regl-line2d lines (no morkers),
117+ // do not render at first draw when using virtual webgl. TODO: find a fix
118+ if ( virtualWebgl && [
119+ 'gl2d_connect_gaps' ,
120+ 'gl2d_line_select' ,
121+ 'gl2d_lines_almost_horizontal_vertical' ,
122+ 'gl2d_scattergl_simple_line_reversed_ranges' ,
123+ 'gl2d_subplots_anchor'
124+ ] . indexOf ( mockName ) !== - 1 ) {
125+ continue ;
126+ }
127+
105128 var isMapbox = mockName . substr ( 0 , 7 ) === 'mapbox_' ;
106129 var isOtherFlaky = [
107130 // list flaky mocks other than mapbox:
@@ -151,15 +174,28 @@ for(var i = 0; i < allMockList.length; i++) {
151174
152175 var shouldBePixelPerfect = ! ( isMapbox || isOtherFlaky ) ;
153176
177+ var threshold = shouldBePixelPerfect ? 0 : [
178+ // more flaky
179+ 'mapbox_angles' ,
180+ 'mapbox_layers' ,
181+ 'mapbox_custom-style' ,
182+ 'mapbox_geojson-attributes'
183+ ] . indexOf ( mockName ) !== - 1 ? 1 : 0.15 ;
184+
185+ if ( virtualWebgl ) {
186+ threshold = Math . max ( 0.4 , threshold ) ;
187+ if ( [
188+ 'gl3d_ibm-plot' ,
189+ 'gl3d_isosurface_2surfaces-checker_spaceframe' ,
190+ 'gl3d_opacity-scaling-spikes' ,
191+ 'gl3d_cone-wind' ,
192+ 'gl3d_isosurface_math' ,
193+ 'gl3d_scatter3d-blank-text'
194+ ] . indexOf ( mockName ) !== - 1 ) threshold = 0.7 ;
195+ }
196+
154197 var numDiffPixels = pixelmatch ( img0 . data , img1 . data , diff . data , width , height , {
155- threshold : shouldBePixelPerfect ? 0 :
156- [
157- // more flaky
158- 'mapbox_angles' ,
159- 'mapbox_layers' ,
160- 'mapbox_custom-style' ,
161- 'mapbox_geojson-attributes'
162- ] . indexOf ( mockName ) !== - 1 ? 1 : 0.15
198+ threshold : threshold
163199 } ) ;
164200
165201 if ( numDiffPixels ) {
0 commit comments