Revert "Fix DPR in test view configuration (#88609)" (#88889)

This reverts commit 5feee0d8fa.
This commit is contained in:
Dan Field 2021-08-25 10:09:03 -07:00 committed by GitHub
parent 33403bd28e
commit c5861cfb56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View File

@ -1732,7 +1732,7 @@ class TestViewConfiguration extends ViewConfiguration {
TestViewConfiguration._(Size size, ui.FlutterView window) TestViewConfiguration._(Size size, ui.FlutterView window)
: _paintMatrix = _getMatrix(size, window.devicePixelRatio, window), : _paintMatrix = _getMatrix(size, window.devicePixelRatio, window),
_hitTestMatrix = _getMatrix(size, 1.0, 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) { static Matrix4 _getMatrix(Size size, double devicePixelRatio, ui.FlutterView window) {
final double inverseRatio = devicePixelRatio / window.devicePixelRatio; final double inverseRatio = devicePixelRatio / window.devicePixelRatio;

View File

@ -24,11 +24,6 @@ void main() {
// The code below will throw without the default. // The code below will throw without the default.
TestViewConfiguration(size: const Size(1280.0, 800.0)); 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, () { group(AutomatedTestWidgetsFlutterBinding, () {

View File

@ -396,6 +396,14 @@ https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab
set defaultTestTimeout(Timeout timeout) => _defaultTestTimeout = timeout; set defaultTestTimeout(Timeout timeout) => _defaultTestTimeout = timeout;
Timeout? _defaultTestTimeout; 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 @override
void reportExceptionNoticed(FlutterErrorDetails exception) { void reportExceptionNoticed(FlutterErrorDetails exception) {
// This method is called to log errors as they happen, and they will also // This method is called to log errors as they happen, and they will also

View File

@ -126,10 +126,11 @@ Future<void> main() async {
}); });
}); });
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()); await tester.pumpWidget(const Placeholder());
expect(tester.binding.renderView.paintBounds, const Rect.fromLTWH(0, 0, 2400, 1800)); expect(find.byType(RepaintBoundary), findsOneWidget);
}); });
}); });