Skip to content

States tests and rename#8778

Merged
davepagurek merged 2 commits intoprocessing:dev-2.0from
harshiltewari2004:states-tests-and-rename
May 10, 2026
Merged

States tests and rename#8778
davepagurek merged 2 commits intoprocessing:dev-2.0from
harshiltewari2004:states-tests-and-rename

Conversation

@harshiltewari2004
Copy link
Copy Markdown
Contributor

Resolves #8761

Changes

  • Renamed States.getDiff()States.takeDiff() to reflect that it mutates state (clears #modified after returning), per discussion in [p5.js 2.0+ Bug Report]: Missing unit tests for src/core/States.js #8761 with @davepagurek.
  • Updated the one call site in src/core/p5.Renderer.js to use the new name.
  • Added a new test file test/unit/core/States.js with 9 tests covering the public API: constructor, setValue, getModified, takeDiff, applyDiff, plus a push/pop integration test.

Notes on test results

Local npm test shows all 9 new States tests passing. There are 4 pre-existing unrelated timeout failures in visual regression tests (test/unit/visual/cases/noise.js, test/unit/visual/cases/shape_modes.js) that don't reference any of the code I changed — they appear flaky on my machine. Running the new test file in isolation (npx vitest run test/unit/core/States.js) shows clean 9/9 pass.

PR Checklist

@p5-bot
Copy link
Copy Markdown

p5-bot Bot commented May 10, 2026

Continuous Release

CDN link

Published Packages

Commit hash: b54e540

Previous deployments

This is an automated message.

Copy link
Copy Markdown
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@davepagurek davepagurek merged commit 4b367b1 into processing:dev-2.0 May 10, 2026
5 checks passed
@davepagurek
Copy link
Copy Markdown
Contributor

@all-contributors please add @harshiltewari2004 for code

@harshiltewari2004
Copy link
Copy Markdown
Contributor Author

Thank you so much @davepagurek !

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