17 {
18 if (@available(iOS 13.0, *)) {
19 UIViewController*
viewController = [[UIViewController alloc] initWithNibName:nil bundle:nil];
20
21 NSSet<UIScene*>* scenes = UIApplication.sharedApplication.connectedScenes;
22 XCTAssertEqual(scenes.count, 1
UL,
@"There must only be 1 scene for test");
23 UIScene* scene = scenes.anyObject;
24 XCTAssert([scene isKindOfClass:[UIWindowScene class]], @"Must be a window scene for test");
25 UIWindowScene* windowScene = (UIWindowScene*)scene;
26 XCTAssert(windowScene.windows.count > 0, @"There must be at least 1 window for test");
27 UIWindow*
window = windowScene.windows[0];
28 [window addSubview:viewController.view];
29
30 [viewController loadView];
31 XCTAssertEqual(
viewController.flutterWindowSceneIfViewLoaded, windowScene,
32 @"Must return the correct window scene when view loaded");
33 }
34}