Skip to content

Remove feedback_tester cross-imports from material tests#184279

Open
xfce0 wants to merge 3 commits into
flutter:masterfrom
xfce0:fix-feedback-tester-cross-imports
Open

Remove feedback_tester cross-imports from material tests#184279
xfce0 wants to merge 3 commits into
flutter:masterfrom
xfce0:fix-feedback-tester-cross-imports

Conversation

@xfce0

@xfce0 xfce0 commented Mar 28, 2026

Copy link
Copy Markdown
Contributor

Part of #182636.

FeedbackTester is a small (51-line) test utility with a trivial implementation, so duplication is the appropriate strategy per the issue guidelines. The file is copied into test/material/, and all
17 imports are updated to reference the local copy.

Pre-launch Checklist

@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: material design flutter/packages/flutter/material repository. labels Mar 28, 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 relocates the FeedbackTester utility to the material test directory and updates import paths in several Material component tests. Feedback includes adding documentation to the FeedbackTester constructor to meet style guide requirements and refactoring the method handler to a switch statement for improved readability.

/// It replaces the MockMethodCallHandler of [SystemChannels.platform] and
/// cannot be used in combination with other classes that do the same.
class FeedbackTester {
FeedbackTester() {

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

The public constructor is missing a documentation comment. According to the repository style guide, all public members should have documentation.

Suggested change
FeedbackTester() {
/// Creates a [FeedbackTester] that tracks feedback requests.
///
/// The [dispose] method must be called when the tester is no longer needed.
FeedbackTester() {
References
  1. All public members should have documentation. (link)

Comment on lines +28 to +36
Future<void> _handler(MethodCall methodCall) async {
if (methodCall.method == 'HapticFeedback.vibrate') {
_hapticCount++;
}
if (methodCall.method == 'SystemSound.play' &&
methodCall.arguments == SystemSoundType.click.toString()) {
_clickSoundCount++;
}
}

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

For improved readability and to avoid multiple string comparisons, consider refactoring the if statements into a switch statement on methodCall.method.

  Future<void> _handler(MethodCall methodCall) async {
    switch (methodCall.method) {
      case 'HapticFeedback.vibrate':
        _hapticCount++;
        break;
      case 'SystemSound.play':
        if (methodCall.arguments == SystemSoundType.click.toString()) {
          _clickSoundCount++;
        }
        break;
    }
  }

@victorsanni

Copy link
Copy Markdown
Contributor

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

victorsanni
victorsanni previously approved these changes Apr 1, 2026
///
/// It replaces the MockMethodCallHandler of [SystemChannels.platform] and
/// cannot be used in combination with other classes that do the same.
class FeedbackTester {

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.

Are there tests for this class that need to be duplicated as well?

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.

Hello, thank you for your reply! No, FeedbackTester doesn't have its own dedicated tests — it's a test utility validated implicitly by the tests that use it. feedback_test.dart in test/widgets/ tests the Feedback widget (forTap, forLongPress), not the FeedbackTester class itself. So no test duplication is needed here

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.

Looks like that's right, I don't see any tests for FeedbackTester itself.

@xfce0 xfce0 changed the base branch from main to master April 2, 2026 08:39
@xfce0 xfce0 dismissed victorsanni’s stale review April 2, 2026 08:39

The base branch was changed.

@xfce0

xfce0 commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

Retargeted to master and rebased onto the latest commit. Thanks for the heads up!

justinmc
justinmc previously approved these changes Apr 3, 2026

@justinmc justinmc 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 👍

///
/// It replaces the MockMethodCallHandler of [SystemChannels.platform] and
/// cannot be used in combination with other classes that do the same.
class FeedbackTester {

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.

Looks like that's right, I don't see any tests for FeedbackTester itself.

victorsanni
victorsanni previously approved these changes Apr 3, 2026
@victorsanni

Copy link
Copy Markdown
Contributor

Hi @xfce0, can you resolve the merge conflict in this PR?

@xfce0 xfce0 dismissed stale reviews from victorsanni and justinmc via 6681e01 April 4, 2026 05:39
@xfce0 xfce0 force-pushed the fix-feedback-tester-cross-imports branch from 7b5329b to 6681e01 Compare April 4, 2026 05:39
@xfce0

xfce0 commented Apr 4, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest master — the conflict was in text_field_test.dart due to the merged live_text_utils PR (#184517)

@victorsanni victorsanni added the CICD Run CI/CD label Apr 7, 2026
victorsanni
victorsanni previously approved these changes Apr 7, 2026
@victorsanni victorsanni requested a review from justinmc April 7, 2026 17:14
justinmc
justinmc previously approved these changes Apr 7, 2026

@justinmc justinmc 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 👍

@justinmc

justinmc commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

And another analyzer failure @xfce0

@xfce0 xfce0 dismissed stale reviews from justinmc and victorsanni via 7e5596e April 7, 2026 19:34
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 7, 2026
@xfce0 xfce0 force-pushed the fix-feedback-tester-cross-imports branch from 7e5596e to 7e22ee5 Compare April 8, 2026 07:42
@dkwingsmt dkwingsmt added the CICD Run CI/CD label Apr 15, 2026
@Piinks Piinks added the CICD Run CI/CD label May 27, 2026
@xfce0

xfce0 commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

Hi @justinmc @victorsanni — all CI checks are now passing (87 checks green). Could you please re-review when you have a moment? Thanks!

@justinmc justinmc 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.

Similar to #184278, could you undo the formatting changes? The formatting check is now disabled while we sort that out.

@Renzo-Olivares Renzo-Olivares added the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label Jun 18, 2026
@Piinks Piinks added Decoupling: Port to flutter/packages This PR is ready to be ported to flutter/packages. We will provide instructions to do so. Decoupling: Pre-release This PR is needed for pre-release of material_ui and cupertino_ui and removed override code freeze Override an active code freeze. labels Jun 24, 2026
@Piinks

Piinks commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This PR is ready to be ported over to flutter/packages in the new material_ui package!
Instructions for porting this PR over can be found in #188444 along with an example.

This PR is also necessary for pre-release of the material_ui package. If you are unable to work on this right now, no worries! We’ll go ahead and port it over to get it landed. Your contribution is greatly appreciated. 💙

auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jun 25, 2026
…rt`, `app_bar_sliver_test.dart` and partial fix in `chip_test.dart` (#12004)

Part of flutter/flutter#182636 and flutter/flutter#188395

This PR:
* Removed the cross-import of `widgets/semantics_tester.dart`.
* Removed @Skip tag, all tests in this file has passed. `semantics_tester.dart` has existed in material_ui, so we can directly import `semantics_tester.dart`;
* Moved the file to `test/` folder.

Note: `chip_test.dart` only partially remove the widgets/ dependency and still stay in `temporarily_disabled_tests` folder. Once flutter/flutter#184279 is ported over, this file can be move out of the folder.

## Pre-Review Checklist
elliette added a commit to flutter/packages that referenced this pull request Jun 25, 2026
Port over `bottom_navigation_bar_test` from
flutter/flutter#184279
* Ports over `feedback_tester.dart`
* Ports over `bottom_navigation_bar_test` 

As part of this change, moved `_findByTooltip` (originally defined in
`navigation_bar_test`) into new shared `test/finders.dart` (see
flutter/flutter#186966 for details).

Work towards flutter/flutter#182636 and
flutter/flutter#188395

## Pre-Review 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] page, which explains my
responsibilities.
- [x] I read and followed the [relevant style guides] and ran [the
auto-formatter].
- [x] I signed the [CLA].
- [x] The title of the PR starts with the name of the package surrounded
by square brackets, e.g. `[shared_preferences]`
- [x] I [linked to at least one issue that this PR fixes] in the
description above.
- [x] I followed [the version and CHANGELOG instructions], using
[semantic versioning] and the [repository CHANGELOG style], or I have
commented below to indicate which documented exception this PR falls
under[^1].
- [x] I updated/added any relevant documentation (doc comments with
`///`).
- [x] I added new tests to check the change I am making, or I have
commented below to indicate which [test exemption] this PR falls
under[^1].
- [x] All existing and new tests are passing.

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](https://developers.google.com/gemini-code-assist/docs/review-github-code).
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.

[^1]: Regular contributors who have demonstrated familiarity with the
repository guidelines only need to comment if the PR is not
auto-exempted by repo tooling.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/packages/blob/main/CONTRIBUTING.md
[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/master/docs/contributing/Tree-hygiene.md
[relevant style guides]:
https://github.com/flutter/packages/blob/main/CONTRIBUTING.md#style
[the auto-formatter]:
https://github.com/flutter/packages/blob/main/script/tool/README.md#format-code
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[linked to at least one issue that this PR fixes]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#overview
[the version and CHANGELOG instructions]:
https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#version-and-changelog-updates
[semantic versioning]:
https://dart.dev/tools/pub/versioning#semantic-versions
[repository CHANGELOG style]:
https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changelog-style
[test exemption]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD Decoupling: Port to flutter/packages This PR is ready to be ported to flutter/packages. We will provide instructions to do so. Decoupling: Pre-release This PR is needed for pre-release of material_ui and cupertino_ui f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds

Projects

Development

Successfully merging this pull request may close these issues.

8 participants