Skip to content

[material_ui] Update material_ui tests to prevent them from failing when framework TextStyle changes - #12728

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
LongCatIsLooong:material-ui-textstyle-canary
Sep 21, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:mainfrom
LongCatIsLooong:material-ui-textstyle-canary

Conversation

@LongCatIsLooong

@LongCatIsLooong LongCatIsLooong commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

The mechanism was introduced in flutter/flutter#12552 as a means to notify TextTheme maintainers when new fields are added toTextStyle. In the past since they both live in the flutter/flutter repo, they can and should be updated in the same PR. But now that TextStyle lives in an upstream repo, this test would make any new feature from being added to TextStyle a breaking change, which is very undesirable.

Making the change would mean material_ui maintainers won't be notified via failing tests when the upstream TextStyle gets a new field on master (If I understand correctly, material_ui is analyzed/tested against flutter/flutter's master branch). But that's already the case for any other new features added to the framework.

This is for flutter/flutter#185152.
Previous attempt: #12158.

Pre-Review Checklist

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

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.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 2, 2026
@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Sep 2, 2026
@QuncCccccc QuncCccccc changed the title Update material_ui tests to prevent them from failing form framework TextStyle class changes [material_ui] Update material_ui tests to prevent them from failing when framework TextStyle changes Sep 20, 2026

@QuncCccccc QuncCccccc 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.

LGTM! Thanks for helping decouple the tests.

(If I understand correctly, material_ui is analyzed/tested against flutter/flutter's master branch)

I think flutter/packages is tested against both master and stable channels:)

@LongCatIsLooong

Copy link
Copy Markdown
Contributor Author

LGTM! Thanks for helping decouple the tests.

(If I understand correctly, material_ui is analyzed/tested against flutter/flutter's master branch)

I think flutter/packages is tested against both master and stable channels:)

Yeah I'm a bit concerned that testing against master is going to make it difficult to introduce new features to some APIs (like TextStyle.getParagraphStyle). But that's a separate topic, thanks for reviewing the PR!

@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 21, 2026
@auto-submit
auto-submit Bot merged commit 0da483d into flutter:main Sep 21, 2026
12 checks passed
@LongCatIsLooong
LongCatIsLooong deleted the material-ui-textstyle-canary branch September 21, 2026 23:57
pull Bot pushed a commit to edisplay/flutter that referenced this pull request Sep 24, 2026
…er#193289)

Roll Packages from c2b58e1a97fb to 431ea69a42e2 (56 revisions)

flutter/packages@c2b58e1...431ea69

