Skip to content

AX: Add tests for RTL/LTR bidi text #46728

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

Conversation

gr3g-apple-com
Copy link
Contributor

@gr3g-apple-com gr3g-apple-com commented Jun 13, 2025

c275e78

AX: Add tests for RTL/LTR bidi text
https://bugs.webkit.org/show_bug.cgi?id=294460
rdar://153327595

Reviewed by Tyler Wilcock.

Add tests for bidi text: English-Arabic and English-Hebrew. This test
counts the number of LTR and RTL positions within strings based on
textmarkers. There are six strings tested, each with a unique value
applied to its unicode-bidi css property.

* LayoutTests/accessibility/text-marker/text-marker-bidi-element-arabic-expected.txt: Added.
* LayoutTests/accessibility/text-marker/text-marker-bidi-element-arabic.html: Added.
* LayoutTests/accessibility/text-marker/text-marker-bidi-element-hebrew-expected.txt: Added.
* LayoutTests/accessibility/text-marker/text-marker-bidi-element-hebrew.html: Added.
* LayoutTests/platform/ios/TestExpectations:

Canonical link: https://commits.webkit.org/296764@main

199a68d

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ⏳ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ❌ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 🛠 playstation
✅ 🛠 tv
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

staticTextTextMarkerRange = staticText.textMarkerRangeForElement(staticText);
output += expect("staticText.textMarkerRangeLength(staticTextTextMarkerRange)", "28");

