Skip to content

refactor: remove material in context_menu_controller_test, icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test#182697

Merged
auto-submit[bot] merged 2 commits intoflutter:masterfrom
rkishan516:simple-cross-imports
Feb 24, 2026
Merged

Conversation

@rkishan516
Copy link
Contributor

This PR removes Material imports from context_menu_controller_test, icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test.

part of: #177415

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. labels Feb 21, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly refactors several test files to remove dependencies on the material library. The changes replace Material Design widgets and constants with more basic equivalents from flutter/widgets or test-specific helpers, which is a good improvement for test isolation. I have one suggestion for packages/flutter/test/widgets/icon_test.dart to define constants for repeated IconData values to improve code readability and maintainability.

Comment on lines 425 to 450
test('Throws if given invalid values', () {
expect(() => Icon(Icons.abc, fill: -0.1), throwsAssertionError);
expect(() => Icon(Icons.abc, fill: 1.1), throwsAssertionError);
expect(() => Icon(Icons.abc, weight: -0.1), throwsAssertionError);
expect(() => Icon(Icons.abc, weight: 0.0), throwsAssertionError);
expect(() => Icon(Icons.abc, opticalSize: -0.1), throwsAssertionError);
expect(() => Icon(Icons.abc, opticalSize: 0), throwsAssertionError);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), fill: -0.1),
throwsAssertionError,
);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), fill: 1.1),
throwsAssertionError,
);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), weight: -0.1),
throwsAssertionError,
);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), weight: 0.0),
throwsAssertionError,
);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), opticalSize: -0.1),
throwsAssertionError,
);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), opticalSize: 0),
throwsAssertionError,
);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The IconData for abc is used multiple times in this file. To improve readability and maintainability, it's better to define it as a constant. This suggestion defines it inside the test, but it would be even better to define it at the top of the main function and reuse it across all tests in this file. This suggestion also applies to other hardcoded IconData values in this file.

  test('Throws if given invalid values', () {
    const IconData kAbcIcon = IconData(0xf04b6, fontFamily: 'MaterialIcons');
    expect(
      () => Icon(kAbcIcon, fill: -0.1),
      throwsAssertionError,
    );
    expect(
      () => Icon(kAbcIcon, fill: 1.1),
      throwsAssertionError,
    );
    expect(
      () => Icon(kAbcIcon, weight: -0.1),
      throwsAssertionError,
    );
    expect(
      () => Icon(kAbcIcon, weight: 0.0),
      throwsAssertionError,
    );
    expect(
      () => Icon(kAbcIcon, opticalSize: -0.1),
      throwsAssertionError,
    );
    expect(
      () => Icon(kAbcIcon, opticalSize: 0),
      throwsAssertionError,
    );
  });

Copy link
Contributor

Choose a reason for hiding this comment

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

+1, or similar

Comment on lines 425 to 450
test('Throws if given invalid values', () {
expect(() => Icon(Icons.abc, fill: -0.1), throwsAssertionError);
expect(() => Icon(Icons.abc, fill: 1.1), throwsAssertionError);
expect(() => Icon(Icons.abc, weight: -0.1), throwsAssertionError);
expect(() => Icon(Icons.abc, weight: 0.0), throwsAssertionError);
expect(() => Icon(Icons.abc, opticalSize: -0.1), throwsAssertionError);
expect(() => Icon(Icons.abc, opticalSize: 0), throwsAssertionError);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), fill: -0.1),
throwsAssertionError,
);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), fill: 1.1),
throwsAssertionError,
);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), weight: -0.1),
throwsAssertionError,
);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), weight: 0.0),
throwsAssertionError,
);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), opticalSize: -0.1),
throwsAssertionError,
);
expect(
() => Icon(const IconData(0xf04b6, fontFamily: 'MaterialIcons'), opticalSize: 0),
throwsAssertionError,
);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

+1, or similar

