Skip to content

fix(TextBlock): when measuring, always return text size even if bigger than available size on WASM #20442

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ramezgerges
Copy link
Contributor

GitHub Issue (If applicable): closes https://github.com/unoplatform/kahua-private/issues/289

PR Type

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

@github-actions github-actions bot added the platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform label May 16, 2025
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20442/docs/index.html

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-20442/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

⚠️⚠️ The build 165971 has failed on Uno.UI - CI.

@jeromelaban jeromelaban marked this pull request as draft May 20, 2025 13:24
@jeromelaban jeromelaban requested a review from Copilot May 20, 2025 13:24
@jeromelaban
Copy link
Member

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that on WASM the TextBlock measurement always reflects its full text size, and adds a UI test to verify overflow behavior.

  • Unbounds height (and width when no-wrap) in MeasureOverride for WASM to return actual text size.
  • Adds When_Text_Does_Not_Fit test to verify horizontal scrolling when text exceeds bounds.
  • Imports Uno.UI.Extensions in tests for helper methods.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Uno.UI/UI/Xaml/Controls/TextBlock/TextBlock.wasm.cs Adjust measure logic to unbound height and conditional width for no-wrap
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_TextBlock.cs Added new overflow test and required namespace import
Comments suppressed due to low confidence (1)

src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_TextBlock.cs:814

  • [nitpick] The variable name lv is ambiguous. Consider renaming it to listView to improve readability and clarity.
var lv = new ListView()

@ramezgerges ramezgerges marked this pull request as ready for review May 20, 2025 15:39
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20442/docs/index.html

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-20442/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

⚠️⚠️ The build 166194 has failed on Uno.UI - CI.

@jeromelaban
Copy link
Member

@jeromelaban jeromelaban marked this pull request as draft May 21, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants