Nosuchmethod window (#37417)

This commit is contained in:
Dan Field
2019-08-01 20:04:49 -07:00
committed by GitHub
parent 18418dffda
commit 84fe2adedb
2 changed files with 13 additions and 0 deletions

View File

@@ -373,4 +373,12 @@ class TestWindow implements Window {
clearTextScaleFactorTestValue();
clearViewInsetsTestValue();
}
/// This gives us some grace time when the dart:ui side adds something to
/// Window, and makes things easier when we do rolls to give us time to
/// catch up.
@override
dynamic noSuchMethod(Invocation invocation) {
return null;
}
}

View File

@@ -10,6 +10,11 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:meta/meta.dart';
void main() {
test('TestWindow can handle new methods without breaking', () {
final dynamic testWindow = TestWindow(window: ui.window);
expect(testWindow.someNewProperty, null);
});
testWidgets('TestWindow can fake device pixel ratio', (WidgetTester tester) async {
verifyThatTestWindowCanFakeProperty<double>(
tester: tester,