Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes single window assumptions from flutter_test #121549

Merged
merged 3 commits into from
Mar 6, 2023

Conversation

pdblasi-google
Copy link
Contributor

@pdblasi-google pdblasi-google commented Feb 27, 2023

  • Adds TestFlutterView to wrap FlutterView and allow modification of properties for testing
  • Updates TestPlatformDispatcher to wrap its views in TestFlutterViews when they are changed
  • Adds viewOf to WidgetController for finding a TestFlutterView related to the results of a Finder
  • Exposes platformDispatcher and implicitView from WidgetController (and WidgetTester)
    • This is so the related viewOf method, which uses the Finder API, will be in a consistent place with these methods and other Finder APIs

Resolves #117481

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.

@flutter-dashboard flutter-dashboard bot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. labels Feb 27, 2023
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/test/controller_test.dart Outdated Show resolved Hide resolved
@flutter-dashboard flutter-dashboard bot added f: focus Focus traversal, gaining or losing focus f: material design flutter/packages/flutter/material repository. labels Mar 1, 2023
packages/flutter_test/lib/src/binding.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/binding.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/binding.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/binding.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

This is looking pretty nicely!

packages/flutter_test/lib/src/controller.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/controller.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/test/window_test.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
@goderbauer
Copy link
Member

Oh, one more thing: I seemed to recall that we considered whether we should auto-reset the testvalues on the TestFlutterView (and ideally TestFlutterPlatformDispatcher) between tests. Did you decide against doing that or did I just miss it?

@pdblasi-google
Copy link
Contributor Author

Oh, one more thing: I seemed to recall that we considered whether we should auto-reset the testvalues on the TestFlutterView (and ideally TestFlutterPlatformDispatcher) between tests. Did you decide against doing that or did I just miss it?

I plan on doing that work in a separate PR. I want to do a revamp of how the testWidgets method does its setup and teardown to make it more consistent with the regular test framework. I'm not sure what to do with it in the meantime, but I'm leaning towards leaving it be and letting users forget to reset and solve the resetting issues themselves as needed.

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

image

packages/flutter_test/lib/src/window.dart Outdated Show resolved Hide resolved
* Adds `TestFlutterView` to wrap `FlutterView` and allow modification of properties for testing
* Updates `TestPlatformDispatcher` to wrap its views in `TestFlutterView`s when they are changed
* Adds `viewOf` to `WidgetController` for finding a `TestFlutterView` related to the results of a `Finder`
* Exposes `platformDispatcher` and `view` from `WidgetController` (and `WidgetTester`)
  * This is so the related `viewOf` method, which uses the `Finder` API, will be in a consistent place with these methods and other `Finder` APIs
@pdblasi-google pdblasi-google added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 6, 2023
@auto-submit auto-submit bot merged commit f2dd19d into flutter:master Mar 6, 2023
pdblasi-google added a commit that referenced this pull request Mar 6, 2023
thkim1011 pushed a commit that referenced this pull request Mar 6, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 8, 2023
Comment on lines -932 to -933
@override
ui.FrameData get frameData => _platformDispatcher.frameData;
Copy link
Member

Choose a reason for hiding this comment

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

I believe the accidental deletion of this getter caused b/272195069.

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 autosubmit Merge PR when tree becomes green via auto submit App f: focus Focus traversal, gaining or losing focus f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Refactor TestWindow and TestWidgetsFlutterBinding.window for multi-window world
2 participants