-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[cupertino_ui] Re-enable action_sheet_test.dart #12055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,6 @@ | |
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| @Skip( | ||
| 'This file is skipped due to a cross-import that needs to be fixed. Tracked in https://github.com/flutter/flutter/issues/177028.', | ||
| ) | ||
| // This file is run as part of a reduced test set in CI on Mac and Windows | ||
| // machines. | ||
| @Tags(<String>['reduced-test-set']) | ||
|
|
@@ -19,8 +16,6 @@ import 'package:flutter/services.dart'; | |
|
|
||
| import 'package:flutter_test/flutter_test.dart'; | ||
|
|
||
| import '../widgets/semantics_tester.dart'; | ||
|
|
||
| void main() { | ||
| testWidgets('Overall appearance is correct for the light theme', (WidgetTester tester) async { | ||
| await tester.pumpWidget( | ||
|
|
@@ -1727,8 +1722,6 @@ void main() { | |
| }, skip: isBrowser); // https://github.com/flutter/flutter/issues/56001 | ||
|
|
||
| testWidgets('Action sheet semantics', (WidgetTester tester) async { | ||
| final semantics = SemanticsTester(tester); | ||
|
|
||
| await tester.pumpWidget( | ||
| createAppWithButtonThatLaunchesActionSheet( | ||
| CupertinoActionSheet( | ||
|
|
@@ -1746,74 +1739,51 @@ void main() { | |
| await tester.tap(find.text('Go')); | ||
| await tester.pumpAndSettle(); | ||
|
|
||
| final SemanticsNode sheet = tester.semantics.find(find.bySemanticsLabel('Alert')); | ||
| expect(sheet.role, SemanticsRole.dialog); | ||
| expect( | ||
| semantics, | ||
| hasSemantics( | ||
| TestSemantics.root( | ||
| children: <TestSemantics>[ | ||
| TestSemantics( | ||
| children: <TestSemantics>[ | ||
| TestSemantics( | ||
| children: <TestSemantics>[ | ||
| TestSemantics( | ||
| flags: <SemanticsFlag>[SemanticsFlag.scopesRoute, SemanticsFlag.namesRoute], | ||
| label: 'Alert', | ||
| role: SemanticsRole.dialog, | ||
| children: <TestSemantics>[ | ||
| TestSemantics( | ||
| flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling], | ||
| children: <TestSemantics>[ | ||
| TestSemantics(label: 'The title'), | ||
| TestSemantics(label: 'The message'), | ||
| ], | ||
| ), | ||
| TestSemantics( | ||
| flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should still capture
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm planning to defer to @chunhtai on this. I originally thought the hasImplicitScrolling was irrelevant, but maybe you do want to verify that the semantics tree is aware of the scrolling... Maybe we should be verifying everything from the "label: 'Alert'" level and below?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yes I think so
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chunhtai I've now updated it to test the whole tree, similar to before except with isSemantics instead of TestSemantics. Is that what you had in mind? Some questions:
Should I instead do a flat list of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have been testing tester.getSemantics(find.byType(CupertinoSlidingSegmentedControl<int>)).role,
SemanticsRole.radioGroup,
);
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
right we should make sure it support role
we should improve the error message
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pr to add role support flutter/flutter#188825
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pr to improve child mismatch flutter/flutter#188827 |
||
| children: <TestSemantics>[ | ||
| TestSemantics( | ||
| flags: <SemanticsFlag>[ | ||
| SemanticsFlag.isButton, | ||
| SemanticsFlag.isFocusable, | ||
| ], | ||
| actions: <SemanticsAction>[ | ||
| SemanticsAction.tap, | ||
| SemanticsAction.focus, | ||
| ], | ||
| label: 'One', | ||
| ), | ||
| TestSemantics( | ||
| flags: <SemanticsFlag>[ | ||
| SemanticsFlag.isButton, | ||
| SemanticsFlag.isFocusable, | ||
| ], | ||
| actions: <SemanticsAction>[ | ||
| SemanticsAction.tap, | ||
| SemanticsAction.focus, | ||
| ], | ||
| label: 'Two', | ||
| ), | ||
| ], | ||
| ), | ||
| TestSemantics( | ||
| flags: <SemanticsFlag>[SemanticsFlag.isButton, SemanticsFlag.isFocusable], | ||
| actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus], | ||
| label: 'Cancel', | ||
| ), | ||
| ], | ||
| ), | ||
| ], | ||
| ), | ||
| ], | ||
| ), | ||
| ], | ||
| ), | ||
| ignoreId: true, | ||
| ignoreRect: true, | ||
| ignoreTransform: true, | ||
| sheet, | ||
| isSemantics( | ||
| label: 'Alert', | ||
| namesRoute: true, | ||
| scopesRoute: true, | ||
| children: <Matcher>[ | ||
| isSemantics( | ||
| hasImplicitScrolling: true, | ||
| children: <Matcher>[ | ||
| isSemantics(label: 'The title'), | ||
| isSemantics(label: 'The message'), | ||
| ], | ||
| ), | ||
| isSemantics( | ||
| hasImplicitScrolling: true, | ||
| children: <Matcher>[ | ||
| isSemantics( | ||
| label: 'One', | ||
| isButton: true, | ||
| isFocusable: true, | ||
| hasTapAction: true, | ||
| hasFocusAction: true, | ||
| ), | ||
| isSemantics( | ||
| label: 'Two', | ||
| isButton: true, | ||
| isFocusable: true, | ||
| hasTapAction: true, | ||
| hasFocusAction: true, | ||
| ), | ||
| ], | ||
| ), | ||
| isSemantics( | ||
| label: 'Cancel', | ||
| isButton: true, | ||
| isFocusable: true, | ||
| hasTapAction: true, | ||
| hasFocusAction: true, | ||
| ), | ||
| ], | ||
| ), | ||
| ); | ||
|
|
||
| semantics.dispose(); | ||
| }); | ||
|
|
||
| testWidgets('Conflicting scrollbars are not applied by ScrollBehavior to CupertinoActionSheet', ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use
SemanticsHandleto ensure semantics is initialized like below (plus dispose at the end of the test)? I'm not sure how necessary this is but I've been doing it in the migrations I've done.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 49a84da, but maybe @chunhtai can confirm if it's needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semantics is enabled by default for testwidget now, so you don't need to initialize the handle in test.