2026-09-24 [email protected] [cross_file]
Updates cross_file to a package separated federated plugin
(flutter/packages#11010)
2026-09-23 [email protected] [material_ui]
Remove static access of `copyWith` from `dart fix` golden tests for
`ThemeData/TextTheme` (flutter/packages#12994)
2026-09-23 [email protected] [camera_avfoundation] Replace
deprecated high-resolution capture APIs (flutter/packages#12372)
2026-09-23 [email protected] [pigeon] update nullish checks to use
new isNullish method (flutter/packages#12985)
2026-09-23 [email protected] [ci] Assign batch release PR approver
as reviewer on sync-back PR (flutter/packages#12976)
2026-09-23 [email protected] [image_picker] Fix scaling 10-bit images
(flutter/packages#12557)
2026-09-23 [email protected] [material_ui] Improve
Autocomplete, DrawerHeader, and Tooltip accessibility
(flutter/packages#12918)
2026-09-23 [email protected] [google_fonts] Decouple GoogleFontsLite
for full tree-shaking and add full feature parity
(flutter/packages#12830)
2026-09-23 [email protected] [file_selector]
Ignore flakey `file_selector_android` tests (flutter/packages#12992)
2026-09-23 [email protected] [CI] Remove
bringup from `Mac_arm64 build_all_packages` targets
(flutter/packages#12978)
2026-09-22 [email protected] [material_ui]
Unskip 5 passing web tests in bottom_app_bar_test and text_field_test
(flutter/packages#12983)
2026-09-22 [email protected]
[cupertino_ui] Unskip 5 passing web tests in
adaptive_text_selection_toolbar_test and text_field_test
(flutter/packages#12984)
2026-09-22 [email protected] [go_router] Fix ShellRoute chrome dropped
from semantics tree by ModalBarrier (flutter/packages#12353)
2026-09-22 [email protected] [material_ui]
Add contrastLevel for M3 ColorScheme (flutter/packages#12743)
2026-09-22 [email protected] [go_router] Preserve nested pushes
during config updates (flutter/packages#12611)
2026-09-22 [email protected] [material_ui]
Migrate M3 Chip template to use new gen_defaults
(flutter/packages#12847)
2026-09-22 [email protected] [material_ui] Fix
LocalHistoryEntry leak when double tapping Drawer scrim
(flutter/packages#12552)
2026-09-22 [email protected] Update suggested reviewers
(flutter/packages#12974)
2026-09-22 [email protected] Sync release-material_ui-1.4.0 to
main (flutter/packages#12966)
2026-09-22 [email protected] Sync release-cupertino_ui-1.1.1 to
main (flutter/packages#12965)
2026-09-21 [email protected] [ci] Update repo
for 3.47 stable release (flutter/packages#12959)
2026-09-21 [email protected] Manual roll Flutter from
27fec0e to 4fcd90b (1 revision) (flutter/packages#12904)
2026-09-21 [email protected] Revert "[go_router_builder] Migrate to
material_ui" (flutter/packages#12962)
2026-09-21 [email protected]
[material_ui] Update `material_ui` tests to prevent them from failing
when framework `TextStyle` changes (flutter/packages#12728)
2026-09-21 [email protected] [go_router_builder] Migrate to
material_ui (flutter/packages#12913)
2026-09-21 [email protected] [material_ui,
cupertino_ui] Bump Flutter version from to 3.47 (flutter/packages#12944)
2026-09-21 [email protected] [cupertino_ui] Work around dart2wasm
optional parameter inference bug in example checkbox tests
(flutter/packages#12961)
2026-09-21 [email protected] [cupertino_ui] Work around dart2wasm
optional parameter inference bug in checkbox_test.dart
(flutter/packages#12956)
2026-09-21 [email protected] [google_sign_in] PR 3/4 Migrate
ViewProvider and GID SDK wrappers from Objective-C to Swift
(flutter/packages#12657)
2026-09-21 [email protected] [google_sign_in] PR 2/4 Migrate
the plugin class from Objective-C to Swift. (flutter/packages#12655)
2026-09-20 [email protected]
[cross_file_darwin] iOS/macOS implementation of `cross_file`
(flutter/packages#12910)
2026-09-20 [email protected]
[cross_file_web] Web implementation of `cross_file`
(flutter/packages#12908)
2026-09-20 [email protected] [material_ui]
Migrate M3 `InputChip` template to use new gen_defaults
(flutter/packages#12850)
2026-09-20 [email protected] [material_ui]
Migrate M3 Checkbox defaults to new gen_defaults
(flutter/packages#12816)
2026-09-20 [email protected] [material_ui]
Migrate M3 `FilterChip` template to use new gen_defaults
(flutter/packages#12849)
2026-09-19 [email protected] [material_ui] Announce PopupMenuButton with a
child as a button (flutter/packages#12585)
2026-09-19 [email protected] Roll Flutter (stable) from
9584c67 to 6a19cca (7 revisions) (flutter/packages#12950)
2026-09-18 [email protected] [material_ui]
Reduce the `material_ui` non-wasm web test suite
(flutter/packages#12763)
2026-09-18 [email protected] Replace
`Mac_x64` builders with `Mac_arm64` ones (flutter/packages#12941)
2026-09-18 [email protected]
[in_app_purchase_storekit] Use `_$SKPaymentDiscountWrapperToJson`
(flutter/packages#12721)
2026-09-18 [email protected] [In_app _purchase] README
excerpt examples and changelog (flutter/packages#12739)
2026-09-18 [email protected] [material_ui] Add alternative
input method for `RangeSlider` in `NavigationMode.directional`
(flutter/packages#12630)
2026-09-18 [email protected]
[cross_file_android] Android implementation of `cross_file`
(flutter/packages#12909)
2026-09-18 [email protected]
[camera_platform_interface] Adds videoOutputPath support to
startVideoRecording (flutter/packages#12667)
2026-09-17 [email protected] [cupertino_ui] Migrate a
snippet in `CupertinoCheckbox`'s API doc to `{@example}` and add unit
tests (flutter/packages#12180)
2026-09-17 [email protected] [material_ui]
Default gen_defaults color helper prefix (flutter/packages#12848)
...
mboetger pushed a commit to mboetger/flutter that referenced this pull request Oct 3, 2026
…5152)

## Summary

Adds visible soft hyphen (U+00AD) rendering at line breaks, with a new
`Hyphens` API to opt out. Fixes flutter#18443 on native
platforms; web rendering is tracked in flutter#193506.

A line break that falls on a soft hyphen now renders a visible `-` by
default. A new `Hyphens { manual, hidden }` enum controls this:

- `Hyphens.manual` (default): render a hyphen at the break.
- `Hyphens.hidden`: don't render the hyphen. The soft hyphen is still a
break opportunity.

`hyphens` is a parameter on `Text` / `RichText`, `TextPainter`,
`RenderParagraph`, `TextStyle.getParagraphStyle` and `dart:ui`'s
`ParagraphStyle`, following `textAlign` / `maxLines`. It is not a
`TextStyle` field. Customizing the hyphen string is deferred to flutter#189617.

Design doc:
[flutter.dev/go/soft-hyphens](https://flutter.dev/go/soft-hyphens)
(tracking issue flutter#185154).

## Background

Flutter already breaks lines at U+00AD but never draws the hyphen, so it
behaves like a zero-width space. This change doesn't add any new break
opportunities or change where lines break, but the rendered hyphen makes
its line wider, so it can change `Paragraph.longestLine` and the size of
text laid out with `TextWidthBasis.longestLine`.

The Skia side landed in
[`98daf58d`](google/skia@98daf58d4c) (Skia CL
[1208837](https://skia-review.googlesource.com/c/skia/+/1208837)),
behind `ParagraphStyle::setRenderSoftHyphens(bool)`, which defaults to
`false` for other Skia clients.

## Changes

**Engine**
- `txt::ParagraphStyle` gains a `render_soft_hyphens` flag (default
`true`), which `ParagraphBuilderSkia::TxtToSkia` forwards to
`setRenderSoftHyphens`. The Impeller interop toolkit builds
`txt::ParagraphStyle` too, so it also gets the new default.
- `paragraph_builder.cc` decodes `ParagraphStyle.hyphens` from the FFI
buffer (mask bit 13, slot 7).
- `dart:ui` adds the public `Hyphens` enum and `ParagraphStyle.hyphens`.
The web `dart:ui` accepts and stores the value; web rendering is
flutter#193506.

**Framework**
- `Hyphens` is re-exported from `dart:ui` via
`painting/basic_types.dart`.
- `hyphens` is threaded through `TextStyle.getParagraphStyle` →
`TextPainter` → `RenderParagraph` → `RichText` → `Text` / `Text.rich`,
including the selectable-text path.

## Breaking change

- **API:** adding `hyphens` to `TextStyle.getParagraphStyle` breaks
classes that override it. In practice that's test doubles like the
`_TextStyleProxy` in `test/material/theme_test.dart`, updated here;
material_ui's copy was removed in flutter/packages#12728. The fix is to
add `Hyphens? hyphens` to the override. Migration guide:
flutter/website#13945.
- **Rendering:** text containing U+00AD now shows a hyphen at
soft-hyphen line breaks by default. `Hyphens.hidden` restores the old
look.

## Known limitations

- The hyphen is appended after line breaking, so a line can exceed
`maxWidth` by the hyphen's advance.
- The rendered hyphen isn't included in selection highlight rects
(flutter#189234).
- `EditableText` (and so `TextField`) and `SelectableText` don't take a
`hyphens` parameter yet, so they always render the hyphen.
- Skia also draws the hyphen when a line ends in U+00AD without breaking
there (text ending in U+00AD, or U+00AD right before a space or
newline). The Skia fix is in review ([CL
1378356](https://skia-review.googlesource.com/c/skia/+/1378356)) and
will come in with a Skia roll once it lands.

## Test plan

- [ ] `paragraph_builder_skia_tests.cc::RenderSoftHyphensEnabled`:
`render_soft_hyphens` maps onto Skia in both states
- [ ] `testing/dart/text_test.dart`: `ParagraphStyle.hyphens` encodes
and round-trips in `toString`
- [ ] `testing/dart/paragraph_test.dart`: `ParagraphStyle.hyphens`
reaches the text layout (a line that breaks at a soft hyphen is wider
with `manual` than with `hidden`, and unset matches `manual`), which
covers decoding the setting in the engine
- [ ] `test/widgets/rich_text_test.dart`: `RichText` exposes `hyphens`
via `debugFillProperties`
- [ ] `test/widgets/text_test.dart`: `Text` forwards `hyphens` to
`RenderParagraph` (incl. selectable path); default resolves to
`Hyphens.manual`
- [ ] `test/rendering/paragraph_test.dart`: `RenderParagraph.hyphens`
setter triggers relayout
- [ ] `test/painting/text_painter_test.dart`: `TextPainter.hyphens`
setter; the same width check through `TextPainter`, and changing
`hyphens` after layout changes the width
- [ ] Google internal testing
- [ ] Manual smoke: `Text('inter\u00ADnational')` in a narrow container
shows `inter-` / `national`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants