Skip to content

Remove navigator_utils cross-imports from cupertino tests#184282

Merged
auto-submit[bot] merged 3 commits intoflutter:masterfrom
xfce0:fix-navigator-utils-cross-imports
Apr 8, 2026
Merged

Remove navigator_utils cross-imports from cupertino tests#184282
auto-submit[bot] merged 3 commits intoflutter:masterfrom
xfce0:fix-navigator-utils-cross-imports

Conversation

@xfce0
Copy link
Copy Markdown
Contributor

@xfce0 xfce0 commented Mar 28, 2026

Removes cross-directory test imports of navigator_utils.dart from cupertino tests.

Part of #182636.

simulateSystemBack is a small (18-line) single-function utility, so duplication is the appropriate strategy per the issue guidelines. The file is copied into test/cupertino/, and both imports are
updated to reference the local copy.

Pre-launch Checklist

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository f: routes Navigator, Router, and related APIs. labels Mar 28, 2026
Copy link
Copy Markdown
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 introduces a new utility function simulateSystemBack in navigator_utils.dart to simulate system back gestures via platform messages and updates an import path in switch_test.dart. Feedback suggests using the SystemChannels.navigation.name constant instead of a hardcoded string to improve code maintainability.

/// receives a system back.
Future<void> simulateSystemBack() {
return TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
'flutter/navigation',
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.

medium

To improve maintainability and readability, it's better to use the SystemChannels.navigation.name constant instead of the hardcoded string 'flutter/navigation'. This avoids using 'magic strings' and makes the code more robust if the channel name were to change in the future.

Suggested change
'flutter/navigation',
SystemChannels.navigation.name,
References
  1. The style guide emphasizes optimizing for readability. Using constants for values like channel names makes the code's intent clearer and thus more readable. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion, applied! Now using SystemChannels.navigation.name instead of the hardcoded string.

import 'package:flutter_test/flutter_test.dart';

import '../widgets/list_tile_tester.dart';
import 'list_tile_tester.dart';
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.

This doesn't seem related to this PR, should it be the import for simulateSystemBack instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right, sorry about that! That change belonged to #184295. I have removed it and added the correct import updates for sheet_test.dart and tab_scaffold_test.dart instead.

@victorsanni
Copy link
Copy Markdown
Contributor

Hi @xfce0, this PR is currently targeting main, can you repurpose it to target master? Thanks.

@xfce0 xfce0 changed the base branch from main to master April 2, 2026 08:45
@xfce0 xfce0 force-pushed the fix-navigator-utils-cross-imports branch from d47cab6 to d155f4e Compare April 2, 2026 08:48
@xfce0
Copy link
Copy Markdown
Contributor Author

xfce0 commented Apr 2, 2026

Done, retargeted to master. Thank you!

@xfce0
Copy link
Copy Markdown
Contributor Author

xfce0 commented Apr 3, 2026

Rebased onto the latest master.

justinmc
justinmc previously approved these changes Apr 3, 2026
Copy link
Copy Markdown
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

LGTM 👍

victorsanni
victorsanni previously approved these changes Apr 4, 2026
@victorsanni victorsanni added the CICD Run CI/CD label Apr 4, 2026
Sort directive sections alphabetically: parent-relative imports
before local imports.
@xfce0 xfce0 dismissed stale reviews from justinmc and victorsanni via f9369bf April 4, 2026 06:26
@xfce0 xfce0 force-pushed the fix-navigator-utils-cross-imports branch from b42aa43 to f9369bf Compare April 4, 2026 06:26
@github-actions github-actions bot removed the CICD Run CI/CD label Apr 4, 2026
@xfce0
Copy link
Copy Markdown
Contributor Author

xfce0 commented Apr 4, 2026

Fixed the analyzer failure — import ordering was wrong in tab_scaffold_test.dart (parent-relative import was placed after a local import).

@victorsanni victorsanni requested a review from justinmc April 7, 2026 17:07
@victorsanni victorsanni added the CICD Run CI/CD label Apr 7, 2026
Copy link
Copy Markdown
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@justinmc justinmc added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 7, 2026
@flutter-dashboard
Copy link
Copy Markdown

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 #184282 at sha 582d4fe

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Apr 7, 2026
@xfce0
Copy link
Copy Markdown
Contributor Author

xfce0 commented Apr 8, 2026

The golden changes are unrelated to this PR. This PR only modifies import paths (replacing ../widgets/navigator_utils.dart with a local copy) and does not touch any UI code or rendering logic. Neither sheet_test.dart nor tab_scaffold_test.dart contain any matchesGoldenFile calls, so we could not have caused these golden differences. They appear to be upstream drift picked up when CI ran the full cupertino test suite against our branch.

@victorsanni victorsanni added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Apr 8, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Apr 8, 2026
Merged via the queue into flutter:master with commit 94ab182 Apr 8, 2026
84 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2026
@xfce0 xfce0 deleted the fix-navigator-utils-cross-imports branch April 8, 2026 20:38
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Apr 9, 2026
flutter/flutter@05e0ae0...81c87ea

2026-04-09 katelovett@google.com Remove last material dependency from cupertino tests (flutter/flutter#184781)
2026-04-09 engine-flutter-autoroll@skia.org Roll Skia from 7c46cb639dba to 4d0f5389e131 (7 revisions) (flutter/flutter#184812)
2026-04-09 goderbauer@google.com Make `windowing_test` follow repo analyzer rules (flutter/flutter#184752)
2026-04-09 116356835+AbdeMohlbi@users.noreply.github.com Improve documentation of `frictionFactor` function (flutter/flutter#184509)
2026-04-09 engine-flutter-autoroll@skia.org Roll Skia from d2b0bd12576a to 7c46cb639dba (1 revision) (flutter/flutter#184796)
2026-04-09 engine-flutter-autoroll@skia.org Roll Fuchsia GN SDK from JLBh4Z9PKsjIJcqDU... to SEfYx3xgueX3aFAY3... (flutter/flutter#184797)
2026-04-09 katelovett@google.com Fixed freeze flow (flutter/flutter#184793)
2026-04-09 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#184795)
2026-04-09 engine-flutter-autoroll@skia.org Roll Skia from e9ed4fc9f154 to d2b0bd12576a (36 revisions) (flutter/flutter#184791)
2026-04-08 43054281+camsim99@users.noreply.github.com [Android] Allow sensitive content to gracefully fail when unregistering host before registering (flutter/flutter#184789)
2026-04-08 34465683+rkishan516@users.noreply.github.com Refactor: remove material from autocomplete_test, scrollable_restoration_test, semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test (flutter/flutter#184615)
2026-04-08 jmccandless@google.com Warn about the use of TestSemantics (flutter/flutter#184369)
2026-04-08 katelovett@google.com Change freeze flow to pull_request_target (flutter/flutter#184785)
2026-04-08 1063596+reidbaker@users.noreply.github.com Update to the beta dart version for 3.44 branch cut.  (flutter/flutter#184770)
2026-04-08 737941+loic-sharma@users.noreply.github.com [Dot shorthands] Migrate examples/api/test (flutter/flutter#183966)
2026-04-08 rmacnak@google.com [fuchsia] Give AOT runners the ability to copy FFI callback thunks. (flutter/flutter#184696)
2026-04-08 victorsanniay@gmail.com Add await or ignore lint to invokeMethod callsites (flutter/flutter#182870)
2026-04-08 robert.ancell@canonical.com Correctly handle failure to read /proc/self/exe link (flutter/flutter#184700)
2026-04-08 engine-flutter-autoroll@skia.org Roll Skia from e264d870a380 to e9ed4fc9f154 (11 revisions) (flutter/flutter#184713)
2026-04-08 engine-flutter-autoroll@skia.org Roll Packages from 5299279 to 0e0a032 (5 revisions) (flutter/flutter#184720)
2026-04-08 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#184772)
2026-04-08 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 1rcChbOv4nSTVkUxs... to pDXMXRIjEHTw7B0sk... (flutter/flutter#184722)
2026-04-08 73785960+xfce0@users.noreply.github.com Remove navigator_utils cross-imports from cupertino tests (flutter/flutter#184282)
2026-04-08 victorsanniay@gmail.com Even more awaits v2 (flutter/flutter#184552)
2026-04-08 15619084+vashworth@users.noreply.github.com Allow personal skills to be gitignored (flutter/flutter#184727)
2026-04-08 dacoharkes@google.com [ci] mac_arm64 build_test re-enable shard 1 presubmit (flutter/flutter#184751)
2026-04-08 katelovett@google.com Fix repo check on code freeze (flutter/flutter#184771)

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

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
mbcorona pushed a commit to mbcorona/flutter that referenced this pull request Apr 15, 2026
…4282)

Removes cross-directory test imports of `navigator_utils.dart` from
cupertino tests.

Part of flutter#182636.

`simulateSystemBack` is a small (18-line) single-function utility, so
duplication is the appropriate strategy per the issue guidelines. The
file is copied into `test/cupertino/`, and both imports are
updated to reference the local copy.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD f: cupertino flutter/packages/flutter/cupertino repository f: routes Navigator, Router, and related APIs. framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files

Projects

Development

Successfully merging this pull request may close these issues.

4 participants