@@ -14,132 +14,6 @@ var drag = require('../assets/drag');
1414var selectButton = require ( '../assets/modebar_button' ) ;
1515var delay = require ( '../assets/delay' ) ;
1616
17- describe ( 'Test gl3d before/after plot' , function ( ) {
18- var gd ;
19-
20- var mock = require ( '../../image/mocks/gl3d_marker-arrays.json' ) ;
21-
22- beforeEach ( function ( ) {
23- jasmine . DEFAULT_TIMEOUT_INTERVAL = 8000 ;
24- } ) ;
25-
26- afterEach ( function ( ) {
27- Plotly . purge ( gd ) ;
28- destroyGraphDiv ( ) ;
29- } ) ;
30-
31- it ( '@noCI @gl should not rotate camera on the very first click before scene is complete and then should rotate' , function ( done ) {
32- var _mock = Lib . extendDeep (
33- {
34- layout : {
35- scene : {
36- camera : {
37- up : {
38- x : 0 ,
39- y : 0 ,
40- z : 1
41- } ,
42- eye : {
43- x : 1.2 ,
44- y : 1.2 ,
45- z : 1.2
46- } ,
47- center : {
48- x : 0 ,
49- y : 0 ,
50- z : 0
51- }
52- }
53- }
54- }
55- } ,
56- mock
57- ) ;
58-
59- var x = 605 ;
60- var y = 271 ;
61-
62- function _stayThere ( ) {
63- mouseEvent ( 'mousemove' , x , y ) ;
64- return delay ( 20 ) ( ) ;
65- }
66-
67- function _clickThere ( ) {
68- mouseEvent ( 'mouseover' , x , y , { buttons : 1 } ) ;
69- return delay ( 20 ) ( ) ;
70- }
71-
72- function _clickOtherplace ( ) {
73- mouseEvent ( 'mouseover' , 300 , 300 , { buttons : 1 } ) ;
74- return delay ( 20 ) ( ) ;
75- }
76-
77- _stayThere ( )
78- . then ( function ( ) {
79- gd = createGraphDiv ( ) ;
80- return Plotly . newPlot ( gd , _mock ) ;
81- } )
82- . then ( delay ( 100 ) )
83- . then ( function ( ) {
84- var cameraIn = gd . _fullLayout . scene . camera ;
85- expect ( cameraIn . up . x ) . toEqual ( 0 , 'cameraIn.up.x' ) ;
86- expect ( cameraIn . up . y ) . toEqual ( 0 , 'cameraIn.up.y' ) ;
87- expect ( cameraIn . up . z ) . toEqual ( 1 , 'cameraIn.up.z' ) ;
88- expect ( cameraIn . center . x ) . toEqual ( 0 , 'cameraIn.center.x' ) ;
89- expect ( cameraIn . center . y ) . toEqual ( 0 , 'cameraIn.center.y' ) ;
90- expect ( cameraIn . center . z ) . toEqual ( 0 , 'cameraIn.center.z' ) ;
91- expect ( cameraIn . eye . x ) . toEqual ( 1.2 , 'cameraIn.eye.x' ) ;
92- expect ( cameraIn . eye . y ) . toEqual ( 1.2 , 'cameraIn.eye.y' ) ;
93- expect ( cameraIn . eye . z ) . toEqual ( 1.2 , 'cameraIn.eye.z' ) ;
94- } )
95- . then ( delay ( 100 ) )
96- . then ( function ( ) {
97- var cameraBefore = gd . _fullLayout . scene . _scene . camera ;
98- expect ( cameraBefore . up [ 0 ] ) . toBeCloseTo ( 0 , 2 , 'cameraBefore.up[0]' ) ;
99- expect ( cameraBefore . up [ 1 ] ) . toBeCloseTo ( 0 , 2 , 'cameraBefore.up[1]' ) ;
100- expect ( cameraBefore . up [ 2 ] ) . toBeCloseTo ( 1 , 2 , 'cameraBefore.up[2]' ) ;
101- expect ( cameraBefore . center [ 0 ] ) . toBeCloseTo ( 0 , 2 , 'cameraBefore.center[0]' ) ;
102- expect ( cameraBefore . center [ 1 ] ) . toBeCloseTo ( 0 , 2 , 'cameraBefore.center[1]' ) ;
103- expect ( cameraBefore . center [ 2 ] ) . toBeCloseTo ( 0 , 2 , 'cameraBefore.center[2]' ) ;
104- expect ( cameraBefore . eye [ 0 ] ) . toBeCloseTo ( 1.2 , 2 , 'cameraBefore.eye[0]' ) ;
105- expect ( cameraBefore . eye [ 1 ] ) . toBeCloseTo ( 1.2 , 2 , 'cameraBefore.eye[1]' ) ;
106- expect ( cameraBefore . eye [ 2 ] ) . toBeCloseTo ( 1.2 , 2 , 'cameraBefore.eye[2]' ) ;
107- expect ( cameraBefore . mouseListener . enabled === true ) ;
108- } )
109- . then ( _clickThere )
110- . then ( delay ( 100 ) )
111- . then ( function ( ) {
112- var cameraAfter = gd . _fullLayout . scene . _scene . camera ;
113- expect ( cameraAfter . up [ 0 ] ) . toBeCloseTo ( 0 , 2 , 'cameraAfter.up[0]' ) ;
114- expect ( cameraAfter . up [ 1 ] ) . toBeCloseTo ( 0 , 2 , 'cameraAfter.up[1]' ) ;
115- expect ( cameraAfter . up [ 2 ] ) . toBeCloseTo ( 1 , 2 , 'cameraAfter.up[2]' ) ;
116- expect ( cameraAfter . center [ 0 ] ) . toBeCloseTo ( 0 , 2 , 'cameraAfter.center[0]' ) ;
117- expect ( cameraAfter . center [ 1 ] ) . toBeCloseTo ( 0 , 2 , 'cameraAfter.center[1]' ) ;
118- expect ( cameraAfter . center [ 2 ] ) . toBeCloseTo ( 0 , 2 , 'cameraAfter.center[2]' ) ;
119- expect ( cameraAfter . eye [ 0 ] ) . toBeCloseTo ( 1.2 , 2 , 'cameraAfter.eye[0]' ) ;
120- expect ( cameraAfter . eye [ 1 ] ) . toBeCloseTo ( 1.2 , 2 , 'cameraAfter.eye[1]' ) ;
121- expect ( cameraAfter . eye [ 2 ] ) . toBeCloseTo ( 1.2 , 2 , 'cameraAfter.eye[2]' ) ;
122- expect ( cameraAfter . mouseListener . enabled === true ) ;
123- } )
124- . then ( _clickOtherplace )
125- . then ( delay ( 100 ) )
126- . then ( function ( ) {
127- var cameraFinal = gd . _fullLayout . scene . _scene . camera ;
128- expect ( cameraFinal . up [ 0 ] ) . toBeCloseTo ( 0 , 2 , 'cameraFinal.up[0]' ) ;
129- expect ( cameraFinal . up [ 1 ] ) . toBeCloseTo ( 0 , 2 , 'cameraFinal.up[1]' ) ;
130- expect ( cameraFinal . up [ 2 ] ) . toBeCloseTo ( 1 , 2 , 'cameraFinal.up[2]' ) ;
131- expect ( cameraFinal . center [ 0 ] ) . toBeCloseTo ( 0 , 2 , 'cameraFinal.center[0]' ) ;
132- expect ( cameraFinal . center [ 1 ] ) . toBeCloseTo ( 0 , 2 , 'cameraFinal.center[1]' ) ;
133- expect ( cameraFinal . center [ 2 ] ) . toBeCloseTo ( 0 , 2 , 'cameraFinal.center[2]' ) ;
134- expect ( cameraFinal . eye [ 0 ] ) . not . toBeCloseTo ( 1.2 , 2 , 'cameraFinal.eye[0]' ) ;
135- expect ( cameraFinal . eye [ 1 ] ) . not . toBeCloseTo ( 1.2 , 2 , 'cameraFinal.eye[1]' ) ;
136- expect ( cameraFinal . eye [ 2 ] ) . not . toBeCloseTo ( 1.2 , 2 , 'cameraFinal.eye[2]' ) ;
137- expect ( cameraFinal . mouseListener . enabled === true ) ;
138- } )
139- . then ( done , done . fail ) ;
140- } ) ;
141- } ) ;
142-
14317describe ( 'Test gl3d plots' , function ( ) {
14418 var gd ;
14519
0 commit comments