Add TestWidgetsApp utility and refactor widget tests to use WidgetsApp#180456
Add TestWidgetsApp utility and refactor widget tests to use WidgetsApp#180456auto-submit[bot] merged 14 commits intoflutter:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a TestWidgetsApp utility to provide a minimal WidgetsApp for widget tests. Several test files have been refactored to use this new utility, replacing heavier widgets like MaterialApp, Scaffold, and Directionality. This simplifies the test setup and removes dependencies on the Material library. My review includes some suggestions to further improve the code by adding const modifiers for performance.
| feedback: Container(width: 20, height: 20, color: const Color(0xFF2196F3)), | ||
| childWhenDragging: Container( | ||
| width: 20, | ||
| height: 20, | ||
| color: const Color(0xFFFFEB3B), | ||
| ), |
There was a problem hiding this comment.
For better performance, you can make these Container widgets const.
| feedback: Container(width: 20, height: 20, color: const Color(0xFF2196F3)), | |
| childWhenDragging: Container( | |
| width: 20, | |
| height: 20, | |
| color: const Color(0xFFFFEB3B), | |
| ), | |
| feedback: const Container(width: 20, height: 20, color: Color(0xFF2196F3)), | |
| childWhenDragging: const Container( | |
| width: 20, | |
| height: 20, | |
| color: Color(0xFFFFEB3B), | |
| ), |
| opacity: 0.5, | ||
| child: Padding( | ||
| padding: EdgeInsets.all(5.0), | ||
| child: ColoredBox(color: Color(0xFF2196F3), child: SizedBox(height: 50)), |
There was a problem hiding this comment.
Not necessary because Opacity is already const.
| child: ColoredBox( | ||
| color: Color(0xFFF44336), | ||
| child: SizedBox(height: 100, width: 100), | ||
| ), |
There was a problem hiding this comment.
1899505 to
13c5da3
Compare
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return WidgetsApp( |
There was a problem hiding this comment.
I ran into an issue writing tests with WidgetsApp whenever a descendant widget tries to insert an OverlayEntry into the root overlay because (I think) WidgetsApp doesn't create an Overlay by default unlike Material/CupertinoApp. This was the workaround:
WidgetsApp(
...
pageRouteBuilder: <T>(RouteSettings settings, WidgetBuilder builder) {
return PageRouteBuilder<T>(
pageBuilder:
(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
) => builder(context),
);
},
);Maybe we can add this here as well so others don't run into this problem.
There was a problem hiding this comment.
Sure, I have added it.
There was a problem hiding this comment.
Good catch. I also noticed that there is a test above that includes an Overlay now. Does this change here help? Or should we add an Overlay here so we don't need to include it in the test?
There was a problem hiding this comment.
In #180990 I also wanted to add a WidgetsApp for testing, which used a pageBuilder (not a pageRouteBuilder), but I suppose the code sample here is equivalent? (since it uses a stub PageRouteBuilder() )
Also, the child can be renamed to home and passed to WidgetsApp(home: home) ?
There was a problem hiding this comment.
Good catch. I also noticed that there is a test above that includes an Overlay now. Does this change here help? Or should we add an Overlay here so we don't need to include it in the test?
@justinmc I think we can add Overlay here, which will help in multiple instances.
There was a problem hiding this comment.
In #180990 I also wanted to add a WidgetsApp for testing, which used a pageBuilder (not a pageRouteBuilder), but I suppose the code sample here is equivalent? (since it uses a stub PageRouteBuilder() )
Yes , its equivalent.
Also, the child can be renamed to home and passed to WidgetsApp(home: home) ?
Sure, can do.
13c5da3 to
ecc857b
Compare
ecc857b to
49ee104
Compare
There was a problem hiding this comment.
Thanks for jumping on this! This is basically what I had in mind for TestWidgetsApp.
Looks good minus a few nits, but I see that there is a leak in text_field_test strangely. @rkishan516 any idea what would trigger that?
| return tester.pumpWidget( | ||
| Directionality( | ||
| textDirection: TextDirection.ltr, | ||
| TestWidgetsApp( |
There was a problem hiding this comment.
Good catch that we can get rid of cases where Directionality is used instead of a WidgetsApp, I didn't think of that.
There was a problem hiding this comment.
Yup, it will make widgets/ test lookwise more consistent.
There was a problem hiding this comment.
I'm worried that replacing Directionality means bugs with TestWidgetsApp can propagate across the codebase. Or am I looking at this the wrong way? i.e If there is a bug with TestWidgetsApp (or its underlying widgets) that hasn't already been caught, using TestWidgetsApp everywhere stress tests it, making any bugs more likely to be caught?
There was a problem hiding this comment.
Since we have many test already, any change in TestWidgetsApp will be stress tested. But something that is not covered in these tests and newly added can be a reason to introduce bug. So, IMO its 50-50 on both side.
| color: Colors.blue, | ||
| color: const Color(0xFF2196F3), |
There was a problem hiding this comment.
We may consider adding a TestColorBlue or something like that in the future, but this is fine for now. I'm not yet convinced we want to do that.
There was a problem hiding this comment.
Drive by comment: what about const Color(0xFF0000FF) ? I don't think the r,g channels matter here.
There was a problem hiding this comment.
I personally prefer using easier colors (e.g colors with only one channel, completely transparent etc). Using colors like above can be confusing to someone reading the code who might then think the complexity of the color is an indicator that it serves a non-trivial purpose.
There was a problem hiding this comment.
Updated to single channel colors.
| feedback: Container(width: 20, height: 20, color: const Color(0xFF2196F3)), | ||
| childWhenDragging: Container( | ||
| width: 20, | ||
| height: 20, | ||
| color: const Color(0xFFFFEB3B), | ||
| ), |
| MaterialApp( | ||
| home: Center( | ||
| child: Draggable<int>( | ||
| feedback: Container(width: 20, height: 20, color: Colors.blue), | ||
| childWhenDragging: Container(width: 20, height: 20, color: Colors.yellow), | ||
| child: ElevatedButton(child: const Text('Drag me'), onPressed: () {}), | ||
| ), | ||
| TestWidgetsApp( | ||
| child: Overlay( |
There was a problem hiding this comment.
Should we consider adding Overlay to TestWidgetsApp or do you think that's overkill when it's not needed?
There was a problem hiding this comment.
It has it's pro and con, for now I have added. I feel its not adding any problems to other tests(currently) + reducing boilerplate.
There was a problem hiding this comment.
Nvm, its complicating TestWidgetApp and tests both. So, keeping both separated.
| opacity: 0.5, | ||
| child: Padding( | ||
| padding: EdgeInsets.all(5.0), | ||
| child: ColoredBox(color: Color(0xFF2196F3), child: SizedBox(height: 50)), |
There was a problem hiding this comment.
Not necessary because Opacity is already const.
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return WidgetsApp( |
There was a problem hiding this comment.
Good catch. I also noticed that there is a test above that includes an Overlay now. Does this change here help? Or should we add an Overlay here so we don't need to include it in the test?
49ee104 to
6828e77
Compare
I will look at it. There is no change in text_field_test specific file. |
7ac2a4b to
4feb18e
Compare
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| /// @docImport 'package:flutter/cupertino.dart'; |
There was a problem hiding this comment.
@justinmc Are doc imports allowed? When Material and Cupertino are split off, this will cause comment_references warnings.
Apparently that lint is not yet enabled, see https://github.com/flutter/flutter/blob/master/analysis_options.yaml#L95
but once the linked issue is fixed and the lint is enabled, this will be an issue.
There was a problem hiding this comment.
Good catch. It looks like there are a couple other similar docImports around flutter_test (example). I say we keep this as-is for now. If we need to migrate it in when we decouple, we can migrate this one too.
I will write this down as something to figure out before decoupling.
There was a problem hiding this comment.
Maybe we should add a sub issue to the umbrella of the cross imports project where we
- update the check you wrote for regular dependencies, to handle
@docImportprefixes as well - update the items list with the results of checking doc imports
- Either clean up doc imports in the same issue as for the regular ones, or split that off (since this is only an issue once the lint is enabled, which could happen post split anyway?)
| Widget build(BuildContext context) { | ||
| return WidgetsApp( | ||
| color: color, | ||
| builder: (BuildContext context, Widget? navigatorChild) { |
There was a problem hiding this comment.
@rkishan516 The home parameter should be passed to WidgetsApp.home in the constructor, to match what WidgetsApp does.
I'm also not sure if builder: (BuildContext context, Widget? navigatorChild) {...} is needed for anything specific in tests? Can we remove builder ?
There was a problem hiding this comment.
No, builder is not need in current version. I will update to use WidgetApp.home rather than builder.
4feb18e to
c8a2bca
Compare
…st.dart (#180996) This PR removes the MaterialButtons and Divider from test/widgets/draggable_scrollable_sheet_test.dart I also replaced some usages of WidgetsApp that did not use `WidgetsApp(home: home)` with MaterialApp. These usages can be replaced once #180456 provides `TestWidgetsApp`. Part of #177415 Part of #180501 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [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. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
c8a2bca to
a3240b4
Compare
…st.dart (flutter#180996) This PR removes the MaterialButtons and Divider from test/widgets/draggable_scrollable_sheet_test.dart I also replaced some usages of WidgetsApp that did not use `WidgetsApp(home: home)` with MaterialApp. These usages can be replaced once flutter#180456 provides `TestWidgetsApp`. Part of flutter#177415 Part of flutter#180501 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [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. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
justinmc
left a comment
There was a problem hiding this comment.
Looks good but I want to be sure about putting this in flutter_test (comment below).
There was a problem hiding this comment.
I just realized this is in flutter_test. We've been putting utils like this in utils files in test/widgets (example). But I see the advantage here, by putting it in flutter_test you allow our users to use this in their tests too.
@Renzo-Olivares I wonder if you thought about this at all when you wrote TestTextField?
There was a problem hiding this comment.
I talked to @Renzo-Olivares offline, and this same discussion came up in that PR: https://github.com/flutter/flutter/pull/180494/files#r2677591418
I think I agree with that argument. So this should go in the tests/ directory for now, but we should document it very well (as you have already done) and consider moving it to flutter_test in the future when the API is more proven.
There was a problem hiding this comment.
Cool, I will move it to tests/. Should we create a issue for moving these to flutter_test?
There was a problem hiding this comment.
Good idea, here you go: #181283
Maybe add it as a TODO next to the declaration of TestWidgetsApp.
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| /// @docImport 'package:flutter/cupertino.dart'; |
There was a problem hiding this comment.
Good catch. It looks like there are a couple other similar docImports around flutter_test (example). I say we keep this as-is for now. If we need to migrate it in when we decouple, we can migrate this one too.
I will write this down as something to figure out before decoupling.
7650bb0 to
61885d1
Compare
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
The goldens were slight color changes, I've approved them. |
Roll Flutter from da72d5936d69 to 1d9d6a9a5ef6 (33 revisions) flutter/flutter@da72d59...1d9d6a9 2026-01-30 [email protected] enable enhanced debugging for GLES playground (flutter/flutter#181157) 2026-01-30 [email protected] Make the Windows windowing_test in .ci.yaml have bringup as false (flutter/flutter#181664) 2026-01-30 [email protected] Roll Packages from cd4fd61 to 510dd40 (4 revisions) (flutter/flutter#181726) 2026-01-30 [email protected] Roll Skia from edbf7e9eb846 to 4745eb2fe837 (1 revision) (flutter/flutter#181725) 2026-01-30 [email protected] Enhance error handling of WidgetsBindingObserver callbacks (flutter/flutter#181174) 2026-01-30 [email protected] Roll Skia from 05d3cb9d2be9 to edbf7e9eb846 (2 revisions) (flutter/flutter#181715) 2026-01-30 [email protected] Roll Skia from c198e5fa9cd9 to 05d3cb9d2be9 (1 revision) (flutter/flutter#181712) 2026-01-30 [email protected] Roll Dart SDK from 920b7e24583e to 2703fd9733ce (2 revisions) (flutter/flutter#181693) 2026-01-30 [email protected] Roll Skia from b9f40c193e7a to c198e5fa9cd9 (6 revisions) (flutter/flutter#181692) 2026-01-30 [email protected] Roll pub packages (flutter/flutter#181690) 2026-01-30 [email protected] Extend the Windows tool_integration_tests_2_9 shard timeout to 1 hour (flutter/flutter#181678) 2026-01-29 [email protected] Add `android_sdk` dependency to `android_engine_opengles_tests` (flutter/flutter#181681) 2026-01-29 [email protected] Roll Dart SDK from a0685c8e946b to 920b7e24583e (3 revisions) (flutter/flutter#181680) 2026-01-29 [email protected] Roll Skia from 128b5213711e to b9f40c193e7a (14 revisions) (flutter/flutter#181675) 2026-01-29 [email protected] [Impeller] Ensure that HostBuffers/DeviceBuffers allocated by RendererTest tests are valid for the lifetime of the RenderPass (flutter/flutter#181635) 2026-01-29 [email protected] [Impeller] Fix off-by-one indices in the SimilarPointPair/SimilarPointTrio functions used by ShadowPathGeometryTest (flutter/flutter#181623) 2026-01-29 [email protected] 180162 fix radio list tile and switch list tile accept widget states controller (flutter/flutter#180367) 2026-01-29 [email protected] Remove unused test file (flutter/flutter#181671) 2026-01-29 [email protected] Roll libpng to version 1.6.54 (flutter/flutter#181625) 2026-01-29 [email protected] Remove nonstandard ndkpath for `hybrid_android_views` integration test (flutter/flutter#181666) 2026-01-29 [email protected] Add TestWidgetsApp utility and refactor widget tests to use WidgetsApp (flutter/flutter#180456) 2026-01-29 [email protected] Add `TestTextField` and migrate tests (flutter/flutter#180494) 2026-01-29 [email protected] Merge changelog for 3.38.9 (flutter/flutter#181668) 2026-01-29 [email protected] [flutter_tools] Deprecate `plugin_ffi` template (flutter/flutter#181588) 2026-01-29 [email protected] Deprecate onReorder callback (flutter/flutter#178242) 2026-01-29 [email protected] [web] Use defensive null check in text editing placeElement (flutter/flutter#180795) 2026-01-29 [email protected] Roll Packages from 1cb2148 to cd4fd61 (4 revisions) (flutter/flutter#181663) 2026-01-29 [email protected] Roll Skia from 89df65f8324c to 128b5213711e (2 revisions) (flutter/flutter#181651) 2026-01-29 [email protected] [hooks] Don't run build hooks for code assets in `flutter run` (flutter/flutter#181542) 2026-01-29 [email protected] Roll Dart SDK from f10dcbfca98f to a0685c8e946b (5 revisions) (flutter/flutter#181653) 2026-01-29 [email protected] Fixes getUniformX for Vulkan (flutter/flutter#181286) 2026-01-29 [email protected] Roll Fuchsia Linux SDK from adhoq9ouVRh0xzkm3... to isy1ARvK-3bsvtfc-... (flutter/flutter#181641) 2026-01-29 [email protected] Add isDark, isLight, and isSystem getters to ThemeMode (flutter/flutter#181475) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: ...
flutter#180456) This PR introduces a TestWidgetsApp utility class that provides a minimal WidgetsApp wrapper for widget tests, replacing direct usage of Directionality widgets. part of: flutter#177415 ## Changes - test_widgets_app.dart - A reusable TestWidgetsApp widget that wraps WidgetsApp with a builder pattern, providing Directionality, MediaQuery, and other app-level widgets that WidgetsApp provides. - gesture_detector_test.dart - Replaced 9 Directionality usages - mouse_region_test.dart - Replaced 13 Directionality usages - opacity_test.dart - Replaced 2 Directionality usages - slivers_evil_test.dart - Replaced 3 Directionality usages and removed redundant MediaQuery wrappers ## Note - This PR updates golden test baselines for opacity_test.dart. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] 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]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing.
…st.dart (flutter#180996) This PR removes the MaterialButtons and Divider from test/widgets/draggable_scrollable_sheet_test.dart I also replaced some usages of WidgetsApp that did not use `WidgetsApp(home: home)` with MaterialApp. These usages can be replaced once flutter#180456 provides `TestWidgetsApp`. Part of flutter#177415 Part of flutter#180501 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [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. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
flutter#180456) This PR introduces a TestWidgetsApp utility class that provides a minimal WidgetsApp wrapper for widget tests, replacing direct usage of Directionality widgets. part of: flutter#177415 ## Changes - test_widgets_app.dart - A reusable TestWidgetsApp widget that wraps WidgetsApp with a builder pattern, providing Directionality, MediaQuery, and other app-level widgets that WidgetsApp provides. - gesture_detector_test.dart - Replaced 9 Directionality usages - mouse_region_test.dart - Replaced 13 Directionality usages - opacity_test.dart - Replaced 2 Directionality usages - slivers_evil_test.dart - Replaced 3 Directionality usages and removed redundant MediaQuery wrappers ## Note - This PR updates golden test baselines for opacity_test.dart. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] 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]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing.
flutter#180456) This PR introduces a TestWidgetsApp utility class that provides a minimal WidgetsApp wrapper for widget tests, replacing direct usage of Directionality widgets. part of: flutter#177415 ## Changes - test_widgets_app.dart - A reusable TestWidgetsApp widget that wraps WidgetsApp with a builder pattern, providing Directionality, MediaQuery, and other app-level widgets that WidgetsApp provides. - gesture_detector_test.dart - Replaced 9 Directionality usages - mouse_region_test.dart - Replaced 13 Directionality usages - opacity_test.dart - Replaced 2 Directionality usages - slivers_evil_test.dart - Replaced 3 Directionality usages and removed redundant MediaQuery wrappers ## Note - This PR updates golden test baselines for opacity_test.dart. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] 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]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing.
This PR introduces a TestWidgetsApp utility class that provides a minimal WidgetsApp wrapper for widget tests, replacing direct usage of Directionality widgets.
part of: #177415
Changes
Note
Pre-launch Checklist
///).