@@ -318,6 +318,165 @@ describe('Test mesh3d', function() {
318318 . then ( done ) ;
319319 } ) ;
320320
321- } ) ;
321+ it ( '@gl mesh3d should be invisible when the vertex arrays are not arrays - number case' , function ( done ) {
322+ Plotly . plot ( gd , [ {
323+ x : [ 0 , 1 , 0.5 , 0.5 ] ,
324+ y : [ 0 , 0.5 , 1 , 0.5 ] ,
325+ z : 1 ,
326+ i : [ 0 , 0 , 0 , 1 ] ,
327+ j : [ 1 , 1 , 2 , 2 ] ,
328+ k : [ 2 , 3 , 3 , 3 ] ,
329+ type : 'mesh3d'
330+ } ] )
331+ . then ( function ( ) {
332+ assertVisibility ( false , 'to be visible' ) ;
333+ } )
334+ . catch ( failTest )
335+ . then ( done ) ;
336+ } ) ;
337+
338+ it ( '@gl mesh3d should be invisible when the vertex arrays are not arrays - boolean case' , function ( done ) {
339+ Plotly . plot ( gd , [ {
340+ x : [ 0 , 1 , 0.5 , 0.5 ] ,
341+ y : [ 0 , 0.5 , 1 , 0.5 ] ,
342+ z : true ,
343+ i : [ 0 , 0 , 0 , 1 ] ,
344+ j : [ 1 , 1 , 2 , 2 ] ,
345+ k : [ 2 , 3 , 3 , 3 ] ,
346+ type : 'mesh3d'
347+ } ] )
348+ . then ( function ( ) {
349+ assertVisibility ( false , 'to be visible' ) ;
350+ } )
351+ . catch ( failTest )
352+ . then ( done ) ;
353+ } ) ;
322354
355+ it ( '@gl mesh3d should be invisible when the vertex arrays are not arrays - object case' , function ( done ) {
356+ Plotly . plot ( gd , [ {
357+ x : [ 0 , 1 , 0.5 , 0.5 ] ,
358+ y : [ 0 , 0.5 , 1 , 0.5 ] ,
359+ z : { } ,
360+ i : [ 0 , 0 , 0 , 1 ] ,
361+ j : [ 1 , 1 , 2 , 2 ] ,
362+ k : [ 2 , 3 , 3 , 3 ] ,
363+ type : 'mesh3d'
364+ } ] )
365+ . then ( function ( ) {
366+ assertVisibility ( false , 'to be visible' ) ;
367+ } )
368+ . catch ( failTest )
369+ . then ( done ) ;
370+ } ) ;
371+
372+ it ( '@gl mesh3d should be invisible when the vertex arrays are not arrays - string case' , function ( done ) {
373+ Plotly . plot ( gd , [ {
374+ x : [ 0 , 1 , 0.5 , 0.5 ] ,
375+ y : [ 0 , 0.5 , 1 , 0.5 ] ,
376+ z : '[0, 0.5, 0.5, 1]' ,
377+ i : [ 0 , 0 , 0 , 1 ] ,
378+ j : [ 1 , 1 , 2 , 2 ] ,
379+ k : [ 2 , 3 , 3 , 3 ] ,
380+ type : 'mesh3d'
381+ } ] )
382+ . then ( function ( ) {
383+ assertVisibility ( false , 'to be visible' ) ;
384+ } )
385+ . catch ( failTest )
386+ . then ( done ) ;
387+ } ) ;
388+
389+ it ( '@gl mesh3d should be visible when the index arrays are not arrays - string case' , function ( done ) {
390+ Plotly . plot ( gd , [ {
391+ x : [ 0 , 1 , 0.5 , 0.5 ] ,
392+ y : [ 0 , 0.5 , 1 , 0.5 ] ,
393+ z : [ 0 , 0.5 , 0.5 , 1 ] ,
394+ i : [ 0 , 0 , 0 , 1 ] ,
395+ j : [ 1 , 1 , 2 , 2 ] ,
396+ k : '[2, 3, 3, 3]' ,
397+ type : 'mesh3d'
398+ } ] )
399+ . then ( function ( ) {
400+ assertVisibility ( true , 'to be invisible' ) ;
401+ } )
402+ . then ( function ( ) {
403+ assertPositions ( 4 , 'to be OK positions' ) ;
404+ } )
405+ . then ( function ( ) {
406+ assertCells ( 3 , 'to be OK cells' ) ;
407+ } )
408+ . catch ( failTest )
409+ . then ( done ) ;
410+ } ) ;
411+
412+ it ( '@gl mesh3d should be visible when the index arrays are not arrays - object case' , function ( done ) {
413+ Plotly . plot ( gd , [ {
414+ x : [ 0 , 1 , 0.5 , 0.5 ] ,
415+ y : [ 0 , 0.5 , 1 , 0.5 ] ,
416+ z : [ 0 , 0.5 , 0.5 , 1 ] ,
417+ i : [ 0 , 0 , 0 , 1 ] ,
418+ j : [ 1 , 1 , 2 , 2 ] ,
419+ k : { } ,
420+ type : 'mesh3d'
421+ } ] )
422+ . then ( function ( ) {
423+ assertVisibility ( true , 'to be invisible' ) ;
424+ } )
425+ . then ( function ( ) {
426+ assertPositions ( 4 , 'to be OK positions' ) ;
427+ } )
428+ . then ( function ( ) {
429+ assertCells ( 3 , 'to be OK cells' ) ;
430+ } )
431+ . catch ( failTest )
432+ . then ( done ) ;
433+ } ) ;
434+
435+ it ( '@gl mesh3d should be visible when the index arrays are not arrays - boolean case' , function ( done ) {
436+ Plotly . plot ( gd , [ {
437+ x : [ 0 , 1 , 0.5 , 0.5 ] ,
438+ y : [ 0 , 0.5 , 1 , 0.5 ] ,
439+ z : [ 0 , 0.5 , 0.5 , 1 ] ,
440+ i : [ 0 , 0 , 0 , 1 ] ,
441+ j : [ 1 , 1 , 2 , 2 ] ,
442+ k : true ,
443+ type : 'mesh3d'
444+ } ] )
445+ . then ( function ( ) {
446+ assertVisibility ( true , 'to be invisible' ) ;
447+ } )
448+ . then ( function ( ) {
449+ assertPositions ( 4 , 'to be OK positions' ) ;
450+ } )
451+ . then ( function ( ) {
452+ assertCells ( 3 , 'to be OK cells' ) ;
453+ } )
454+ . catch ( failTest )
455+ . then ( done ) ;
456+ } ) ;
457+
458+ it ( '@gl mesh3d should be visible when the index arrays are not arrays - number case' , function ( done ) {
459+ Plotly . plot ( gd , [ {
460+ x : [ 0 , 1 , 0.5 , 0.5 ] ,
461+ y : [ 0 , 0.5 , 1 , 0.5 ] ,
462+ z : [ 0 , 0.5 , 0.5 , 1 ] ,
463+ i : [ 0 , 0 , 0 , 1 ] ,
464+ j : [ 1 , 1 , 2 , 2 ] ,
465+ k : 1 ,
466+ type : 'mesh3d'
467+ } ] )
468+ . then ( function ( ) {
469+ assertVisibility ( true , 'to be invisible' ) ;
470+ } )
471+ . then ( function ( ) {
472+ assertPositions ( 4 , 'to be OK positions' ) ;
473+ } )
474+ . then ( function ( ) {
475+ assertCells ( 3 , 'to be OK cells' ) ;
476+ } )
477+ . catch ( failTest )
478+ . then ( done ) ;
479+ } ) ;
480+
481+ } ) ;
323482} ) ;
0 commit comments