Skip to content

Conversation

@dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Apr 27, 2022

This PR removes an assertion at the end of unit tests that ensures all mouse pointers have been removed. Instead, the MouseTracker is directly renewed without checking so.

Moreover, this PR deleted all statements that remove mouse pointers at the of a test or schedule so. These changes are not really necessary, but are made nonetheless to verify that the change is safe.

This assertion (and subsequent pointer removal) was added in #32535 to solve an issue where mouse connection was leaked between tests. However this assertion doesn't feel needed for two reasons:

  1. Reconstructing MouseTracker should be enough to reset states, which has already been done.
  2. We should implicitly reset states if possible to reduce the requirement for test writers.

And it turns out that removing the code does not break any tests!

Moreover, this problem is also the cause for b/227634353: The developers have some tests for a web app that can be run in a real browser for debugging. And when they do, although these tests to not refer to mouse pointers at all, any movement of the real mouse will be captured by the tests, causing the test to throw for unremoved mouse pointers.

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.
  • All existing and new tests are passing.

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

@flutter-dashboard flutter-dashboard bot added a: tests "flutter test", flutter_test, or one of our tests 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: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Apr 27, 2022
@dkwingsmt dkwingsmt requested a review from gspencergoog April 27, 2022 22:54
Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

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

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

This will allow code which adds a pointer as a side effect to pass when it isn't explicitly removed. I don't think we currently have any code that does that, so it's probably OK, but we should be aware that we're trading test coding convenience for this possibility.

@goderbauer what do you think?

@dkwingsmt
Copy link
Contributor Author

dkwingsmt commented May 4, 2022

Once added, mouse devices are typically not removed until the end of the app, so "a test scenario that adds a pointer and never removes it" is actually close enough to the real case.

@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request May 21, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: tests "flutter test", flutter_test, or one of our tests a: text input Entering text in a text field or keyboard related problems c: contributor-productivity Team-specific productivity, code health, technical debt. f: cupertino flutter/packages/flutter/cupertino repository f: focus Focus traversal, gaining or losing focus f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants