Skip to content

[material_ui] Fix self-comparison and assert bugs in semantics_tester - #12722

Merged
auto-submit[bot] merged 6 commits into
flutter:mainfrom
Sanaullah49:material-ui-semantics-tester-fixes
Oct 14, 2026
Merged

auto-submit[bot] merged 6 commits into
flutter:mainfrom
Sanaullah49:material-ui-semantics-tester-fixes

Conversation

@Sanaullah49

Copy link
Copy Markdown
Contributor

packages/material_ui/test/semantics_tester.dart carries four bugs that make parts of the helper silently ineffective:

  • controlsNodes != controlsNodes compares the field to itself, so the setEquals check is unreachable and the controlsNodes expectation never runs
  • the locale comparison reads second[i] on both sides instead of first[i], so mismatched locales compare equal
  • the minValue/maxValue checks sit in assert()'s message slot rather than its condition, so they gate nothing
  • attributedLabel, attributedValue, attributedHint and hint were missing from that assert's condition, so passing any one of them alone tripped it

Adds packages/material_ui/test/semantics_tester_test.dart covering each fix. There was no test file for this helper previously.

Context

Ported from flutter/flutter#192164, which cannot land there because packages/flutter/test/material is frozen (flutter/flutter#188444). The same four fixes landed for the widgets copy of this helper in flutter/flutter#191938.

Testing

flutter test test/semantics_tester_test.dart in packages/material_ui passes 4/4, and dart analyze is clean, against Flutter 3.47.2.

Changelog uses ## NEXT since this is test-only and does not affect the published package.

The test helper carried four bugs that made parts of it silently
ineffective:

- `controlsNodes != controlsNodes` compares the field to itself, so the
  setEquals check is unreachable and the expectation never runs
- the locale comparison reads `second[i]` on both sides instead of
  `first[i]`, so mismatched locales compare equal
- the `minValue`/`maxValue` checks sit in assert()'s message slot rather
  than its condition, so they gate nothing
- `attributedLabel`, `attributedValue`, `attributedHint` and `hint` were
  missing from that assert's condition, so passing any one alone tripped it

Adds a test file covering each fix. Ported from flutter/flutter#192164,
which cannot land there because packages/flutter/test/material is frozen.
The same fixes landed for the widgets copy in flutter/flutter#191938.

@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 addresses several bugs in the semantics_tester test helper, correcting self-comparison logic for controlsNodes and LocaleStringAttribute.locale, and expanding the assertion in _IncludesNodeWith to check for newly supported fields. Feedback suggests also including textDirection in the _IncludesNodeWith assertion to prevent incorrect failures when it is the only parameter specified.

nodesWith filters on textDirection like any other field, so
includesNodeWith(textDirection: ...) on its own is a valid single-property
matcher, but the assert rejected it. Adds it to the condition and the
message, with a regression test.
@QuncCccccc

Copy link
Copy Markdown
Contributor

Hello, thanks a lot for your contribution! Could you help fixing the conflict. To update changelog entry, please check here flutter/flutter#188444:)!

Resolve CHANGELOG.md conflict by dropping the direct ## NEXT edit and
adding a pending_changelogs entry instead.
@Sanaullah49

Copy link
Copy Markdown
Contributor Author

Thanks — resolved the conflict against main and moved the changelog entry to packages/material_ui/pending_changelogs/ (version: skip since this is a test-helper-only change).

@QuncCccccc

Copy link
Copy Markdown
Contributor

Ah since this fix is only related to tests, so we don't need to add a changelog entry. Sorry for any confusion I caused!

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

Thanks a lot for your contribution! LGTM once we remove the changelog entry!

@QuncCccccc
QuncCccccc requested a review from chunhtai September 10, 2026 22:13
@QuncCccccc

Copy link
Copy Markdown
Contributor

Added @chunhtai for a second review since this fix is mostly identical with flutter/flutter#191938:)

@QuncCccccc QuncCccccc added the CICD Run CI/CD label Sep 10, 2026

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

also LGTM when the change log entry is removed

Reviewers confirmed no changelog entry is needed since this change only
affects the semantics_tester test helper.
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Sep 11, 2026
@Sanaullah49

Copy link
Copy Markdown
Contributor Author

Removed the pending changelog entry.

@QuncCccccc QuncCccccc added the CICD Run CI/CD label Sep 11, 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.

There seems are some formatting issues that failed Dashboard Checks. Could you help fix them:)

@Sanaullah49

Copy link
Copy Markdown
Contributor Author

Fixed the formatting issue in semantics_tester_test.dart.

@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Oct 6, 2026
@QuncCccccc QuncCccccc added autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD labels Oct 6, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 6, 2026
@auto-submit

