[cupertino_ui] Migrate segmented_control_test.dart to SemanticsHandle#11982
Conversation
There was a problem hiding this comment.
Code Review
This pull request unskips the segmented control test file and refactors the semantics test to use SemanticsHandle and individual semantics assertions instead of SemanticsTester. The reviewer identified that find.semantics is not a valid property on CommonFinders and recommended using find.bySemanticsLabel instead for the assertions.
| ignoreId: true, | ||
| ignoreRect: true, | ||
| ignoreTransform: true, | ||
| find.semantics.byLabel('Child 1'), |
There was a problem hiding this comment.
find.semantics does exist.
|
|
||
| // Assert Child 2 (unselected) | ||
| expect( | ||
| find.semantics.byLabel('Child 2'), |
There was a problem hiding this comment.
find.semantics does exist.
| ignoreId: true, | ||
| ignoreRect: true, | ||
| ignoreTransform: true, | ||
| find.semantics.byLabel('Child 1'), |
There was a problem hiding this comment.
find.semantics does exist.
|
|
||
| // Assert Child 2 (now selected and focused) | ||
| expect( | ||
| find.semantics.byLabel('Child 2'), |
There was a problem hiding this comment.
find.semantics does exist.
segmented_control_test.dart to SemanticsHandlesegmented_control_test.dart to SemanticsHandle
justinmc
left a comment
There was a problem hiding this comment.
LGTM minus ensureSemantics 👍
|
|
||
| testWidgets('Segmented control semantics', (WidgetTester tester) async { | ||
| final semantics = SemanticsTester(tester); | ||
| final SemanticsHandle handle = tester.ensureSemantics(); |
There was a problem hiding this comment.
ensureSemantics is not needed.
Part of flutter/flutter#182636 and flutter/flutter#188395
This PR:
widgets/semantics_tester.dart. ReplacedSemanticsTesterwithSemanticsHandle.@Skipannotation, all tests in this file has passed.semantics_tester.darthas existed incupertino_ui, so we can directly importsemantics_tester.dart;test/folder.Pre-Review Checklist
[shared_preferences]///).