Skip to content

Removes single window assumptions from flutter_test - #121549

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
pdblasi-google:issues/117481
Mar 6, 2023
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
pdblasi-google:issues/117481

Conversation

@pdblasi-google

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

Copy link
Copy Markdown
Contributor
  • 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
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/test/controller_test.dart Outdated
Comment thread packages/flutter/test/widgets/container_test.dart Outdated
@flutter-dashboard flutter-dashboard Bot added f: focus Focus traversal, gaining or losing focus p: material_ui material_ui package in flutter/packages labels Mar 1, 2023
Comment thread packages/flutter/test/widgets/container_test.dart Outdated
Comment thread packages/flutter_test/lib/src/binding.dart Outdated
Comment thread packages/flutter_test/lib/src/binding.dart Outdated
Comment thread packages/flutter_test/lib/src/binding.dart Outdated
Comment thread packages/flutter_test/lib/src/binding.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

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!

Comment thread packages/flutter_test/lib/src/controller.dart Outdated
Comment thread packages/flutter_test/lib/src/controller.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/test/window_test.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
Comment thread packages/flutter_test/lib/src/window.dart Outdated
@goderbauer

Copy link
Copy Markdown
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
Copy Markdown
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.

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

image

Comment thread packages/flutter_test/lib/src/window.dart Outdated
* 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
Copy Markdown
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.

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 May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
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 framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Refactor TestWindow and TestWidgetsFlutterBinding.window for multi-window world

2 participants