@@ -2950,4 +2950,31 @@ suite('p5.RendererGL', function() {
29502950 myp5 . checkPMatrix ( ) ;
29512951 } ) ;
29522952 } ) ;
2953+
2954+ suite ( 'buildGeometry' , function ( ) {
2955+ test ( 'captures geometry without drawing' , function ( ) {
2956+ myp5 . createCanvas ( 10 , 10 , myp5 . WEBGL ) ;
2957+ myp5 . background ( 255 , 0 , 0 ) ;
2958+ const geom = myp5 . buildGeometry ( ( ) => myp5 . circle ( 0 , 0 , 5 ) ) ;
2959+ expect ( geom . vertices . length ) . toBeGreaterThan ( 0 ) ;
2960+ expect ( myp5 . get ( 5 , 5 ) ) . toEqual ( [ 255 , 0 , 0 , 255 ] ) ;
2961+ } ) ;
2962+
2963+ test ( 'returns fill state back to a previous color' , function ( ) {
2964+ myp5 . createCanvas ( 10 , 10 , myp5 . WEBGL ) ;
2965+ myp5 . background ( 255 , 0 , 0 ) ;
2966+ myp5 . fill ( 0 , 255 , 0 ) ;
2967+ const geom = myp5 . buildGeometry ( ( ) => myp5 . circle ( 0 , 0 , 10 ) ) ;
2968+ myp5 . model ( geom ) ;
2969+ expect ( myp5 . get ( 5 , 5 ) ) . toEqual ( [ 0 , 255 , 0 , 255 ] ) ;
2970+ } ) ;
2971+ test ( 'returns fill state back to no fill' , function ( ) {
2972+ myp5 . createCanvas ( 10 , 10 , myp5 . WEBGL ) ;
2973+ myp5 . background ( 255 , 0 , 0 ) ;
2974+ myp5 . noFill ( ) ;
2975+ const geom = myp5 . buildGeometry ( ( ) => myp5 . circle ( 0 , 0 , 10 ) ) ;
2976+ myp5 . model ( geom ) ;
2977+ expect ( myp5 . get ( 5 , 5 ) ) . toEqual ( [ 255 , 0 , 0 , 255 ] ) ;
2978+ } ) ;
2979+ } ) ;
29532980} ) ;
0 commit comments