auto-submit Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/12722, because - The status or check suite ci.yaml validation has failed. Please fix the issues identified (or deflake) before re-applying this label.

@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Oct 14, 2026
@QuncCccccc QuncCccccc added the CICD Run CI/CD label Oct 14, 2026
@QuncCccccc QuncCccccc added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 14, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 14, 2026
@auto-submit

auto-submit Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/12722, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@QuncCccccc QuncCccccc added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 14, 2026
@auto-submit
auto-submit Bot merged commit 36d0427 into flutter:main Oct 14, 2026
13 checks passed
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-flutter__flutter that referenced this pull request Oct 15, 2026
Roll Packages from a1ed23c to da40eaf (33 revisions)

flutter/packages@a1ed23c...da40eaf

2026-10-15 [email protected] [pigeon]add support for sealed classes
in native interop (flutter/packages#13175)
2026-10-15 [email protected] [pigeon] Replace full JNI bindings with
stubs for API classes that aren't needed (flutter/packages#13173)
2026-10-14 [email protected] [material_ui] Fix
self-comparison and assert bugs in semantics_tester
(flutter/packages#12722)
2026-10-14 [email protected] [camera_avfoundation] Replace the
deprecated 'videoOrientation' with 'videoRotationAngle' on iOS 17+
(flutter/packages#13247)
2026-10-14 [email protected] [material_ui] Fix GridTile crash when the
incoming constraints are unbounded (flutter/packages#12586)
2026-10-14 [email protected] [in_app_purchase_storekit] Remove unused
and deprecated "SKDownload" hosted content (flutter/packages#13222)
2026-10-14 [email protected]
[material_ui] Add supportingTextPadding to InputDecorator
(flutter/packages#12769)
2026-10-14 [email protected]
[vector_graphics_codec] Add support for encoding and decoding paint blur
commands (flutter/packages#13148)
2026-10-14 [email protected] [go_router] Fix redirect zone async error
handling (flutter/packages#12836)
2026-10-14 [email protected] Sync release-go_router-18.1.0 to
main (flutter/packages#13260)
2026-10-14 [email protected] Sync release-cupertino_ui-1.1.3 to
main (flutter/packages#13258)
2026-10-14 [email protected] [material_ui] add enableInlinePrediction
parameter to TextFormField (flutter/packages#12793)
2026-10-14 [email protected] Sync release-material_ui-1.7.0 to
main (flutter/packages#13259)
2026-10-14 [email protected] [material_ui] Add the
Material shapes. (flutter/packages#12771)
2026-10-14 [email protected] [material_ui]
Add tertiary tap callbacks to InkResponse and InkWell
(flutter/packages#12676)
2026-10-14 [email protected] Roll Flutter from
4249ccb to 426be96 (44 revisions) (flutter/packages#13256)
2026-10-14 [email protected] [material_ui]
fixes expanded state in the a11y_assessment home page dropdown
(flutter/packages#13219)
2026-10-14 [email protected] [VPAT] Fix semantics in
a11y_assessments drawer, radio, and rail demos (flutter/packages#13159)
2026-10-14 [email protected]
[google_maps_flutter] Add onPointOfInterestTap (flutter/packages#11872)
2026-10-14 [email protected] [go_router] Fix shell route key collisions
and dynamic branch updates (flutter/packages#12549)
2026-10-14 [email protected] Manual roll Flutter from
d03768e to 4249ccb (158 revisions) (flutter/packages#13220)
2026-10-14 [email protected] [image_picker_ios] Require Flutter
3.47 / iOS 15 and drop deprecated kUTType code paths
(flutter/packages#13224)
2026-10-13 [email protected] [in_app_purchase_storekit] Fixes
Storekit 2 flaky tests (flutter/packages#13213)
2026-10-13 [email protected] [local_auth] Convert Android to new
Pigeon suspend support (flutter/packages#12894)
2026-10-13 [email protected] [material_ui] Add
enabled parameter to DropdownButtonFormField (flutter/packages#12610)
2026-10-13 [email protected] [go_router] Link ShellRoute docs to
StatefulShellRoute (flutter/packages#13120)
2026-10-13 [email protected] FadeForwards page transition
performance (flutter/packages#13161)
2026-10-13 [email protected]
[in_app_purchase_android] Guard async billing callbacks against
duplicate listener responses (flutter/packages#12640)
2026-10-13 [email protected] [google_sign_in] Remove the
Objective-C exception catcher (flutter/packages#13156)
2026-10-13 [email protected] [camera_avfoundation] Remove availability
checks below the package minimum iOS 13 (flutter/packages#13214)
2026-10-13 [email protected] [google_maps_flutter_ios] Remove iOS 14
availability check from example UI tests (flutter/packages#13218)
2026-10-13 [email protected] [google_sign_in] Convert
implementation to Kotlin (flutter/packages#13005)
2026-10-13 [email protected] [image_picker_ios] PR 2/5 Add a
PHImageManager image-data seam and migrate plugin native tests to Swift
Testing (flutter/packages#13079)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
Roll Packages from a1ed23c to da40eaf (33 revisions)

flutter/packages@a1ed23c...da40eaf

2026-10-15 [email protected] [pigeon]add support for sealed classes
in native interop (flutter/packages#13175)
2026-10-15 [email protected] [pigeon] Replace full JNI bindings with
stubs for API classes that aren't needed (flutter/packages#13173)
2026-10-14 [email protected] [material_ui] Fix
self-comparison and assert bugs in semantics_tester
(flutter/packages#12722)
2026-10-14 [email protected] [camera_avfoundation] Replace the
deprecated 'videoOrientation' with 'videoRotationAngle' on iOS 17+
(flutter/packages#13247)
2026-10-14 [email protected] [material_ui] Fix GridTile crash when the
incoming constraints are unbounded (flutter/packages#12586)
2026-10-14 [email protected] [in_app_purchase_storekit] Remove unused
and deprecated "SKDownload" hosted content (flutter/packages#13222)
2026-10-14 [email protected]
[material_ui] Add supportingTextPadding to InputDecorator
(flutter/packages#12769)
2026-10-14 [email protected]
[vector_graphics_codec] Add support for encoding and decoding paint blur
commands (flutter/packages#13148)
2026-10-14 [email protected] [go_router] Fix redirect zone async error
handling (flutter/packages#12836)
2026-10-14 [email protected] Sync release-go_router-18.1.0 to
main (flutter/packages#13260)
2026-10-14 [email protected] Sync release-cupertino_ui-1.1.3 to
main (flutter/packages#13258)
2026-10-14 [email protected] [material_ui] add enableInlinePrediction
parameter to TextFormField (flutter/packages#12793)
2026-10-14 [email protected] Sync release-material_ui-1.7.0 to
main (flutter/packages#13259)
2026-10-14 [email protected] [material_ui] Add the
Material shapes. (flutter/packages#12771)
2026-10-14 [email protected] [material_ui]
Add tertiary tap callbacks to InkResponse and InkWell
(flutter/packages#12676)
2026-10-14 [email protected] Roll Flutter from
4249ccb to 426be96 (44 revisions) (flutter/packages#13256)
2026-10-14 [email protected] [material_ui]
fixes expanded state in the a11y_assessment home page dropdown
(flutter/packages#13219)
2026-10-14 [email protected] [VPAT] Fix semantics in
a11y_assessments drawer, radio, and rail demos (flutter/packages#13159)
2026-10-14 [email protected]
[google_maps_flutter] Add onPointOfInterestTap (flutter/packages#11872)
2026-10-14 [email protected] [go_router] Fix shell route key collisions
and dynamic branch updates (flutter/packages#12549)
2026-10-14 [email protected] Manual roll Flutter from
d03768e to 4249ccb (158 revisions) (flutter/packages#13220)
2026-10-14 [email protected] [image_picker_ios] Require Flutter
3.47 / iOS 15 and drop deprecated kUTType code paths
(flutter/packages#13224)
2026-10-13 [email protected] [in_app_purchase_storekit] Fixes
Storekit 2 flaky tests (flutter/packages#13213)
2026-10-13 [email protected] [local_auth] Convert Android to new
Pigeon suspend support (flutter/packages#12894)
2026-10-13 [email protected] [material_ui] Add
enabled parameter to DropdownButtonFormField (flutter/packages#12610)
2026-10-13 [email protected] [go_router] Link ShellRoute docs to
StatefulShellRoute (flutter/packages#13120)
2026-10-13 [email protected] FadeForwards page transition
performance (flutter/packages#13161)
2026-10-13 [email protected]
[in_app_purchase_android] Guard async billing callbacks against
duplicate listener responses (flutter/packages#12640)
2026-10-13 [email protected] [google_sign_in] Remove the
Objective-C exception catcher (flutter/packages#13156)
2026-10-13 [email protected] [camera_avfoundation] Remove availability
checks below the package minimum iOS 13 (flutter/packages#13214)
2026-10-13 [email protected] [google_maps_flutter_ios] Remove iOS 14
availability check from example UI tests (flutter/packages#13218)
2026-10-13 [email protected] [google_sign_in] Convert
implementation to Kotlin (flutter/packages#13005)
2026-10-13 [email protected] [image_picker_ios] PR 2/5 Add a
PHImageManager image-data seam and migrate plugin native tests to Swift
Testing (flutter/packages#13079)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
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.

3 participants