output += expectRectWithVariance("staticText.boundsForRange(0, 28)", -1, -1, 188, 18, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

expectRectWithVariance is good, but it still does feel like this test might tend to break if things shift by a couple of pixels.

Would it be possible to instead iterate over the characters and, using the bounds, just assert whether or not each index moved to the left or to the right?

@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 0be54d7 to 7ebbb87 Compare June 13, 2025 21:40
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for 7ebbb87. Live statuses available at the PR page, #46728

@gr3g-apple-com gr3g-apple-com changed the title AX: Add tests for RTL/LTR bidi text add tests for bidi text: english-arabic and english-hebrew Jun 13, 2025
@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 7ebbb87 to a3dcd16 Compare June 13, 2025 21:45
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for a3dcd16. Live statuses available at the PR page, #46728

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 13, 2025
@gr3g-apple-com gr3g-apple-com changed the title add tests for bidi text: english-arabic and english-hebrew AX: Add tests for RTL/LTR bidi text Jun 14, 2025
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for dab773c. Live statuses available at the PR page, #46728

@gr3g-apple-com gr3g-apple-com changed the title AX: Add tests for RTL/LTR bidi text add tests for bidi text: english-arabic and english-hebrew Jun 14, 2025
@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from dab773c to 1a47eec Compare June 14, 2025 02:02
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for 1a47eec. Live statuses available at the PR page, #46728

@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 1a47eec to 412b05d Compare June 14, 2025 02:42
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for 412b05d. Live statuses available at the PR page, #46728

Comment on lines 4 to 26
<meta charset="utf-8">
<script src="../../resources/js-test.js"></script>
<script src="../../resources/accessibility-helper.js"></script>
<style>
.unicode-bidi-normal {
unicode-bidi: normal;
}
.unicode-bidi-embed {
unicode-bidi: embed;
}
.unicode-bidi-bidi-override {
unicode-bidi: bidi-override;
}
.unicode-bidi-plaintext {
unicode-bidi: plaintext;
}
.unicode-bidi-isolate {
unicode-bidi: isolate;
}
.unicode-bidi-isolate-override {
unicode-bidi: isolate-override;
}
</style>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think typically in other accessibility layout tests, we don't indent things in the <head>.

Comment on lines 4 to 26
<meta charset="utf-8">
<script src="../../resources/js-test.js"></script>
<script src="../../resources/accessibility-helper.js"></script>
<style>
.unicode-bidi-normal {
unicode-bidi: normal;
}
.unicode-bidi-embed {
unicode-bidi: embed;
}
.unicode-bidi-bidi-override {
unicode-bidi: bidi-override;
}
.unicode-bidi-plaintext {
unicode-bidi: plaintext;
}
.unicode-bidi-isolate {
unicode-bidi: isolate;
}
.unicode-bidi-isolate-override {
unicode-bidi: isolate-override;
}
</style>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think typically in other accessibility layout tests, we don't indent things in the <head>.

@twilco
Copy link
Contributor

twilco commented Jun 16, 2025

Your commit message (and PR description) needs to follow a very specific format, or else it will get rejected by the commit queue:

<bugs.webkit.org bug title>
<bugs.webkit.org link>
<radar link>

Reviewed by NOBODY (OOPS!).

<Description of the change>


PASS: rangeLength === 28
PASS: maxBounds === 188
PASS: currentBounds > lastBounds === true
Copy link
Contributor

Choose a reason for hiding this comment

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

To better catch failures down the line, I wonder if each pass should print which character is being evaluated, in addition to whether this condition passes?

Copy link
Contributor

Choose a reason for hiding this comment

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

Even better, how about just count the number of characters going each direction.

I'd like something along the lines of:

PASS: characters 0...20 are LTR
PASS: characters 20...26 are RTL
etc.

This test verifies that a combination of Arabic and English is read correctly by Accessibility, when using CSS unicode-bidi property.

PASS: rangeLength === 28
PASS: maxBounds === 188
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe delete this line. It looks like it's failing on the bots because we don't get exactly the same number of pixels with and without ITM.

@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 412b05d to 4a93a5a Compare June 27, 2025 03:49
@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 4a93a5a to 8625023 Compare June 27, 2025 03:56
@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 8625023 to 1d6fda0 Compare June 27, 2025 04:17
@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 1d6fda0 to 34e6ce6 Compare June 27, 2025 10:02
@gr3g-apple-com gr3g-apple-com changed the title add tests for bidi text: english-arabic and english-hebrew AX: Add tests for RTL/LTR bidi text Jun 27, 2025
@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 34e6ce6 to 939c13f Compare June 27, 2025 10:36
@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 939c13f to 540df70 Compare June 27, 2025 10:40
@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 540df70 to 47dbfb7 Compare June 27, 2025 14:37
@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 47dbfb7 to f6d2cd5 Compare June 27, 2025 17:11
@twilco twilco added merge-queue Applied to send a pull request to merge-queue Accessibility For bugs related to accessibility. and removed merging-blocked Applied to prevent a change from being merged labels Jun 27, 2025
@webkit-commit-queue
Copy link
Collaborator

Commit message contains (OOPS!), blocking PR #46728. Details: Build #23436

@webkit-commit-queue webkit-commit-queue added merging-blocked Applied to prevent a change from being merged and removed merge-queue Applied to send a pull request to merge-queue labels Jun 27, 2025
@gr3g-apple-com gr3g-apple-com force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from f6d2cd5 to 199a68d Compare June 27, 2025 22:12
@twilco twilco added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Jun 28, 2025
https://bugs.webkit.org/show_bug.cgi?id=294460
rdar://153327595

Reviewed by Tyler Wilcock.

Add tests for bidi text: English-Arabic and English-Hebrew. This test
counts the number of LTR and RTL positions within strings based on
textmarkers. There are six strings tested, each with a unique value
applied to its unicode-bidi css property.

* LayoutTests/accessibility/text-marker/text-marker-bidi-element-arabic-expected.txt: Added.
* LayoutTests/accessibility/text-marker/text-marker-bidi-element-arabic.html: Added.
* LayoutTests/accessibility/text-marker/text-marker-bidi-element-hebrew-expected.txt: Added.
* LayoutTests/accessibility/text-marker/text-marker-bidi-element-hebrew.html: Added.
* LayoutTests/platform/ios/TestExpectations:

Canonical link: https://commits.webkit.org/296764@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/AX-Add-tests-for-RTL-LTR-bidi-text branch from 199a68d to c275e78 Compare June 28, 2025 02:16
@webkit-commit-queue
Copy link
Collaborator

Committed 296764@main (c275e78): https://commits.webkit.org/296764@main

Reviewed commits have been landed. Closing PR #46728 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit c275e78 into WebKit:main Jun 28, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility For bugs related to accessibility.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants