Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ac4fa44

Browse files
committed
Add viewport update unit test
1 parent f72695a commit ac4fa44

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,17 @@ - (void)testkeyboardWillChangeFrameWillStartKeyboardAnimation {
173173
@"UIKeyboardAnimationDurationUserInfoKey" : [NSNumber numberWithDouble:0.25],
174174
@"UIKeyboardIsLocalUserInfoKey" : [NSNumber numberWithBool:isLocal]
175175
}];
176+
177+
XCTestExpectation* expectation = [self expectationWithDescription:@"update viewport"];
178+
OCMStub([mockEngine updateViewportMetrics:flutter::ViewportMetrics()])
179+
.ignoringNonObjectArgs()
180+
.andDo(^(NSInvocation* invocation) {
181+
[expectation fulfill];
182+
});
176183
id viewControllerMock = OCMPartialMock(viewController);
177184
[viewControllerMock keyboardWillChangeFrame:notification];
178185
OCMVerify([viewControllerMock startKeyBoardAnimation:0.25]);
186+
[self waitForExpectationsWithTimeout:5.0 handler:nil];
179187
}
180188

181189
- (void)testEnsureViewportMetricsWillInvokeAndDisplayLinkWillInvalidateInViewDidDisappear {

0 commit comments

Comments
 (0)