Skip to content

Commit 7d1d338

Browse files
committed
Test: Move noSmooth() canvas position test to RendererGL.js
1 parent 2e28bc5 commit 7d1d338

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/unit/webgl/p5.RendererGL.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)