File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,24 @@ suite('p5.RendererGL', function() {
2323 } ) ;
2424 } ) ;
2525
26+ suite ( 'noSmooth() canvas position preservation' , function ( ) {
27+ test ( 'should maintain the canvas position after calling noSmooth()' , function ( ) {
28+ myp5 . createCanvas ( 300 , 300 , myp5 . WEBGL ) ;
29+ let cnv = myp5 . canvas ;
30+ cnv . style . position = 'absolute' ;
31+ cnv . style . top = '150px' ;
32+ cnv . style . left = '50px' ;
33+ const originalTop = cnv . style . top ;
34+ const originalLeft = cnv . style . left ;
35+
36+ // Calling noSmooth()
37+ myp5 . noSmooth ( ) ;
38+ assert . equal ( cnv . style . top , originalTop ) ;
39+ assert . equal ( cnv . style . left , originalLeft ) ;
40+ } ) ;
41+ } ) ;
42+
43+
2644 suite ( 'webglVersion' , function ( ) {
2745 test ( 'should return WEBGL2 by default' , function ( ) {
2846 myp5 . createCanvas ( 10 , 10 , myp5 . WEBGL ) ;
You can’t perform that action at this time.
0 commit comments