From 96fab27f9bfb12428687e461b858917ce57b424e Mon Sep 17 00:00:00 2001 From: aakritithecoder Date: Tue, 3 Mar 2026 18:14:18 +0530 Subject: [PATCH 1/2] Add ShapeTests for Processing4 --- core/test/processing/ShapeTests.java | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 core/test/processing/ShapeTests.java diff --git a/core/test/processing/ShapeTests.java b/core/test/processing/ShapeTests.java new file mode 100644 index 000000000..b146da472 --- /dev/null +++ b/core/test/processing/ShapeTests.java @@ -0,0 +1,35 @@ +package processing; +import org.junit.Test; +import static org.junit.Assert.*; +import processing.core.PGraphics; + +public class ShapeTests { + + @Test + public void testCanvasWidthAfterSetSize() { + // Create a PGraphics object and set its size + PGraphics pg = new PGraphics(); + pg.setSize(200, 100); // canvas size + + pg.beginDraw(); + pg.rect(10, 10, 100, 50); // draw a rectangle + pg.endDraw(); + + // Assert that the canvas width is 200 (not the rect width) + assertEquals(200, pg.width); + } + + @Test + public void testCanvasHeightAfterSetSize() { + // Create a PGraphics object and set its size + PGraphics pg = new PGraphics(); + pg.setSize(300, 150); // canvas size + + pg.beginDraw(); + pg.rect(20, 20, 50, 25); // draw another rectangle + pg.endDraw(); + + // Assert that the canvas height is 150 + assertEquals(150, pg.height); + } +} \ No newline at end of file From 6e44b68cb615b3b82c32dc31fef9ba87bca137fd Mon Sep 17 00:00:00 2001 From: aakritithecoder Date: Tue, 24 Mar 2026 01:09:29 +0530 Subject: [PATCH 2/2] Rename ShapeTests to PGraphicsTests, move to core package, merge tests --- core/test/processing/ShapeTests.java | 35 ------------------- core/test/processing/core/PGraphicsTests.java | 19 ++++++++++ 2 files changed, 19 insertions(+), 35 deletions(-) delete mode 100644 core/test/processing/ShapeTests.java create mode 100644 core/test/processing/core/PGraphicsTests.java diff --git a/core/test/processing/ShapeTests.java b/core/test/processing/ShapeTests.java deleted file mode 100644 index b146da472..000000000 --- a/core/test/processing/ShapeTests.java +++ /dev/null @@ -1,35 +0,0 @@ -package processing; -import org.junit.Test; -import static org.junit.Assert.*; -import processing.core.PGraphics; - -public class ShapeTests { - - @Test - public void testCanvasWidthAfterSetSize() { - // Create a PGraphics object and set its size - PGraphics pg = new PGraphics(); - pg.setSize(200, 100); // canvas size - - pg.beginDraw(); - pg.rect(10, 10, 100, 50); // draw a rectangle - pg.endDraw(); - - // Assert that the canvas width is 200 (not the rect width) - assertEquals(200, pg.width); - } - - @Test - public void testCanvasHeightAfterSetSize() { - // Create a PGraphics object and set its size - PGraphics pg = new PGraphics(); - pg.setSize(300, 150); // canvas size - - pg.beginDraw(); - pg.rect(20, 20, 50, 25); // draw another rectangle - pg.endDraw(); - - // Assert that the canvas height is 150 - assertEquals(150, pg.height); - } -} \ No newline at end of file diff --git a/core/test/processing/core/PGraphicsTests.java b/core/test/processing/core/PGraphicsTests.java new file mode 100644 index 000000000..8d30b8fb7 --- /dev/null +++ b/core/test/processing/core/PGraphicsTests.java @@ -0,0 +1,19 @@ +package processing.core; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import processing.core.PGraphics; + +public class PGraphicsTests { + + @Test + public void testCanvasSizeAfterSetSize() { + // Create a PGraphics object and set its size + PGraphics pg = new PGraphics(); + pg.setSize(200, 150); + + // Assert that both width and height are correctly initialized + assertEquals(200, pg.width); + assertEquals(150, pg.height); + } +} \ No newline at end of file