[cupertino_ui] Migrate picker_test.dart to SemanticsHandle#12008
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the skip annotation from picker_test.dart and refactors the semantics tests to use SemanticsHandle and tester.getSemantics instead of SemanticsTester. The review feedback suggests replacing the use of private class name strings (_CupertinoPickerSemantics) in widget predicates with a cleaner search for the public ListWheelScrollView widget.
| tester.getSemantics( | ||
| find.byWidgetPredicate( | ||
| (Widget widget) => widget.runtimeType.toString() == '_CupertinoPickerSemantics', | ||
| ), | ||
| ), |
There was a problem hiding this comment.
Instead of finding the private _CupertinoPickerSemantics widget by matching its runtimeType.toString(), we can find the public ListWheelScrollView widget. Since ListWheelScrollView is a direct descendant of _CupertinoPickerSemantics, tester.getSemantics will automatically walk up the tree and return the semantics node of _CupertinoPickerSemantics (which is the nearest ancestor semantics boundary). This is cleaner, more robust, and avoids relying on private class name strings.
| tester.getSemantics( | |
| find.byWidgetPredicate( | |
| (Widget widget) => widget.runtimeType.toString() == '_CupertinoPickerSemantics', | |
| ), | |
| ), | |
| tester.getSemantics(find.byType(ListWheelScrollView)), |
There was a problem hiding this comment.
Tried the suggestion but it does not work, tester.getSemantics(find.byType(ListWheelScrollView) does not return the node of _CupertinoPickerSemantics (ancestor).
| tester.getSemantics( | ||
| find.byWidgetPredicate( | ||
| (Widget widget) => widget.runtimeType.toString() == '_CupertinoPickerSemantics', | ||
| ), | ||
| ), |
There was a problem hiding this comment.
Instead of finding the private _CupertinoPickerSemantics widget by matching its runtimeType.toString(), we can find the public ListWheelScrollView widget. Since ListWheelScrollView is a direct descendant of _CupertinoPickerSemantics, tester.getSemantics will automatically walk up the tree and return the semantics node of _CupertinoPickerSemantics (which is the nearest ancestor semantics boundary). This is cleaner, more robust, and avoids relying on private class name strings.
| tester.getSemantics( | |
| find.byWidgetPredicate( | |
| (Widget widget) => widget.runtimeType.toString() == '_CupertinoPickerSemantics', | |
| ), | |
| ), | |
| tester.getSemantics(find.byType(ListWheelScrollView)), |
| tester.getSemantics( | ||
| find.byWidgetPredicate( | ||
| (Widget widget) => widget.runtimeType.toString() == '_CupertinoPickerSemantics', | ||
| ), | ||
| ), |
There was a problem hiding this comment.
Instead of finding the private _CupertinoPickerSemantics widget by matching its runtimeType.toString(), we can find the public ListWheelScrollView widget. Since ListWheelScrollView is a direct descendant of _CupertinoPickerSemantics, tester.getSemantics will automatically walk up the tree and return the semantics node of _CupertinoPickerSemantics (which is the nearest ancestor semantics boundary). This is cleaner, more robust, and avoids relying on private class name strings.
| tester.getSemantics( | |
| find.byWidgetPredicate( | |
| (Widget widget) => widget.runtimeType.toString() == '_CupertinoPickerSemantics', | |
| ), | |
| ), | |
| tester.getSemantics(find.byType(ListWheelScrollView)), |
| tester.getSemantics( | ||
| find.byWidgetPredicate( | ||
| (Widget widget) => widget.runtimeType.toString() == '_CupertinoPickerSemantics', | ||
| ), | ||
| ), |
There was a problem hiding this comment.
Instead of finding the private _CupertinoPickerSemantics widget by matching its runtimeType.toString(), we can find the public ListWheelScrollView widget. Since ListWheelScrollView is a direct descendant of _CupertinoPickerSemantics, tester.getSemantics will automatically walk up the tree and return the semantics node of _CupertinoPickerSemantics (which is the nearest ancestor semantics boundary). This is cleaner, more robust, and avoids relying on private class name strings.
| tester.getSemantics( | |
| find.byWidgetPredicate( | |
| (Widget widget) => widget.runtimeType.toString() == '_CupertinoPickerSemantics', | |
| ), | |
| ), | |
| tester.getSemantics(find.byType(ListWheelScrollView)), |
| tester.getSemantics( | ||
| find.byWidgetPredicate( | ||
| (Widget widget) => widget.runtimeType.toString() == '_CupertinoPickerSemantics', | ||
| ), | ||
| ), |
There was a problem hiding this comment.
Instead of finding the private _CupertinoPickerSemantics widget by matching its runtimeType.toString(), we can find the public ListWheelScrollView widget. Since ListWheelScrollView is a direct descendant of _CupertinoPickerSemantics, tester.getSemantics will automatically walk up the tree and return the semantics node of _CupertinoPickerSemantics (which is the nearest ancestor semantics boundary). This is cleaner, more robust, and avoids relying on private class name strings.
| tester.getSemantics( | |
| find.byWidgetPredicate( | |
| (Widget widget) => widget.runtimeType.toString() == '_CupertinoPickerSemantics', | |
| ), | |
| ), | |
| tester.getSemantics(find.byType(ListWheelScrollView)), |
…er#188792) flutter/packages@656ccaa...274ed3e 2026-06-30 nateshmbhat1@gmail.com [video_player_android] Add video track selection support (flutter/packages#11475) 2026-06-30 engine-flutter-autoroll@skia.org Manual roll Flutter from b081f33 to 0c80830 (1 revision) (flutter/packages#12058) 2026-06-30 36861262+QuncCccccc@users.noreply.github.com [material_ui] Remove `widgets` import from `material_test.dart` (flutter/packages#12056) 2026-06-29 36861262+QuncCccccc@users.noreply.github.com [material_ui] Remove `widgets` imports from `card_test.dart`, `checkbox_list_tile_test.dart` (flutter/packages#12054) 2026-06-29 36861262+QuncCccccc@users.noreply.github.com [material_ui] Remove `widgets/clipboard_utils.dart`, `widgets/text_selection_toolbar_utils.dart` imports from `adaptive_text_selection_toolbar_test.dart` (flutter/packages#12053) 2026-06-29 engine-flutter-autoroll@skia.org Manual roll Flutter from 11e339e to b081f33 (1 revision) (flutter/packages#12050) 2026-06-29 36861262+QuncCccccc@users.noreply.github.com [material_ui] Remove `widgets/clipboard_utils.dart` imports from `date_picker_test.dart`, `input_date_picker_form_field_test.dart`, `search_test.dart`, `selectable_text_test.dart`, `text_form_field_test.dart`, `text_selection_test.dart` (flutter/packages#12030) 2026-06-29 engine-flutter-autoroll@skia.org Manual roll Flutter from 87224e0 to 11e339e (4 revisions) (flutter/packages#12041) 2026-06-29 21270878+elliette@users.noreply.github.com [material_ui] Enable `text_field_test` (flutter/packages#12022) 2026-06-29 21270878+elliette@users.noreply.github.com [material_ui] Port PR (flutter#184807) from flutter/flutter to material_ui (flutter/packages#11972) 2026-06-29 rmolivares@renzo-olivares.dev [cupertino_ui] Migrate `button_test.dart` to `SemanticsHandle` (flutter/packages#11992) 2026-06-29 rmolivares@renzo-olivares.dev [cupertino_ui] Migrate `radio_test.dart` to `SemanticsHandle` (flutter/packages#11981) 2026-06-29 rmolivares@renzo-olivares.dev [cupertino_ui] Migrate `picker_test.dart` to `SemanticsHandle` (flutter/packages#12008) 2026-06-29 36861262+QuncCccccc@users.noreply.github.com [cupertino_ui] Create util files. Remove widgets import in `adaptive_text_selection_toolbar_test.dart` and `text_selection_test.dart` (flutter/packages#12023) 2026-06-29 21270878+elliette@users.noreply.github.com [material_ui] Enable `floating_action_button_test` (flutter/packages#12014) 2026-06-29 21270878+elliette@users.noreply.github.com [material_ui] Enable `dropdown_test` (flutter/packages#12011) 2026-06-29 21270878+elliette@users.noreply.github.com [material_ui] Enable `chip_test` (flutter/packages#12009) 2026-06-29 36861262+QuncCccccc@users.noreply.github.com [material_ui] Remove widgets import in `data_table_test.dart`, `switch_test.dart` and `tooltip_theme_test.dart` (flutter/packages#12031) 2026-06-29 burak.karahan@mail.ru [material_ui] Port flutter/flutter flutter#186670 "Use local semantics tester in Material selection tests" (flutter/packages#11983) 2026-06-29 21270878+elliette@users.noreply.github.com [material_ui] Enable `switch_list_tile_test` (flutter/packages#12020) 2026-06-29 21270878+elliette@users.noreply.github.com [material_ui] Enable `popup_menu_test` (flutter/packages#12018) 2026-06-29 21270878+elliette@users.noreply.github.com [material_ui] Enable `date_range_picker_test` (flutter/packages#12010) 2026-06-29 stuartmorgan@google.com [google_sign_in] Simplify Android user ID extraction (flutter/packages#12025) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com 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: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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]///).