Skip to content

Add ShapeTests for Processing4 core module#1462

Open
aakritithecoder wants to merge 1 commit intoprocessing:mainfrom
aakritithecoder:add-shape-tests
Open

Add ShapeTests for Processing4 core module#1462
aakritithecoder wants to merge 1 commit intoprocessing:mainfrom
aakritithecoder:add-shape-tests

Conversation

@aakritithecoder
Copy link

Added ShapeTests.java under core/test/processing to verify canvas width and height initialization.
This ensures Processing’s PGraphics behaves as expected when setSize() is called.

@aakritithecoder
Copy link
Author

This test ensures that PGraphics initializes width and height correctly when setSize() is called.
It helps prevent regressions in canvas setup logic.
image
ShapeTests ran sucessfully !!

Copy link
Collaborator

@catilac catilac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving forward please create an issue first as per our guidelines.
This code is a good start for creating a test suite for PGraphics thank you!

Comment on lines +6 to +11
public class ShapeTests {

@Test
public void testCanvasWidthAfterSetSize() {
// Create a PGraphics object and set its size
PGraphics pg = new PGraphics();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is testing PGraphics please update the class name, and place this in the core/test/processing/core folder

// Assert that the canvas height is 150
assertEquals(150, pg.height);
}
} No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test of the pg height can be done in the other test function that tests width.

Comment on lines +14 to +17
pg.beginDraw();
pg.rect(10, 10, 100, 50); // draw a rectangle
pg.endDraw();

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not necessary since you are testing setSize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants