Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Convert integration test to completionful expectation
Browse files Browse the repository at this point in the history
  • Loading branch information
friedbunny committed Jun 11, 2019
1 parent 9c93e06 commit df6d7e7
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,16 @@ - (void)internalTestOffscreenSelectionTitle:(NSString*)title withTestData:(PanTe
// Also note, that at this point, the internal mechanism that determines if
// an annotation view is offscreen and should be put back in the reuse queue
// will have run, and `viewForAnnotation` may return nil

[self.mapView selectAnnotation:point moveIntoView:moveIntoView animateSelection:animateSelection];

XCTestExpectation *selectionCompleted = [self expectationWithDescription:@"Selection completed"];
[self.mapView selectAnnotation:point moveIntoView:moveIntoView animateSelection:animateSelection completionHandler:^{
[selectionCompleted fulfill];
}];

// Animated selection takes MGLAnimationDuration (0.3 seconds), so wait a little
// longer. We don't need to wait as long if we're not animated (but we do
// want the runloop to tick over)
[self waitFor:animateSelection ? 0.4: 0.05];
[self waitForExpectations:@[selectionCompleted] timeout:animateSelection ? 0.4: 0.05];

UIView *annotationViewAfterSelection = [self.mapView viewForAnnotation:point];
CLLocationCoordinate2D mapCenterAfterSelection = self.mapView.centerCoordinate;
Expand Down

0 comments on commit df6d7e7

Please sign in to comment.