Unverified Commit 154ae0f1 authored by Alex Wallen's avatar Alex Wallen Committed by GitHub

`updateSemantics` in TestWindow should always be implemented. (#114857)

* Test that updateSemantics can be called

* Test that updateSemantics in FakeWindow is always implemented

* Sort import directives
Co-authored-by: 's avatara-wallen <stephenwallen@google.com>
parent befd8b66
......@@ -3,8 +3,9 @@
// found in the LICENSE file.
import 'dart:ui' as ui show window;
import 'dart:ui' show AccessibilityFeatures, Brightness, Locale, Size, WindowPadding;
import 'dart:ui' show AccessibilityFeatures, Brightness, Locale, PlatformDispatcher, SemanticsUpdate, SingletonFlutterWindow, Size, WindowPadding;
import 'package:flutter/semantics.dart' show SemanticsUpdateBuilder;
import 'package:flutter/widgets.dart' show WidgetsBinding, WidgetsBindingObserver;
import 'package:flutter_test/flutter_test.dart';
......@@ -207,6 +208,14 @@ void main() {
expect(observer.locales, equals(expectedValue));
retrieveTestBinding(tester).window.localesTestValue = defaultLocales;
});
test('Window test', () {
final FakeSingletonWindow fakeWindow = FakeSingletonWindow();
final TestWindow testWindow = TestWindow(window: fakeWindow);
final SemanticsUpdate update = SemanticsUpdateBuilder().build();
testWindow.updateSemantics(update);
expect(fakeWindow.lastUpdate, update);
});
}
void verifyThatTestWindowCanFakeProperty<WindowPropertyType>({
......@@ -266,3 +275,15 @@ class TestObserver with WidgetsBindingObserver {
this.locales = locales;
}
}
class FakeSingletonWindow extends Fake implements SingletonFlutterWindow {
SemanticsUpdate? lastUpdate;
@override
PlatformDispatcher get platformDispatcher => PlatformDispatcher.instance;
@override
void updateSemantics(SemanticsUpdate update) {
lastUpdate = update;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment