Skip to content

Conversation

@justinmc
Copy link
Contributor

@justinmc justinmc commented Oct 14, 2025

There is a lot of cross-library importing in the framework unit tests that I'd like to clean up, see the design doc for more: https://docs.google.com/document/d/1UHxALQqCbmgjnM1RNV9xE2pK3IGyx-UktGX1D7hYCjs/edit?tab=t.0

This PR cleans up a few obvious instances and adds TODOs for others. I created this while doing an investigation for the design doc linked above. I hope that we'll be able to follow up with fixes for all of the problematic tests (tracked in the issue below).

Part of #177028

@justinmc justinmc self-assigned this Oct 14, 2025
@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository labels Oct 14, 2025
@github-actions github-actions bot added the f: material design flutter/packages/flutter/material repository. label Oct 14, 2025
@github-actions github-actions bot added the f: routes Navigator, Router, and related APIs. label Oct 14, 2025
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #177029 at sha 5189199

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Oct 28, 2025
@justinmc
Copy link
Contributor Author

This PR should wait for the new cross import lint to land: #178693

Once that lands, I should update this PR, and I should get failures for all of the test that I've fixed here. Removing them from the "known list" should fix the failures.

@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@huycozy
Copy link
Member

huycozy commented Dec 30, 2025

I only want to inform that I'm looking at the umbrella issue (and its sub-issues too) and would like to give a hand to complete the remaining work. Hope this PR can be merged more quickly. This will help to determine the remaining tasks for the sub-issues outlined in #177028. It would be appreciated if completed items can be marked as done there, so that we can check the status of the list better. Thank you! 🙏

