diff --git a/test/unit/visual/cases/webgl.js b/test/unit/visual/cases/webgl.js index ad3a3998af..6febdfb698 100644 --- a/test/unit/visual/cases/webgl.js +++ b/test/unit/visual/cases/webgl.js @@ -1145,4 +1145,62 @@ visualSuite('WebGL', function() { }); }); + visualSuite('Transforms', function() { + visualTest('translate() moves shapes in x and y axes', function(p5, screenshot) { + p5.createCanvas(50, 50, p5.WEBGL); + p5.background(200); + p5.noStroke(); + + // Red circle at origin + p5.fill('red'); + p5.circle(0, 0, 10); + + // Green circle translated by (15, 0) + p5.push(); + p5.translate(15, 0); + p5.fill('green'); + p5.circle(0, 0, 10); + p5.pop(); + + // Blue circle translated by (0, 15) + p5.push(); + p5.translate(0, 15); + p5.fill('blue'); + p5.circle(0, 0, 10); + p5.pop(); + + screenshot(); + }); + + visualTest('rotate() rotates shapes around z-axis', function(p5, screenshot) { + p5.createCanvas(50, 50, p5.WEBGL); + p5.background(200); + p5.noStroke(); + p5.fill('red'); + p5.rectMode(p5.CENTER); + p5.rotate(p5.PI / 4); + p5.rect(0, 0, 30, 30); + screenshot(); + }); + + visualTest('scale() uniformly scales shapes', function(p5, screenshot) { + p5.createCanvas(50, 50, p5.WEBGL); + p5.background(200); + p5.noStroke(); + p5.fill('red'); + + // Unscaled circle + p5.circle(-12, 0, 20); + + // Scaled circle (half size) + p5.push(); + p5.translate(12, 0); + p5.scale(0.5); + p5.circle(0, 0, 20); + p5.pop(); + + screenshot(); + }); + }); + }); diff --git a/test/unit/visual/screenshots/WebGL/Transforms/rotate() rotates shapes around z-axis/000.png b/test/unit/visual/screenshots/WebGL/Transforms/rotate() rotates shapes around z-axis/000.png new file mode 100644 index 0000000000..80f7767b67 Binary files /dev/null and b/test/unit/visual/screenshots/WebGL/Transforms/rotate() rotates shapes around z-axis/000.png differ diff --git a/test/unit/visual/screenshots/WebGL/Transforms/rotate() rotates shapes around z-axis/metadata.json b/test/unit/visual/screenshots/WebGL/Transforms/rotate() rotates shapes around z-axis/metadata.json new file mode 100644 index 0000000000..2d4bfe30da --- /dev/null +++ b/test/unit/visual/screenshots/WebGL/Transforms/rotate() rotates shapes around z-axis/metadata.json @@ -0,0 +1,3 @@ +{ + "numScreenshots": 1 +} \ No newline at end of file diff --git a/test/unit/visual/screenshots/WebGL/Transforms/scale() uniformly scales shapes/000.png b/test/unit/visual/screenshots/WebGL/Transforms/scale() uniformly scales shapes/000.png new file mode 100644 index 0000000000..aa74e48648 Binary files /dev/null and b/test/unit/visual/screenshots/WebGL/Transforms/scale() uniformly scales shapes/000.png differ diff --git a/test/unit/visual/screenshots/WebGL/Transforms/scale() uniformly scales shapes/metadata.json b/test/unit/visual/screenshots/WebGL/Transforms/scale() uniformly scales shapes/metadata.json new file mode 100644 index 0000000000..2d4bfe30da --- /dev/null +++ b/test/unit/visual/screenshots/WebGL/Transforms/scale() uniformly scales shapes/metadata.json @@ -0,0 +1,3 @@ +{ + "numScreenshots": 1 +} \ No newline at end of file diff --git a/test/unit/visual/screenshots/WebGL/Transforms/translate() moves shapes in x and y axes/000.png b/test/unit/visual/screenshots/WebGL/Transforms/translate() moves shapes in x and y axes/000.png new file mode 100644 index 0000000000..f15c8f16da Binary files /dev/null and b/test/unit/visual/screenshots/WebGL/Transforms/translate() moves shapes in x and y axes/000.png differ diff --git a/test/unit/visual/screenshots/WebGL/Transforms/translate() moves shapes in x and y axes/metadata.json b/test/unit/visual/screenshots/WebGL/Transforms/translate() moves shapes in x and y axes/metadata.json new file mode 100644 index 0000000000..2d4bfe30da --- /dev/null +++ b/test/unit/visual/screenshots/WebGL/Transforms/translate() moves shapes in x and y axes/metadata.json @@ -0,0 +1,3 @@ +{ + "numScreenshots": 1 +} \ No newline at end of file