From c7dd6419d9adb465c0ecedaee5d35fe58480a17a Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 21 Nov 2024 09:50:46 -0800 Subject: [PATCH] Remove `RepaintBoundary` that is no longer needed. (#159232) Closes https://github.com/flutter/flutter/issues/66006. From what I can tell in the multi-view effort a variation of https://github.com/flutter/flutter/pull/88609 already landed, meaning that the current device-pixel-ratio is being used (as the tests in #88609 are now passing), and I believe that means we can remove the override/hack. Will rely on "Google Testing" to run a TGP internally, or do so myself if necessary. --- packages/flutter_test/test/bindings_test.dart | 5 +++++ packages/integration_test/lib/integration_test.dart | 8 -------- packages/integration_test/test/binding_test.dart | 6 +++--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/flutter_test/test/bindings_test.dart b/packages/flutter_test/test/bindings_test.dart index 5a789fdc32..5425b7d92c 100644 --- a/packages/flutter_test/test/bindings_test.dart +++ b/packages/flutter_test/test/bindings_test.dart @@ -30,6 +30,11 @@ void main() { final Matrix4 matrix = TestViewConfiguration(size: Size.zero).toMatrix(); expect(matrix.storage.every((double x) => x.isFinite), isTrue); }); + + 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 e6ef99088b..de9f472823 100644 --- a/packages/integration_test/lib/integration_test.dart +++ b/packages/integration_test/lib/integration_test.dart @@ -446,14 +446,6 @@ https://docs.flutter.dev/testing/integration-tests @override Timeout defaultTestTimeout = Timeout.none; - @override - Widget wrapWithDefaultView(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. - return super.wrapWithDefaultView(RepaintBoundary(child: rootWidget)); - } - @override void reportExceptionNoticed(FlutterErrorDetails exception) { // This method is called to log errors as they happen, and they will also diff --git a/packages/integration_test/test/binding_test.dart b/packages/integration_test/test/binding_test.dart index 1316322131..28fafe41c0 100644 --- a/packages/integration_test/test/binding_test.dart +++ b/packages/integration_test/test/binding_test.dart @@ -124,11 +124,11 @@ Future main() 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 { + // Regression test for https://github.com/flutter/flutter/issues/66006. + testWidgets('root view reports correct dimensions', (WidgetTester tester) async { await tester.pumpWidget(const Placeholder()); - expect(find.byType(RepaintBoundary), findsOneWidget); + expect(tester.binding.renderView.paintBounds, const Rect.fromLTWH(0, 0, 2400, 1800)); }); testWidgets('integration test has no label', (WidgetTester tester) async {