github-merge-queue bot pushed a commit that referenced this pull request Dec 30, 2025
This PR adds a lint rule to catch imports between Material, Cupertino,
and Widgets in tests. Spun out of
#177029 and the [Decoupling Tests
design
doc](https://docs.google.com/document/d/1UHxALQqCbmgjnM1RNV9xE2pK3IGyx-UktGX1D7hYCjs/edit?pli=1&tab=t.0).

For now, Material will be the place to put tests that need to import
both Material and Cupertino. See
#178693 (comment).

I used #130523 as a reference to
create this PR.

---------

Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
@justinmc
Copy link
Contributor Author

Thank you for the support @huycozy! I just landed the lint PR #178693 that was blocking this. I'm going to update this PR and make sure it works with the lint, then everyone should be good to start working on #177028.

However, there are some test helpers that I would love to get written to make some of these tests easier. For example, @Renzo-Olivares was looking at writing a test helper wrapping EditableText to make it easier to use. The same thing is probably needed for WidgetsApp.

I'll respond on #177028 and the sub-issues with more details.

@justinmc
Copy link
Contributor Author

justinmc commented Jan 2, 2026

Indeed the analyzer has failed due to the lint I added in #178693. The cross imports that I fixed in this PR now need to be removed from the allowlist. I'll do that now and then it should pass.

Analyzer error
╔═╡ERROR #1╞════════════════════════════════════════════════════════════════════
║ Huzzah! The following tests in Widgets no longer contain cross imports!
║   packages/flutter/test/widgets/async_lifecycle_test.dart
║   packages/flutter/test/widgets/multi_view_parent_data_test.dart
║   packages/flutter/test/widgets/view_test.dart
║   packages/flutter/test/widgets/slotted_render_object_widget_test.dart
║   packages/flutter/test/widgets/semantics_2_test.dart
║   packages/flutter/test/widgets/reparent_state_test.dart
║   packages/flutter/test/widgets/transitions_test.dart
║   packages/flutter/test/widgets/parent_data_test.dart
║   packages/flutter/test/widgets/binding_live_test.dart
║   packages/flutter/test/widgets/list_view_fling_test.dart
║   packages/flutter/test/widgets/selectable_text_test.dart
║   packages/flutter/test/widgets/semantics_7_test.dart
║   packages/flutter/test/widgets/opacity_repaint_test.dart
║   packages/flutter/test/widgets/list_view_relayout_test.dart
║   packages/flutter/test/widgets/semantics_4_test.dart
║   packages/flutter/test/widgets/multi_view_binding_test.dart
║   packages/flutter/test/widgets/binding_deferred_first_frame_test.dart
║   packages/flutter/test/widgets/scroll_delegate_test.dart
║   packages/flutter/test/widgets/list_view_correction_test.dart
║   packages/flutter/test/widgets/semantics_zero_surface_size_test.dart
║   packages/flutter/test/widgets/semantics_9_test.dart
║   packages/flutter/test/widgets/icon_data_test.dart
║   packages/flutter/test/widgets/semantics_refactor_regression_test.dart
║   packages/flutter/test/widgets/animated_opacity_repaint_test.dart
║   packages/flutter/test/widgets/semantics_6_test.dart
║   packages/flutter/test/widgets/animated_image_filtered_repaint_test.dart
║   packages/flutter/test/widgets/tree_shape_test.dart
║   packages/flutter/test/widgets/rich_text_test.dart
║   packages/flutter/test/widgets/sensitive_content_error_handling_test.dart
║   packages/flutter/test/widgets/drag_boundary_test.dart
║   packages/flutter/test/widgets/semantics_traversal_test.dart
║   packages/flutter/test/widgets/sensitive_content_unknown_test.dart
║   packages/flutter/test/widgets/overlay_test.dart
║   packages/flutter/test/widgets/semantics_8_test.dart
║   packages/flutter/test/widgets/sliver_fill_viewport_test.dart
║   packages/flutter/test/widgets/wrap_test.dart
║   packages/flutter/test/widgets/overlay_portal_test.dart
║   packages/flutter/test/widgets/semantics_11_test.dart
║   packages/flutter/test/widgets/binding_first_frame_rasterized_test.dart
║   packages/flutter/test/widgets/router_restoration_test.dart
║   packages/flutter/test/widgets/error_widget_test.dart
║   packages/flutter/test/widgets/semantics_checks_test.dart
║   packages/flutter/test/widgets/sensitive_content_test.dart
║   packages/flutter/test/widgets/semantics_10_test.dart
║   packages/flutter/test/widgets/semantics_1_test.dart
║   packages/flutter/test/widgets/sensitive_content_host_test.dart
║   packages/flutter/test/widgets/default_colors_test.dart
║   packages/flutter/test/widgets/multi_view_tree_updates_test.dart
║   packages/flutter/test/widgets/semantics_5_test.dart
║   packages/flutter/test/widgets/clip_test.dart
║   packages/flutter/test/widgets/independent_widget_layout_test.dart
║   packages/flutter/test/widgets/binding_first_frame_developer_test.dart
║   packages/flutter/test/widgets/multi_view_no_implicit_view_binding_test.dart
║   packages/flutter/test/widgets/reparent_state_with_layout_builder_test.dart
║   packages/flutter/test/widgets/semantics_3_test.dart
║   packages/flutter/test/widgets/sliver_appbar_opacity_test.dart
║   packages/flutter/test/widgets/sliver_constrained_cross_axis_test.dart
║   packages/flutter/test/widgets/focus_manager_test.dart
║   packages/flutter/test/widgets/implicit_semantics_test.dart
║   packages/flutter/test/widgets/shrink_wrapping_viewport_test.dart
║ However, they now need to be removed from the
║ knownWidgetsCrossImports list in the script /dev/bots/check_tests_cross_imports.dart.
╚═══════════════════════════════════════════════════════════════════════════════
╔═╡ERROR #2╞════════════════════════════════════════════════════════════════════
║ Huzzah! The following tests in Cupertino no longer contain cross imports!
║   packages/flutter/test/cupertino/action_sheet_test.dart
║ However, they now need to be removed from the
║ knownCupertinoCrossImports list in the script /dev/bots/check_tests_cross_imports.dart.
╚═══════════════════════════════════════════════════════════════════════════════

@justinmc justinmc added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 2, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Jan 2, 2026
Merged via the queue into flutter:master with commit bef11d2 Jan 2, 2026
149 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jan 2, 2026
@justinmc justinmc deleted the cross-library-test-imports branch January 2, 2026 22:00
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 3, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 3, 2026
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jan 4, 2026
Roll Flutter from 60d8165 to 13b2b91 (34 revisions)

flutter/flutter@60d8165...13b2b91

2026-01-03 engine-flutter-autoroll@skia.org Roll Skia from 229239fde9e9 to 2f257bbea23a (1 revision) (flutter/flutter#180461)
2026-01-03 engine-flutter-autoroll@skia.org Roll Dart SDK from be125a188f41 to 8e711d05b844 (1 revision) (flutter/flutter#180460)
2026-01-03 engine-flutter-autoroll@skia.org Roll Dart SDK from 0e6419d14382 to be125a188f41 (1 revision) (flutter/flutter#180454)
2026-01-02 engine-flutter-autoroll@skia.org Roll Dart SDK from 5e4b7dc3a134 to 0e6419d14382 (4 revisions) (flutter/flutter#180449)
2026-01-02 engine-flutter-autoroll@skia.org Roll Skia from 5a8d480365e2 to 229239fde9e9 (9 revisions) (flutter/flutter#180448)
2026-01-02 47866232+chunhtai@users.noreply.github.com Relands "Feat: Add a11y for loading indicators (#165173)" (flutter/flutter#178402)
2026-01-02 bungeman@chromium.org Add SK_SUPPORT_LEGACY_UNSPANNED_GRADIENTS to SkUserConfig.h (flutter/flutter#180443)
2026-01-02 jmccandless@google.com Some cleanup of cross library test imports (flutter/flutter#177029)
2026-01-02 engine-flutter-autoroll@skia.org Roll Dart SDK from df175c998021 to 5e4b7dc3a134 (1 revision) (flutter/flutter#180366)
2026-01-02 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from nzgy72aZ9kvHxTDM6... to 1pPgo5DrQ5ITdz3Uy... (flutter/flutter#180438)
2026-01-01 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 23suNuzNQCwRbDrys... to nzgy72aZ9kvHxTDM6... (flutter/flutter#180424)
2025-12-31 srawlins@google.com Remove @OverRide annotations from things which are not overrides (flutter/flutter#180417)
2025-12-31 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from t1eBl_kzKGV5K28OU... to 23suNuzNQCwRbDrys... (flutter/flutter#180409)
2025-12-31 engine-flutter-autoroll@skia.org Roll Skia from 8851d5318c9d to 5a8d480365e2 (1 revision) (flutter/flutter#180400)
2025-12-31 ahmedsameha1@gmail.com Make sure that a DecoratedBox doesn't crash in 0x0 environment (flutter/flutter#180329)
2025-12-31 engine-flutter-autoroll@skia.org Roll Skia from d0e12d575173 to 8851d5318c9d (2 revisions) (flutter/flutter#180399)
2025-12-31 iliyazelenkog@gmail.com Improve Container color/decoration error message clarity (flutter/flutter#178823)
2025-12-30 ahmedsameha1@gmail.com Make sure that a CheckedModeBanner doesn't crash in 0x0 environment (flutter/flutter#180280)
2025-12-30 engine-flutter-autoroll@skia.org Roll Skia from 32c27424accb to d0e12d575173 (1 revision) (flutter/flutter#180394)
2025-12-30 dkwingsmt@users.noreply.github.com [Framework] iOS style blurring and `ImageFilterConfig` (flutter/flutter#175473)
2025-12-30 evanwall@buffalo.edu Fix issue with getUniformFloat crashing with hot reload (flutter/flutter#180138)
2025-12-30 jmccandless@google.com Test cross import lint (flutter/flutter#178693)
2025-12-30 engine-flutter-autoroll@skia.org Roll Skia from d64da765cee6 to 32c27424accb (1 revision) (flutter/flutter#180393)
2025-12-30 engine-flutter-autoroll@skia.org Roll Skia from 4c438e0537fc to d64da765cee6 (1 revision) (flutter/flutter#180390)
2025-12-30 engine-flutter-autoroll@skia.org Roll Packages from b3c3ca8 to 30dd810 (1 revision) (flutter/flutter#180388)
2025-12-30 engine-flutter-autoroll@skia.org Roll Skia from 27b587c4b160 to 4c438e0537fc (1 revision) (flutter/flutter#180384)
2025-12-30 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from DdllqZRZYriOd7Q8v... to t1eBl_kzKGV5K28OU... (flutter/flutter#180378)
2025-12-30 engine-flutter-autoroll@skia.org Roll Skia from 11690456a90d to 27b587c4b160 (1 revision) (flutter/flutter#180377)
2025-12-30 evanwall@buffalo.edu Allow setting vector uniforms by name. (flutter/flutter#179927)
2025-12-30 engine-flutter-autoroll@skia.org Roll Skia from 7abf754bce14 to 11690456a90d (6 revisions) (flutter/flutter#180374)
2025-12-29 logic@deltaq.org Add support for Shift-Delete, Ctrl-Insert and Shift-Insert (flutter/flutter#178561)
2025-12-29 engine-flutter-autoroll@skia.org Roll Skia from c85d3e2b12d7 to 7abf754bce14 (1 revision) (flutter/flutter#180371)
2025-12-29 engine-flutter-autoroll@skia.org Roll Packages from 2164da9 to b3c3ca8 (2 revisions) (flutter/flutter#180365)
2025-12-29 engine-flutter-autoroll@skia.org Roll Skia from c29a475066f5 to c85d3e2b12d7 (1 revision) (flutter/flutter#180363)

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 stuartmorgan@google.com 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

...
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: text input Entering text in a text field or keyboard related problems f: cupertino flutter/packages/flutter/cupertino repository f: focus Focus traversal, gaining or losing focus f: material design flutter/packages/flutter/material repository. f: routes Navigator, Router, and related APIs. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants