Skip to content

Add unit test for TextLayoutManager desired width optimization - #59202

Open
Abbondanzo wants to merge 1 commit into
react:mainfrom
Abbondanzo:export-D125868474
Open

Abbondanzo wants to merge 1 commit into
react:mainfrom
Abbondanzo:export-D125868474

Conversation

@Abbondanzo

Copy link
Copy Markdown
Contributor

Summary:
Add a Robolectric test that verifies Layout.getDesiredWidth is only called when necessary during text layout.

The test confirms the optimization that avoids expensive width measurements for EXACTLY mode and for AT_MOST mode when boring text doesn't fit. It uses mockStatic to intercept calls to Layout.getDesiredWidth and verifies the correct number of invocations across different measure modes.

Changelog: [Internal]

Differential Revision: D125868474

Summary:
Add a Robolectric test that verifies `Layout.getDesiredWidth` is only called when necessary during text layout.

The test confirms the optimization that avoids expensive width measurements for `EXACTLY` mode and for `AT_MOST` mode when boring text doesn't fit. It uses `mockStatic` to intercept calls to `Layout.getDesiredWidth` and verifies the correct number of invocations across different measure modes.

Changelog: [Internal]

Differential Revision: D125868474
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 19, 2026
@meta-codesync

meta-codesync Bot commented Oct 19, 2026

Copy link
Copy Markdown

@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D125868474.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant