-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Add test for selection_container_disabled.0.dart
#156934
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
Add test for selection_container_disabled.0.dart
#156934
Conversation
selection_container_disabled.0.dartselection_container_disabled.0.dart
bleroux
left a comment
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.
LGTM!
Before merging consider splitting the very long lines.
|
|
||
| expect(find.widgetWithText(AppBar, 'SelectionContainer.disabled Sample'), findsOne); | ||
|
|
||
| final RenderParagraph paragraph1 = tester.renderObject<RenderParagraph>(find.descendant(of: find.text('Selectable text').first, matching: find.byType(RichText))); |
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.
| final RenderParagraph paragraph1 = tester.renderObject<RenderParagraph>(find.descendant(of: find.text('Selectable text').first, matching: find.byType(RichText))); | |
| final RenderParagraph paragraph1 = tester.renderObject<RenderParagraph>( | |
| find.descendant( | |
| of: find.text('Selectable text').first, | |
| matching: find.byType(RichText), | |
| ), | |
| ); |
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.
Sure, I've done it in format: Split long lines :)
|
|
||
| final RenderParagraph paragraph1 = tester.renderObject<RenderParagraph>(find.descendant(of: find.text('Selectable text').first, matching: find.byType(RichText))); | ||
| final Rect paragraph1Rect = tester.getRect(find.text('Selectable text').first); | ||
| final TestGesture gesture = await tester.startGesture(paragraph1Rect.centerLeft, kind: PointerDeviceKind.mouse); |
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.
| final TestGesture gesture = await tester.startGesture(paragraph1Rect.centerLeft, kind: PointerDeviceKind.mouse); | |
| final TestGesture gesture = await tester.startGesture( | |
| paragraph1Rect.centerLeft, | |
| kind: PointerDeviceKind.mouse, | |
| ); |
| await tester.pump(); | ||
| expect(paragraph1.selections.first, const TextSelection(baseOffset: 0, extentOffset: 7)); | ||
|
|
||
| final RenderParagraph paragraph2 = tester.renderObject<RenderParagraph>(find.descendant(of: find.text('Non-selectable text'), matching: find.byType(RichText))); |
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.
same
| // paragraph2 is in a disabled container. | ||
| expect(paragraph2.selections, isEmpty); | ||
|
|
||
| final RenderParagraph paragraph3 = tester.renderObject<RenderParagraph>(find.descendant(of: find.text('Selectable text').last, matching: find.byType(RichText))); |
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.
same
Contributes to flutter#130459 It adds a test for - `examples/api/test/material/selection_container/selection_container_disabled.0_test.dart`
Contributes to #130459
It adds a test for
examples/api/test/material/selection_container/selection_container_disabled.0_test.dartPre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.