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

Add leading/trailing whitespace subtests #49537

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

rwlbuis
Copy link
Contributor

@rwlbuis rwlbuis commented Dec 5, 2024

Add leading/trailing whitespace subtests to verify the effects on actualBoundingBoxLeft/actualBoundingBoxRight text metrics.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

This file at the top has:

DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.

@@ -52,6 +58,7 @@ <h1>2d.text.measure.actualBoundingBox</h1>
_assert(ctx.measureText('D').actualBoundingBoxDescent >= 12, "ctx.measureText('D').actualBoundingBoxDescent >= 12");
_assert(ctx.measureText('D').actualBoundingBoxDescent <= 15, "ctx.measureText('D').actualBoundingBoxDescent <= 15");


Copy link
Member

Choose a reason for hiding this comment

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

undo?

_assert(ctx.measureText('A ').actualBoundingBoxRight >= 50, "ctx.measureText('A ').actualBoundingBoxRight >= 50");

_assert(Math.abs(ctx.measureText(' A').actualBoundingBoxLeft) >= 50, "Math.abs(ctx.measureText(' A').actualBoundingBoxLeft) >= 50");
_assert(ctx.measureText(' A').actualBoundingBoxRight <= 101, "ctx.measureText(' A').actualBoundingBoxRight <= 101");
Copy link
Member

Choose a reason for hiding this comment

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

It might be useful to separate this out so it can be tested standalone. I think we also want to test some other whitespace code points. Unicode has a lot of them.

@rwlbuis
Copy link
Contributor Author

rwlbuis commented Dec 5, 2024

This file at the top has:

DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.

Oops still not enough CAPS for me clearly :) Will fix.

Add leading/trailing whitespace subtests to verify the effects on
actualBoundingBoxLeft/actualBoundingBoxRight text metrics.
@rwlbuis rwlbuis force-pushed the add_leading_trsiling_whitespace_subtests branch from f8c2bae to 995fe84 Compare December 5, 2024 11:22
@wpt-pr-bot wpt-pr-bot requested a review from Cwiiis December 5, 2024 11:23
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

This looks like a good start, but I would really recommend adding tests for more types of whitespace to ensure implementations are aligned on what whitespace gets ignored. See https://en.wikipedia.org/wiki/Whitespace_character for inspiration.

@rwlbuis rwlbuis merged commit 41d9929 into master Dec 5, 2024
20 checks passed
@rwlbuis rwlbuis deleted the add_leading_trsiling_whitespace_subtests branch December 5, 2024 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants