@@ -77,11 +77,11 @@ describe('Test mesh3d', function() {
77
77
}
78
78
79
79
function assertPositions ( exp , msg ) {
80
- expect ( gd . _fullLayout . scene . _scene . glplot . objects [ 0 ] . positions . length !== undefined ) . toBe ( exp , msg ) ;
80
+ expect ( gd . _fullLayout . scene . _scene . glplot . objects [ 0 ] . positions . length ) . toBe ( exp , msg ) ;
81
81
}
82
82
83
83
function assertCells ( exp , msg ) {
84
- expect ( gd . _fullLayout . scene . _scene . glplot . objects [ 0 ] . cells . length !== undefined ) . toBe ( exp , msg ) ;
84
+ expect ( gd . _fullLayout . scene . _scene . glplot . objects [ 0 ] . cells . length ) . toBe ( exp , msg ) ;
85
85
}
86
86
87
87
it ( '@gl mesh3d should be visible when the indices are not integer' , function ( done ) {
@@ -98,10 +98,33 @@ describe('Test mesh3d', function() {
98
98
assertVisibility ( true , 'to be visible' ) ;
99
99
} )
100
100
. then ( function ( ) {
101
- assertPositions ( true , 'not to be false ' ) ;
101
+ assertPositions ( 4 , 'to be OK positions ' ) ;
102
102
} )
103
103
. then ( function ( ) {
104
- assertCells ( true , 'not to be false' ) ;
104
+ assertCells ( 4 , 'to be OK cells' ) ;
105
+ } )
106
+ . catch ( failTest )
107
+ . then ( done ) ;
108
+ } ) ;
109
+
110
+ it ( '@gl mesh3d should be visible when the indices could be rounded to be in vertex range' , function ( done ) {
111
+ Plotly . plot ( gd , [ {
112
+ x : [ 0 , 1 , 0.5 , 0.5 ] ,
113
+ y : [ 0 , 0.5 , 1 , 0.5 ] ,
114
+ z : [ 0 , 0.5 , 0.5 , 1 ] ,
115
+ i : [ - 0.49 , 0 , 0 , 1 ] ,
116
+ j : [ 1 , 1 , 2 , 2 ] ,
117
+ k : [ 2 , 3 , 3 , 3.49 ] ,
118
+ type : 'mesh3d'
119
+ } ] )
120
+ . then ( function ( ) {
121
+ assertVisibility ( true , 'to be visible' ) ;
122
+ } )
123
+ . then ( function ( ) {
124
+ assertPositions ( 4 , 'to be OK positions' ) ;
125
+ } )
126
+ . then ( function ( ) {
127
+ assertCells ( 4 , 'to be OK cells' ) ;
105
128
} )
106
129
. catch ( failTest )
107
130
. then ( done ) ;
@@ -121,10 +144,10 @@ describe('Test mesh3d', function() {
121
144
assertVisibility ( true , 'to be visible' ) ;
122
145
} )
123
146
. then ( function ( ) {
124
- assertPositions ( true , 'not to be false ' ) ;
147
+ assertPositions ( 0 , 'to be OK positions ' ) ;
125
148
} )
126
149
. then ( function ( ) {
127
- assertCells ( true , 'not to be false ' ) ;
150
+ assertCells ( 0 , 'to be OK cells ' ) ;
128
151
} )
129
152
. catch ( failTest )
130
153
. then ( done ) ;
@@ -144,10 +167,10 @@ describe('Test mesh3d', function() {
144
167
assertVisibility ( true , 'to be visible' ) ;
145
168
} )
146
169
. then ( function ( ) {
147
- assertPositions ( true , 'not to be false ' ) ;
170
+ assertPositions ( 0 , 'to be OK positions ' ) ;
148
171
} )
149
172
. then ( function ( ) {
150
- assertCells ( true , 'not to be false ' ) ;
173
+ assertCells ( 0 , 'to be OK cells ' ) ;
151
174
} )
152
175
. catch ( failTest )
153
176
. then ( done ) ;
@@ -167,10 +190,10 @@ describe('Test mesh3d', function() {
167
190
assertVisibility ( true , 'to be visible' ) ;
168
191
} )
169
192
. then ( function ( ) {
170
- assertPositions ( true , 'not to be false ' ) ;
193
+ assertPositions ( 0 , 'to be OK positions ' ) ;
171
194
} )
172
195
. then ( function ( ) {
173
- assertCells ( true , 'not to be false ' ) ;
196
+ assertCells ( 0 , 'to be OK cells ' ) ;
174
197
} )
175
198
. catch ( failTest )
176
199
. then ( done ) ;
@@ -190,10 +213,10 @@ describe('Test mesh3d', function() {
190
213
assertVisibility ( true , 'to be visible' ) ;
191
214
} )
192
215
. then ( function ( ) {
193
- assertPositions ( true , 'not to be false ' ) ;
216
+ assertPositions ( 4 , 'to be OK positions ' ) ;
194
217
} )
195
218
. then ( function ( ) {
196
- assertCells ( true , 'not to be false ' ) ;
219
+ assertCells ( 4 , 'to be OK cells ' ) ;
197
220
} )
198
221
. catch ( failTest )
199
222
. then ( done ) ;
@@ -212,10 +235,10 @@ describe('Test mesh3d', function() {
212
235
assertVisibility ( true , 'not to be visible' ) ;
213
236
} )
214
237
. then ( function ( ) {
215
- assertPositions ( true , 'not to be false ' ) ;
238
+ assertPositions ( 4 , 'to be OK positions ' ) ;
216
239
} )
217
240
. then ( function ( ) {
218
- assertCells ( true , 'not to be false ' ) ;
241
+ assertCells ( 4 , 'to be OK cells ' ) ;
219
242
} )
220
243
. catch ( failTest )
221
244
. then ( done ) ;
@@ -235,10 +258,10 @@ describe('Test mesh3d', function() {
235
258
assertVisibility ( true , 'to be visible' ) ;
236
259
} )
237
260
. then ( function ( ) {
238
- assertPositions ( true , 'not to be false ' ) ;
261
+ assertPositions ( 4 , 'to be OK positions ' ) ;
239
262
} )
240
263
. then ( function ( ) {
241
- assertCells ( true , 'not to be false ' ) ;
264
+ assertCells ( 0 , 'to be OK cells ' ) ;
242
265
} )
243
266
. catch ( failTest )
244
267
. then ( done ) ;
@@ -255,10 +278,10 @@ describe('Test mesh3d', function() {
255
278
assertVisibility ( true , 'to be visible' ) ;
256
279
} )
257
280
. then ( function ( ) {
258
- assertPositions ( true , 'not to be false ' ) ;
281
+ assertPositions ( 4 , 'to be OK positions ' ) ;
259
282
} )
260
283
. then ( function ( ) {
261
- assertCells ( true , 'not to be false ' ) ;
284
+ assertCells ( 3 , 'to be OK cells ' ) ;
262
285
} )
263
286
. catch ( failTest )
264
287
. then ( done ) ;
@@ -275,10 +298,10 @@ describe('Test mesh3d', function() {
275
298
assertVisibility ( true , 'not to be visible' ) ;
276
299
} )
277
300
. then ( function ( ) {
278
- assertPositions ( true , 'not to be false ' ) ;
301
+ assertPositions ( 0 , 'to be OK positions ' ) ;
279
302
} )
280
303
. then ( function ( ) {
281
- assertCells ( true , 'not to be false ' ) ;
304
+ assertCells ( 0 , 'to be OK cells ' ) ;
282
305
} )
283
306
. catch ( failTest )
284
307
. then ( done ) ;
0 commit comments