Skip to content

Add test for segmented_button.0.dart - #150676

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
ValentinVignal:flutter/api/example/Add-test-for-segmented-button
Jun 29, 2024
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
ValentinVignal:flutter/api/example/Add-test-for-segmented-button

Conversation

@ValentinVignal

Copy link
Copy Markdown
Contributor

Contributes to #130459

It adds a test for

  • examples/api/test/material/segmented_button/segmented_button.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 Jun 24, 2024
@goderbauer
goderbauer requested review from TahaTesser and bleroux June 25, 2024 22:06

@bleroux bleroux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with nits.

await tester.pumpWidget(
const example.SegmentedButtonApp(),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure it will be more readable, maybe use a helper to avoid repeating the verbose expect?

Suggested change
void expectOneCalendarButton(example.Calendar period) {
expect(
find.byWidgetPredicate(
(Widget widget) => widget is SegmentedButton<example.Calendar> && setEquals(widget.selected, <example.Calendar>{period}),
),
findsOne,
);
}

expect(find.byWidgetPredicate(
(Widget widget) => widget is SegmentedButton<example.Calendar> && setEquals(widget.selected, const <example.Calendar>{example.Calendar.day}),
), findsOne);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove extra line


});

testWidgets('Segmented button can be used for with a multiple selection', (WidgetTester tester) async {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo 'for with'

import 'package:flutter_test/flutter_test.dart';

void main() {
testWidgets('Segmented button can be used for with a single selection', (WidgetTester tester) async {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo 'for with'

@ValentinVignal

Copy link
Copy Markdown
Contributor Author

Thank you for the review @bleroux, everything should be fixed in refactor: Use helper

@TahaTesser TahaTesser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 29, 2024
@auto-submit
auto-submit Bot merged commit 96c5577 into flutter:master Jun 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 1, 2024
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jul 1, 2024
flutter/flutter@651a17d...99bb2ff

2024-07-01 [email protected] Roll Flutter Engine from 0d93da7e2fe1 to b57a044ed10f (1 revision) (flutter/flutter#151082)
2024-06-30 [email protected] Roll Flutter Engine from ad1343cfb99e to 0d93da7e2fe1 (9 revisions) (flutter/flutter#151062)
2024-06-29 [email protected] Reduce the depth used in a test that applies finders to deep widget trees (flutter/flutter#151049)
2024-06-29 [email protected] Roll Flutter Engine from f828363d03ff to ad1343cfb99e (3 revisions) (flutter/flutter#151016)
2024-06-29 [email protected] Add test for segmented_button.0.dart (flutter/flutter#150676)
2024-06-29 [email protected] Roll pub packages (flutter/flutter#151022)
2024-06-29 [email protected] Roll pub packages (flutter/flutter#150827)
2024-06-28 [email protected] Roll Flutter Engine from 2f7e9ab27493 to f828363d03ff (3 revisions) (flutter/flutter#151013)
2024-06-28 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.25.10 to 3.25.11 (flutter/flutter#151012)
2024-06-28 [email protected] [tool] when writing to openssl as a part of macOS/iOS code-signing, flush the stdin stream before closing it (flutter/flutter#150120)

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
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
victorsanni pushed a commit to victorsanni/flutter that referenced this pull request Jul 8, 2024
Contributes to flutter#130459

It adds a test for
- `examples/api/test/material/segmented_button/segmented_button.0_test.dart`
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 6, 2024
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
flutter/flutter@651a17d...99bb2ff

2024-07-01 [email protected] Roll Flutter Engine from 0d93da7e2fe1 to b57a044ed10f (1 revision) (flutter/flutter#151082)
2024-06-30 [email protected] Roll Flutter Engine from ad1343cfb99e to 0d93da7e2fe1 (9 revisions) (flutter/flutter#151062)
2024-06-29 [email protected] Reduce the depth used in a test that applies finders to deep widget trees (flutter/flutter#151049)
2024-06-29 [email protected] Roll Flutter Engine from f828363d03ff to ad1343cfb99e (3 revisions) (flutter/flutter#151016)
2024-06-29 [email protected] Add test for segmented_button.0.dart (flutter/flutter#150676)
2024-06-29 [email protected] Roll pub packages (flutter/flutter#151022)
2024-06-29 [email protected] Roll pub packages (flutter/flutter#150827)
2024-06-28 [email protected] Roll Flutter Engine from 2f7e9ab27493 to f828363d03ff (3 revisions) (flutter/flutter#151013)
2024-06-28 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.25.10 to 3.25.11 (flutter/flutter#151012)
2024-06-28 [email protected] [tool] when writing to openssl as a part of macOS/iOS code-signing, flush the stdin stream before closing it (flutter/flutter#150120)

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
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
flutter/flutter@651a17d...99bb2ff

2024-07-01 [email protected] Roll Flutter Engine from 0d93da7e2fe1 to b57a044ed10f (1 revision) (flutter/flutter#151082)
2024-06-30 [email protected] Roll Flutter Engine from ad1343cfb99e to 0d93da7e2fe1 (9 revisions) (flutter/flutter#151062)
2024-06-29 [email protected] Reduce the depth used in a test that applies finders to deep widget trees (flutter/flutter#151049)
2024-06-29 [email protected] Roll Flutter Engine from f828363d03ff to ad1343cfb99e (3 revisions) (flutter/flutter#151016)
2024-06-29 [email protected] Add test for segmented_button.0.dart (flutter/flutter#150676)
2024-06-29 [email protected] Roll pub packages (flutter/flutter#151022)
2024-06-29 [email protected] Roll pub packages (flutter/flutter#150827)
2024-06-28 [email protected] Roll Flutter Engine from 2f7e9ab27493 to f828363d03ff (3 revisions) (flutter/flutter#151013)
2024-06-28 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.25.10 to 3.25.11 (flutter/flutter#151012)
2024-06-28 [email protected] [tool] when writing to openssl as a part of macOS/iOS code-signing, flush the stdin stream before closing it (flutter/flutter#150120)

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
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
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.

3 participants