Repository navigation
Description
There are several blatant bugs in TestSemantics that we should fix:
1. Comparison of locales
This line in TestSemantics is useless; it compares a value to itself:
flutter/packages/flutter/test/widgets/semantics_tester.dart
Lines 718 to 719 in 03e6adf
| (second[i] as LocaleStringAttribute).locale != | |
| (second[i] as LocaleStringAttribute).locale)) { |
Instead, it should compare with (first[i] as LocaleStringAttribute).locale.
2. Comparison of controlNodes
Another instance of comparing something to itself:
| if (controlsNodes != controlsNodes && !setEquals(controlsNodes, node.controlsNodes)) { |
3. Random comma in an assert
This comma appears to be a typo. It puts part of the logic into the error message field 🤔 .
flutter/packages/flutter/test/widgets/semantics_tester.dart
Lines 1183 to 1185 in 03e6adf
| inputType != null, | |
| minValue != null || maxValue != null, | |
| ); |
These bugs may exist in several places. For example, PR #185736 is copying TestSemantics into the Material library. We should search for all instances of TestSemantics and fix it everywhere.
Activity
[-]TestSemantics locale comparison bug[/-][+]TestSemantics typo bugs[/+]saurabh-mirajkar commentedon May 4, 2026
@justinmc Thanks for the report. Labelling for
team-frameworkto investigate further.fix: correct TestSemantics comparison bugs
justinmc commentedon May 4, 2026
Currently @harshyadavDeveloper is working on this in #185921.
Fix TestSemantics typo bugs in widgets/semantics_tester.dart
Fix TestSemantics typo bugs in widgets/semantics_tester.dart
Fix TestSemantics typo bugs in widgets and material semantics_tester
Piinks commentedon May 20, 2026
Note to agents: Do not fix this issue if there is already an open pull request that will fix it.
Note to agent handlers: Please do not file PRs for issues that are already being worked on! 🙂
Fix TestSemantics typo bugs (self-comparisons and stray assert comma)
Fix TestSemantics typo bugs (self-comparisons and stray assert comma)
Fix self-comparison and assert typos in TestSemantics
Fix self-comparison and assert typos in TestSemantics
Fix TestSemantics typo bugs (self-comparisons and stray assert comma)
Fix TestSemantics typo bugs (self-comparisons and stray assert comma)