@@ -358,6 +358,7 @@ function checkImage(layout, imageObj, imageBBox) {}
358
358
359
359
function imageTest ( gd , layout , xaxtype , yaxtype , x , y , sizex , sizey , xanchor ,
360
360
yanchor , xref , yref , xid , yid ) {
361
+ console . log ( 'running imageTest on ' , gd ) ;
361
362
var image = {
362
363
x : x ,
363
364
y : y ,
@@ -540,6 +541,9 @@ function test_correct_aro_positions() {
540
541
testCombos . forEach ( testDomRefAROCombo ) ;
541
542
}
542
543
544
+ var testImageComboMock = Lib . extendDeep ( { } ,
545
+ require ( '../test/image/mocks/domain_ref_base.json' ) ) ;
546
+
543
547
function testImageCombo ( combo , keep_graph_div ) {
544
548
var axistypex = combo [ 0 ] ;
545
549
var axistypey = combo [ 1 ] ;
@@ -553,13 +557,14 @@ function testImageCombo(combo,keep_graph_div) {
553
557
var yid = axispair [ 1 ] ;
554
558
var xref = makeAxRef ( xid , aroposx . ref ) ;
555
559
var yref = makeAxRef ( yid , aroposy . ref ) ;
556
- var gd = createGraphDiv ( gd_id ) ;
557
- var mock = Lib . extendDeep ( { } ,
558
- require ( '../test/image/mocks/domain_ref_base.json' ) ) ;
559
560
if ( DEBUG ) {
560
561
console . log ( combo ) ;
561
562
}
562
- return Plotly . newPlot ( gd , mock ) . then ( function ( gd ) {
563
+ return new Promise ( function ( resolve ) {
564
+ var gd = createGraphDiv ( gd_id ) ;
565
+ resolve ( gd ) ;
566
+ } ) . then ( function ( gd ) { return Plotly . newPlot ( gd , testImageComboMock ) ; } )
567
+ . then ( function ( gd ) {
563
568
return imageTest ( gd , { } , axistypex , axistypey ,
564
569
aroposx . value [ 0 ] , aroposy . value [ 0 ] , aroposx . size ,
565
570
aroposy . size ,
@@ -575,13 +580,16 @@ function testImageCombo(combo,keep_graph_div) {
575
580
"yref:" , yref , "\n" ,
576
581
] . join ( ' ' ) , test_ret ) ;
577
582
} ) . then ( function ( ) {
583
+ console . log ( "Hello?" , keep_graph_div ) ;
578
584
if ( ! keep_graph_div ) {
585
+ console . log ( 'destroying graph div ' , gd_id ) ;
586
+ Plotly . purge ( gd_id ) ;
579
587
destroyGraphDiv ( gd_id ) ;
580
588
}
581
589
} ) ;
582
590
}
583
591
584
- function runImageTests ( ) {
592
+ function runImageTests ( start_stop , filter ) {
585
593
var testCombos = [ ...iterable . cartesianProduct ( [
586
594
axisTypes , axisTypes , axisPairs ,
587
595
// axis reference types are contained in here
@@ -590,8 +598,26 @@ function runImageTests() {
590
598
] ) ] ;
591
599
// add a unique id to each combination so we can instantiate a unique graph
592
600
// each time
593
- testCombos = testCombos . map ( ( c , i ) => c . concat ( [ 'graph-' + i ] ) ) . slice ( 0 , 20 ) ;
594
- testCombos . map ( testImageCombo ) . reduce ( ( a , v ) => a . then ( v ) ) ;
601
+ testCombos = testCombos . map ( ( c , i ) => c . concat ( [ 'graph-' + i ] ) ) ;
602
+ if ( filter ) {
603
+ testCombos = testCombos . filter ( filter ) ;
604
+ }
605
+ if ( start_stop ) {
606
+ testCombos = testCombos . slice ( start_stop . start , start_stop . stop ) ;
607
+ }
608
+ console . log ( "Executing " + testCombos . length + " tests" ) ;
609
+ var tc = testCombos . map ( c => testImageCombo ( c , false ) ) . reduce ( ( a , v ) => a . then ( v ) ) ;
610
+ }
611
+
612
+ function testAnnotationCombo ( combo ) {
613
+ var axistypex = combo [ 0 ] ;
614
+ var axistypey = combo [ 1 ] ;
615
+ var axispair = combo [ 2 ] ;
616
+ var aroposx = combo [ 3 ] ;
617
+ var aroposy = combo [ 4 ] ;
618
+ var xanchor = combo [ 5 ] ;
619
+ var yanchor = combo [ 6 ] ;
620
+ var gd_id = combo [ 7 ] ;
595
621
}
596
622
597
623
module . exports = {
0 commit comments