textDirection: TextDirection.ltr,
child: Center(child: SizedBox.shrink(child: Icon(Icons.save))),
child: Center(
child: SizedBox.shrink(child: Icon(IconData(0xe550, fontFamily: 'MaterialIcons'))),
Copy link
Contributor

Choose a reason for hiding this comment

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

And we can change this to use one of the constants created.

@rkishan516 rkishan516 added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 24, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Feb 24, 2026
Merged via the queue into flutter:master with commit f76936b Feb 24, 2026
152 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 24, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2026
…icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter/flutter#182697)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2026
…icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter/flutter#182697)
@dkwingsmt
Copy link
Contributor

dkwingsmt commented Feb 25, 2026

Reason for revert: I think this PR is causing redness, possibly by forgetting to import button_tester.dart.

  error • Undefined name 'testTextSelectionHandleControls' • packages/flutter/test/widgets/context_menu_controller_test.dart:205:36 • undefined_identifier
  error • The function 'TestButton' isn't defined • packages/flutter/test/widgets/media_query_test.dart:1700:17 • undefined_function
  error • The function 'TestButton' isn't defined • packages/flutter/test/widgets/media_query_test.dart:1708:17 • undefined_function
  error • The function 'TestButton' isn't defined • packages/flutter/test/widgets/media_query_test.dart:1766:17 • undefined_function
  error • The function 'TestButton' isn't defined • packages/flutter/test/widgets/media_query_test.dart:1774:17 • undefined_function
  error • The function 'TestButton' isn't defined • packages/flutter/test/widgets/media_query_test.dart:2015:17 • undefined_function
  error • The function 'TestButton' isn't defined • packages/flutter/test/widgets/media_query_test.dart:2023:17 • undefined_function
7 issues found. (7 new) • analyzed 5481 files (ran in 12.30s)

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8688921759035236529/+/u/run_test.dart_for_analyze_shard_and_subshard_None/stdout?format=raw

@dkwingsmt dkwingsmt added revert Autorevert PR (with "Reason for revert:" comment) and removed revert Autorevert PR (with "Reason for revert:" comment) labels Feb 25, 2026
auto-submit bot pushed a commit that referenced this pull request Feb 25, 2026
…on_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (#182697)"

This reverts commit f76936b.
@auto-submit auto-submit bot removed the revert Autorevert PR (with "Reason for revert:" comment) label Feb 25, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 25, 2026
…con_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (#182697)" (#182879)

<!-- start_original_pr_link -->
Reverts: #182697
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: dkwingsmt
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: I think this PR is causing redness, possibly by
forgetting to import `button_tester.dart`.

```
  error • Undefined name 'testTextSelectionHandleControls' • packages/flutter/test/widgets/context_menu_controller_test.dart:205:36 • undefined_identifier
  error • The function 'TestButton' isn't defined • packages/flutter/test/widgets/media_query_test.dart:1700:17 • undefined_function
  error • 
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: rkishan516
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {victorsanni}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
This PR removes Material imports from context_menu_controller_test, icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test.

part of: #177415

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is [test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
- [x] All existing and new tests are passing.
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <[email protected]>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2026
…icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter/flutter#182697)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2026
…icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter/flutter#182697)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2026
…icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter/flutter#182697)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2026
…icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter/flutter#182697)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2026
…icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter/flutter#182697)
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Feb 26, 2026
Roll Flutter from dad6f9d4107a to b31548feb941 (39 revisions)

flutter/flutter@dad6f9d...b31548f

2026-02-25 [email protected] [web] Fix failure on Firefox 148 (flutter/flutter#182855)
2026-02-25 [email protected] Roll Fuchsia Linux SDK from KfPgw04T0OEADLJA5... to XI0Ax7fbtYE4XKYAQ... (flutter/flutter#182887)
2026-02-25 [email protected] Use AnimationStyle curve and reverseCurve in ModalBottomSheet animation (flutter/flutter#181403)
2026-02-25 [email protected] Roll Dart SDK from fd3dce5b6a4e to 5c57e75f1102 (9 revisions) (flutter/flutter#182801)
2026-02-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "refactor: remove material in context_menu_controller_test, icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (#182697)" (flutter/flutter#182879)
2026-02-25 [email protected] Make sure that an AnimatedSlide doesn't crash in 0x0 environment (flutter/flutter#181535)
2026-02-24 [email protected] Reland Standardize on Test* widgets in *_tester.dart files (flutter/flutter#182632)
2026-02-24 [email protected] docs(Path): clarify that zero-length contours are excluded from computeMetrics (flutter/flutter#180165)
2026-02-24 [email protected] Fix typo in assert message (flutter/flutter#182843)
2026-02-24 [email protected] [win32] Fix overflow in TaskRunnerWindow. (flutter/flutter#182822)
2026-02-24 [email protected] feat: Add --no-uninstall flag to flutter test for integration tests (flutter/flutter#182714)
2026-02-24 [email protected] Rename noFrequencyBasedMinification to useFrequencyBasedMinification (flutter/flutter#182684)
2026-02-24 [email protected] [Impeller] Fix fail to render pixel buffer texture on Linux (flutter/flutter#181656)
2026-02-24 [email protected] Remove FlutterFramework app migration (flutter/flutter#182100)
2026-02-24 [email protected] Roll Packages from 12b43a1 to 062c8d4 (5 revisions) (flutter/flutter#182839)
2026-02-24 [email protected] [web] Run webparagraph tests in CI (flutter/flutter#182092)
2026-02-24 [email protected] Fix a race in EmbedderTest.CanSpecifyCustomUITaskRunner (flutter/flutter#182649)
2026-02-24 [email protected] flutter_tools: Use a super-parameter in several missed cases (flutter/flutter#182581)
2026-02-24 [email protected] Replace more references to `flutter/engine` with `flutter/flutter` (flutter/flutter#182654)
2026-02-24 [email protected] Carousel: Migration from Scrollable+Viewport to CustomScrollView (flutter/flutter#182475)
2026-02-24 [email protected] Refactor impellerc_main to better organize some of its logic (flutter/flutter#182783)
2026-02-24 [email protected] Remove unused `getPluginList ` (flutter/flutter#182660)
2026-02-24 [email protected] Refactor: Remove material from ticker provider test (flutter/flutter#181697)
2026-02-24 [email protected] Roll Skia from 26eebffe12bd to f44d7db68805 (3 revisions) (flutter/flutter#182821)
2026-02-24 [email protected] refactor: remove material in context_menu_controller_test, icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter/flutter#182697)
2026-02-24 [email protected] Roll Skia from 7dad66aae75a to 26eebffe12bd (5 revisions) (flutter/flutter#182810)
2026-02-24 [email protected] Update roadmap for 2026 (flutter/flutter#182798)
2026-02-24 [email protected] Marks Windows tool_tests_commands_1_2 to be unflaky (flutter/flutter#179670)
2026-02-23 [email protected] [web] scroll iOS iframe text input into view (flutter/flutter#179759)
2026-02-23 [email protected] Fix textscaler clamp assertion error (flutter/flutter#181716)
2026-02-23 [email protected] Roll Skia from 9a5a3c92c336 to 7dad66aae75a (4 revisions) (flutter/flutter#182779)
2026-02-23 [email protected] Move more getters from userMessages class to the appropriate places (flutter/flutter#182656)
2026-02-23 [email protected] Manual roll Dart SDK from f8fac50475b8 to fd3dce5b6a4e (6 revisions) (flutter/flutter#182768)
2026-02-23 [email protected] Copy Flutter framework to Add to App FlutterPluginRgistrant (flutter/flutter#182523)
2026-02-23 [email protected] Add progress indicator to artifact downloads (flutter/flutter#181808)
2026-02-23 [email protected] Clarify batch release mode requirements (flutter/flutter#182228)
2026-02-23 [email protected] [web] Remove --disable-gpu from flutter chrome tests (flutter/flutter#182618)
2026-02-23 [email protected] running-apps: update running-apps to use Duration.ago() (flutter/flutter#182172)
2026-02-23 [email protected] Refactor bin/ shell scripts for better performance and safety (flutter/flutter#182674)

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] on the revert to ensure that a human
is aware of the problem.

...
github-merge-queue bot pushed a commit that referenced this pull request Feb 26, 2026
…ist_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (#182891)

This PR is reland PR for #182697
because TestButton got moved to its own file

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Feb 27, 2026
… list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter#182697)

This PR removes Material imports from context_menu_controller_test,
icon_test, list_wheel_scroll_view_test, media_query_test,
platform_menu_bar_test.

part of: flutter#177415

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Feb 27, 2026
…con_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter#182697)" (flutter#182879)

<!-- start_original_pr_link -->
Reverts: flutter#182697
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: dkwingsmt
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: I think this PR is causing redness, possibly by
forgetting to import `button_tester.dart`.

```
  error • Undefined name 'testTextSelectionHandleControls' • packages/flutter/test/widgets/context_menu_controller_test.dart:205:36 • undefined_identifier
  error • The function 'TestButton' isn't defined • packages/flutter/test/widgets/media_query_test.dart:1700:17 • undefined_function
  error • 
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: rkishan516
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {victorsanni}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
This PR removes Material imports from context_menu_controller_test, icon_test, list_wheel_scroll_view_test, media_query_test, platform_menu_bar_test.

part of: flutter#177415

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is [test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
- [x] All existing and new tests are passing.
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <[email protected]>
ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Feb 27, 2026
…ist_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter#182891)

This PR is reland PR for flutter#182697
because TestButton got moved to its own file

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
xxxOVALxxx pushed a commit to xxxOVALxxx/flutter that referenced this pull request Mar 10, 2026
…ist_wheel_scroll_view_test, media_query_test, platform_menu_bar_test (flutter#182891)

This PR is reland PR for flutter#182697
because TestButton got moved to its own file

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

Development

Successfully merging this pull request may close these issues.

3 participants