Revert "Fix DPR in test view configuration (#88609)" (#88889)
This reverts commit 5feee0d8faec96872377b74a90fda0c1fc77930f.
diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart
index aeed740..8fdea90 100644
--- a/packages/flutter_test/lib/src/binding.dart
+++ b/packages/flutter_test/lib/src/binding.dart
@@ -1732,7 +1732,7 @@
TestViewConfiguration._(Size size, ui.FlutterView window)
: _paintMatrix = _getMatrix(size, window.devicePixelRatio, window),
_hitTestMatrix = _getMatrix(size, 1.0, window),
- super(size: size, devicePixelRatio: window.devicePixelRatio);
+ super(size: size);
static Matrix4 _getMatrix(Size size, double devicePixelRatio, ui.FlutterView window) {
final double inverseRatio = devicePixelRatio / window.devicePixelRatio;
diff --git a/packages/flutter_test/test/bindings_test.dart b/packages/flutter_test/test/bindings_test.dart
index 46b7b0a..c5a4b92 100644
--- a/packages/flutter_test/test/bindings_test.dart
+++ b/packages/flutter_test/test/bindings_test.dart
@@ -24,11 +24,6 @@
// The code below will throw without the default.
TestViewConfiguration(size: const Size(1280.0, 800.0));
});
-
- test('sets the DPR to match the window', () {
- final TestViewConfiguration configuration = TestViewConfiguration(size: const Size(1280.0, 800.0));
- expect(configuration.devicePixelRatio, binding.window.devicePixelRatio);
- });
});
group(AutomatedTestWidgetsFlutterBinding, () {
diff --git a/packages/integration_test/lib/integration_test.dart b/packages/integration_test/lib/integration_test.dart
index 3e6e72c..10548c4 100644
--- a/packages/integration_test/lib/integration_test.dart
+++ b/packages/integration_test/lib/integration_test.dart
@@ -397,6 +397,14 @@
Timeout? _defaultTestTimeout;
@override
+ void attachRootWidget(Widget rootWidget) {
+ // This is a workaround where screenshots of root widgets have incorrect
+ // bounds.
+ // TODO(jiahaog): Remove when https://github.com/flutter/flutter/issues/66006 is fixed.
+ super.attachRootWidget(RepaintBoundary(child: rootWidget));
+ }
+
+ @override
void reportExceptionNoticed(FlutterErrorDetails exception) {
// This method is called to log errors as they happen, and they will also
// be eventually logged again at the end of the tests. The superclass
diff --git a/packages/integration_test/test/binding_test.dart b/packages/integration_test/test/binding_test.dart
index 4f3683f..c6ceb54 100644
--- a/packages/integration_test/test/binding_test.dart
+++ b/packages/integration_test/test/binding_test.dart
@@ -126,10 +126,11 @@
});
});
- testWidgets('root view reports correct dimensions', (WidgetTester tester) async {
+ // TODO(jiahaog): Remove when https://github.com/flutter/flutter/issues/66006 is fixed.
+ testWidgets('root widgets are wrapped with a RepaintBoundary', (WidgetTester tester) async {
await tester.pumpWidget(const Placeholder());
- expect(tester.binding.renderView.paintBounds, const Rect.fromLTWH(0, 0, 2400, 1800));
+ expect(find.byType(RepaintBoundary), findsOneWidget);
});
});