Skip to content

Move heroes_test.dart from widgets to material directory#181266

Closed
kazbeksultanov wants to merge 1 commit into
flutter:masterfrom
kazbeksultanov:fix-move-heroes-test-to-material
Closed

Move heroes_test.dart from widgets to material directory#181266
kazbeksultanov wants to merge 1 commit into
flutter:masterfrom
kazbeksultanov:fix-move-heroes-test-to-material

Conversation

@kazbeksultanov

Copy link
Copy Markdown
Contributor

Heroes tests test Material-specific hero animation behavior (MaterialApp, Scaffold, MaterialPageRoute, Card). These Material-specific tests belong in the material test directory, not widgets.

This change:

  • Moves packages/flutter/test/widgets/heroes_test.dart to packages/flutter/test/material/
  • Removes heroes_test.dart from the knownWidgetsCrossImports list in check_tests_cross_imports.dart

This is part of issue #177414 to organize tests in the library they're testing.

Pre-launch Checklist

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

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Heroes tests test Material-specific hero animation behavior (MaterialApp, Scaffold,
MaterialPageRoute, Card). These Material-specific tests belong in the material test
directory, not widgets.

This change:
- Moves packages/flutter/test/widgets/heroes_test.dart to packages/flutter/test/material/
- Removes heroes_test.dart from the knownWidgetsCrossImports list in check_tests_cross_imports.dart

This is part of issue flutter#177414 to organize tests in the library they're testing.
@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Jan 21, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request moves the heroes_test.dart file from packages/flutter/test/widgets/ to packages/flutter/test/material/. As a result of this move, the path to this test file is removed from the knownWidgetsCrossImports set in dev/bots/check_tests_cross_imports.dart. The changes are straightforward and correctly implement the file relocation. I have reviewed the changes and have no issues to report.

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.

Merely "moving" the file does not address this issue. The file also imports Cupertino, which is also not allowed.

A Hero animation is not Material specific, so the proper fix is to replace Material specific widgets in this file with their flutter/widgets counterpart.

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.

+1. This is a big test file, there may be some tests that truly do test Material or Cupertino explicitly and should be moved, but we should try to keep Hero tests in Widgets if possible.

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.

Let me start with a smaller file and I will need here TestTextField and TestWidgetsApp. But will try to figure our other way how can we do it

@dkwingsmt

Copy link
Copy Markdown
Contributor

Hi @kazbeksultanov, how's this PR going? Are you still interested in finishing this PR? Thanks for the contribution so far! (from triage)

@dkwingsmt

Copy link
Copy Markdown
Contributor

Thanks for your contribution! Since I haven't seen a reply, I'm going to reluctantly close this pull request for now, but if you get time to address the comments, we'd be more than happy to take a look at a new patch. If you do send a new patch, it would be very useful to reference this one in the description in order to help reviewers see the previous context.

@dkwingsmt dkwingsmt closed this Apr 8, 2026
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Test cross-imports Review Queue Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

Development

Successfully merging this pull request may close these issues.

5 participants