|
3 | 3 | // found in the LICENSE file.
|
4 | 4 |
|
5 | 5 | import 'dart:ui' as ui show window;
|
6 |
| -import 'dart:ui' show AccessibilityFeatures, Brightness, Locale, Size, WindowPadding; |
| 6 | +import 'dart:ui' show AccessibilityFeatures, Brightness, Locale, PlatformDispatcher, SemanticsUpdate, SingletonFlutterWindow, Size, WindowPadding; |
7 | 7 |
|
| 8 | +import 'package:flutter/semantics.dart' show SemanticsUpdateBuilder; |
8 | 9 | import 'package:flutter/widgets.dart' show WidgetsBinding, WidgetsBindingObserver;
|
9 | 10 | import 'package:flutter_test/flutter_test.dart';
|
10 | 11 |
|
@@ -207,6 +208,14 @@ void main() {
|
207 | 208 | expect(observer.locales, equals(expectedValue));
|
208 | 209 | retrieveTestBinding(tester).window.localesTestValue = defaultLocales;
|
209 | 210 | });
|
| 211 | + |
| 212 | +test('Window test', () { |
| 213 | + final FakeSingletonWindow fakeWindow = FakeSingletonWindow(); |
| 214 | + final TestWindow testWindow = TestWindow(window: fakeWindow); |
| 215 | + final SemanticsUpdate update = SemanticsUpdateBuilder().build(); |
| 216 | + testWindow.updateSemantics(update); |
| 217 | + expect(fakeWindow.lastUpdate, update); |
| 218 | + }); |
210 | 219 | }
|
211 | 220 |
|
212 | 221 | void verifyThatTestWindowCanFakeProperty<WindowPropertyType>({
|
@@ -266,3 +275,15 @@ class TestObserver with WidgetsBindingObserver {
|
266 | 275 | this.locales = locales;
|
267 | 276 | }
|
268 | 277 | }
|
| 278 | + |
| 279 | +class FakeSingletonWindow extends Fake implements SingletonFlutterWindow { |
| 280 | + SemanticsUpdate? lastUpdate; |
| 281 | + |
| 282 | + @override |
| 283 | + PlatformDispatcher get platformDispatcher => PlatformDispatcher.instance; |
| 284 | + |
| 285 | + @override |
| 286 | + void updateSemantics(SemanticsUpdate update) { |
| 287 | + lastUpdate = update; |
| 288 | + } |
| 289 | +} |
0 commit comments