@@ -545,6 +545,95 @@ describe('end-to-end scattergl tests', function() {
545545 expect ( getSnap ( ) ) . toEqual ( TOO_MANY_POINTS + 1 ) ;
546546 } ) . then ( done , done . fail ) ;
547547 } ) ;
548+
549+ it ( '@gl should not throw when plot is called with a subset of scattergl calcdata' , function ( done ) {
550+ var layout = {
551+ width : 300 ,
552+ height : 300 ,
553+ margin : { l : 0 , r : 0 , t : 0 , b : 0 }
554+ } ;
555+ var config = { plotGlPixelRatio : 1 } ;
556+
557+ Plotly . newPlot ( gd , [ {
558+ type : 'scattergl' ,
559+ mode : 'lines' ,
560+ x : [ 0 , 1 ] ,
561+ y : [ 0 , 1 ] ,
562+ line : { width : 10 }
563+ } , {
564+ type : 'scattergl' ,
565+ mode : 'lines' ,
566+ x : [ 0 , 1 ] ,
567+ y : [ 1 , 0 ] ,
568+ line : { width : 10 }
569+ } ] , layout , config )
570+ . then ( function ( ) {
571+ var subplot = gd . _fullLayout . _plots . xy ;
572+ expect ( subplot . _scene . count ) . toBeGreaterThan ( 1 ) ;
573+
574+ expect ( function ( ) {
575+ ScatterGl . plot ( gd , subplot , [ gd . calcdata [ 1 ] ] ) ;
576+ } ) . not . toThrow ( ) ;
577+ } )
578+ . then ( done , done . fail ) ;
579+ } ) ;
580+
581+
582+ it ( '@gl should not throw when animating frames redraw=true' , function ( done ) {
583+ var layout = {
584+ width : 400 ,
585+ height : 300 ,
586+ margin : { l : 0 , r : 0 , t : 0 , b : 0 } ,
587+ xaxis : { range : [ 0 , 30 ] } ,
588+ yaxis : { range : [ 0 , 900 ] }
589+ } ;
590+ var config = { plotGlPixelRatio : 1 } ;
591+
592+ function makeXY ( n ) {
593+ var x = [ ] ;
594+ var y = [ ] ;
595+ for ( var i = 0 ; i < n ; i ++ ) {
596+ x . push ( i ) ;
597+ y . push ( i * i ) ;
598+ }
599+ return { x : x , y : y } ;
600+ }
601+
602+ var xy0 = makeXY ( 0 ) ;
603+ var xy10 = makeXY ( 10 ) ;
604+
605+ var data = [ {
606+ type : 'scattergl' ,
607+ mode : 'markers' ,
608+ marker : { size : 5 } ,
609+ x : xy10 . x ,
610+ y : xy10 . y
611+ } ] ;
612+
613+ var frames = [ {
614+ name : '0' ,
615+ data : [ { x : xy0 . x , y : xy0 . y } ]
616+ } , {
617+ name : '10' ,
618+ data : [ { x : xy10 . x , y : xy10 . y } ]
619+ } ] ;
620+
621+ Plotly . newPlot ( gd , data , layout , config )
622+ . then ( function ( ) {
623+ return Plotly . addFrames ( gd , frames ) ;
624+ } )
625+ . then ( function ( ) {
626+ return Plotly . animate ( gd , [ '10' ] , {
627+ mode : 'immediate' ,
628+ frame : { duration : 0 , redraw : true } ,
629+ transition : { duration : 0 }
630+ } ) ;
631+ } )
632+ . catch ( failTest )
633+ . then ( done ) ;
634+ } ) ;
635+
636+
548637} ) ;
549638
550639describe ( 'Test scattergl autorange:' , function ( ) {
0 commit comments