Skip to content

Conversation

@ValentinVignal
Copy link
Contributor

Contributes to #130459

It adds a test for

  • examples/api/test/material/selection_container/selection_container_disabled.0_test.dart

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Oct 16, 2024
@ValentinVignal ValentinVignal changed the title Add tests for selection_container_disabled.0.dart Add test for selection_container_disabled.0.dart Oct 16, 2024
Copy link
Contributor

@bleroux bleroux left a 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)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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),
),
);

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)));
Copy link
Contributor

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)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@ValentinVignal ValentinVignal added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 16, 2024
@auto-submit auto-submit bot merged commit 5644c03 into flutter:master Oct 16, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 16, 2024
Lurchfresser pushed a commit to Lurchfresser/flutter that referenced this pull request Oct 17, 2024
Contributes to flutter#130459

It adds a test for
- `examples/api/test/material/selection_container/selection_container_disabled.0_test.dart`
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 17, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants