@@ -1514,6 +1514,56 @@ - (void)testWindowScenePerformActionForShortcutItemHandledByNoPlugin {
15141514 completionHandler: handler]);
15151515}
15161516
1517+ - (void )testWindowSceneDidUpdateEffectiveGeometryUpdatesDisplaysOfEnginesInScene {
1518+ if (@available (iOS 26.0 , *)) {
1519+ FlutterPluginSceneLifeCycleDelegate* delegate =
1520+ [[FlutterPluginSceneLifeCycleDelegate alloc ] init ];
1521+
1522+ id mocks = [self mocksForEvents ];
1523+ id mockScene = mocks[@" mockScene" ];
1524+ // An engine whose view controller is in the scene, e.g. a fixed-size FlutterViewController
1525+ // embedded as a child view controller in an add-to-app host.
1526+ id viewControllerEngine = mocks[@" mockEngine" ];
1527+ id mockWindow = OCMClassMock ([UIWindow class ]);
1528+ id mockHostViewController = OCMClassMock ([UIViewController class ]);
1529+ id mockFlutterViewController = OCMClassMock ([FlutterViewController class ]);
1530+ OCMStub ([mockScene windows ]).andReturn (@[ mockWindow ]);
1531+ OCMStub ([mockWindow rootViewController ]).andReturn (mockHostViewController);
1532+ OCMStub ([mockHostViewController childViewControllers ]).andReturn (@[
1533+ mockFlutterViewController
1534+ ]);
1535+ OCMStub ([mockFlutterViewController engine ]).andReturn (viewControllerEngine);
1536+ // An engine registered with the scene by the developer.
1537+ id registeredEngine = OCMClassMock ([FlutterEngine class ]);
1538+ [delegate registerSceneLifeCycleWithFlutterEngine: registeredEngine scene: mockScene];
1539+ XCTAssertEqual ([delegate searchFlutterEnginesWithinScene: mockScene].count , 2.0 );
1540+
1541+ id geometry = OCMClassMock ([UIWindowSceneGeometry class ]);
1542+ [delegate windowScene: mockScene didUpdateEffectiveGeometry: geometry];
1543+
1544+ OCMVerify (times (1 ), [viewControllerEngine updateDisplays ]);
1545+ OCMVerify (times (1 ), [registeredEngine updateDisplays ]);
1546+ }
1547+ }
1548+
1549+ - (void )testWindowSceneDidUpdateEffectiveGeometryDoesNotUpdateDisplaysOfEnginesInOtherScenes {
1550+ if (@available (iOS 26.0 , *)) {
1551+ FlutterPluginSceneLifeCycleDelegate* delegate =
1552+ [[FlutterPluginSceneLifeCycleDelegate alloc ] init ];
1553+
1554+ id mocks = [self mocksForEvents ];
1555+ id mockEngine = mocks[@" mockEngine" ];
1556+ id mockScene = mocks[@" mockScene" ];
1557+ id otherScene = OCMClassMock ([UIWindowScene class ]);
1558+ [delegate registerSceneLifeCycleWithFlutterEngine: mockEngine scene: otherScene];
1559+
1560+ [delegate windowScene: mockScene
1561+ didUpdateEffectiveGeometry: OCMClassMock ([UIWindowSceneGeometry class ])];
1562+
1563+ OCMVerify (never (), [mockEngine updateDisplays ]);
1564+ }
1565+ }
1566+
15171567- (NSDictionary *)mocksForEvents {
15181568 id mockEngine = OCMClassMock ([FlutterEngine class ]);
15191569 id mockLifecycleDelegate = OCMClassMock ([FlutterEnginePluginSceneLifeCycleDelegate class ]);
0 commit comments