Skip to content

Add regression tests for WidgetSpan ordering in bidirectional text - #193894

Closed
molchanovia wants to merge 1 commit into
flutter:masterfrom
molchanovia:fix/widgetspan-rtl-54400
Closed

molchanovia wants to merge 1 commit into
flutter:masterfrom
molchanovia:fix/widgetspan-rtl-54400

Conversation

@molchanovia

@molchanovia molchanovia commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Adds regression coverage for the Skia placeholder ordering fix associated
with #54400.

The tests verify that bidi reordering preserves the correspondence between
each WidgetSpan and its logical placeholder, selection box, and hit target.

Coverage includes:

  • Mixed Latin, Cyrillic, Hebrew, and Arabic text in LTR and RTL paragraphs.
  • Single-line and multiline layouts, soft wrapping, and explicit line breaks.
  • Nested spans, opposite-direction embeddings, and changes to paragraph direction.
  • Different placeholder sizes, alignments, and visibility after truncation.

Related to #54400.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine related. See also e: labels. labels Oct 6, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds comprehensive tests to verify that logical placeholder and WidgetSpan order is preserved during bidirectional text layout, reflow, and direction changes. The feedback suggests removing redundant type annotations in loop variables across several test files to leverage Dart's type inference. Additionally, it recommends rounding vertical coordinates to integers when grouping lines by their top position to avoid fragile floating-point comparisons.

Cover mixed Latin, Cyrillic, Hebrew, and Arabic text in LTR and RTL
paragraphs, including nested spans, direction changes, soft wrapping,
and explicit line breaks.

Verify visual ordering, logical placeholder identity, selection geometry,
text hit testing, and widget tap targets.

Related to flutter#54400.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@molchanovia
molchanovia force-pushed the fix/widgetspan-rtl-54400 branch from 2085166 to 8af4f0a Compare October 6, 2026 21:11
@LongCatIsLooong

Copy link
Copy Markdown
Contributor

Thanks for adding these tests, but from the looks of it, the fix is on skia side so I think the tests should live there an run on their CI?

@justinmc justinmc added the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 8, 2026
@molchanovia

Copy link
Copy Markdown
Contributor Author

Thanks for adding these tests, but from the looks of it, the fix is on skia side so I think the tests should live there an run on their CI?

@LongCatIsLooong
Yes, I thought about that too. I also added tests on the Skia side.

I was simply planning to close the relevant issue, and I decided to add the tests as proof of the work done.

If you think the tests are sufficient, let's just close this PR and the issue.

@github-actions github-actions Bot removed the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 8, 2026
@molchanovia
molchanovia deleted the fix/widgetspan-rtl-54400 branch October 23, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems engine flutter/engine related. See also e: labels. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants