Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev-2.0] visual tests for Type #7429

Open
wants to merge 11 commits into
base: dev-2.0
Choose a base branch
from

Conversation

koundinyad
Copy link

Visual tests for typography module

Changes:

  • New visual tests for:
    • Font Properties
      • Font kerning
      • Font stretch values
      • Font variant caps
    • Text Alignment
      • Multi-line and single-line alignments
      • Wrap character and word tests
    • Text Baseline
    • Text Bounds
      • RTL text bounds
      • Rect mode variations
    • Text Font
      • Default and monospace font tests
    • Text Leading
    • Text Size
    • Text Spacing
      • Letter and word spacing
    • Text Style
    • Text Width

Screenshots of the change:

PR Checklist

Copy link

welcome bot commented Dec 16, 2024

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already. And be sure to add yourself to the list of contributors on the readme page!

Copy link
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.

Thanks for adding more tests! Before merging:

  • The existing screenshots for other visual tests have been removed. Could you restore them by calling git checkout dev-2.0 -- test/unit/screenshots ?
  • It looks like the new tests don't yet have screenshots. Running npm run test locally will generate new screenshots for tests that don't have any yet. Could I get you to do that and then commit the results?

@@ -18,100 +18,10 @@ visualSuite("Typography", function () {
p5.text("test", 0, 0);
screenshot();
});

visualTest('with a Google Font URL', async function(p5, screenshot) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this deleted some earlier tests. Would you be able to restore these?

@@ -1,6 +1,6 @@
import { visualSuite, visualTest } from "../visualTest";

visualSuite("Typography", function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe let's keep the title "Typograhy" for now so we won't have to move all the existing screenshots to a new folder

@koundinyad
Copy link
Author

Thank you @davepagurek! Have updated the Typography tests along with all the tests' screenshots

];

p5.createCanvas(300, 80);
p5.textSize(60);
p5.createCanvas(300, 200);
Copy link
Contributor

Choose a reason for hiding this comment

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

For speed, each screenshot is resized to fit in 50x50 before comparison. Since this image (and the alignment test too) is so large compared to that, differences in antialiasing between devices could cause this test to fail.

You can call screenshot() multiple times per test and it will generate a separate image each time. Maybe we can make the canvas size smaller for these, and instead of placing each case somewhere else in one canvas, we can clear the canvas for each case and screenshot() them before moving on to the next?

Copy link
Contributor

Choose a reason for hiding this comment

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

For added context, the test failure on CI right now is saying it expected this:
image

but got this:
image

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

Successfully merging this pull request may close these issues.

4 participants