diff options
author | Julian Rex <julian.rex@gmail.com> | 2018-06-18 14:24:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-18 14:24:14 -0400 |
commit | 87143a355d12fa4bfd3f094e187a8bab8148e7de (patch) | |
tree | ab04b44ab253a2b37eb4ce4abd9949aaa5f19807 /platform/ios/Integration Tests/MGLMapViewIntegrationTest.m | |
parent | c3857a9db861c0d435ad0ba3acd8564c82cc2283 (diff) | |
download | qtlocation-mapboxgl-87143a355d12fa4bfd3f094e187a8bab8148e7de.tar.gz |
[ios] Fix for integration tests not running on iOS 9. (#12145)
Diffstat (limited to 'platform/ios/Integration Tests/MGLMapViewIntegrationTest.m')
-rw-r--r-- | platform/ios/Integration Tests/MGLMapViewIntegrationTest.m | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m index c42b8eef89..8fb41d0d11 100644 --- a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m +++ b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m @@ -1,5 +1,9 @@ #import "MGLMapViewIntegrationTest.h" +@interface MGLMapView (MGLMapViewIntegrationTest) +- (void)updateFromDisplayLink; +@end + @implementation MGLMapViewIntegrationTest - (void)setUp { @@ -78,6 +82,27 @@ [self waitForExpectations:@[self.renderFinishedExpectation] timeout:timeout]; } +- (void)waitForExpectations:(NSArray<XCTestExpectation *> *)expectations timeout:(NSTimeInterval)seconds { + + NSTimer *timer; + + if (@available(iOS 10.0, *)) { + // We're good. + } + else if (self.mapView) { + // Before iOS 10 it seems that the display link is not called during the + // waitForExpectations below + timer = [NSTimer scheduledTimerWithTimeInterval:1.0/30.0 + target:self.mapView + selector:@selector(updateFromDisplayLink) + userInfo:nil + repeats:YES]; + } + + [super waitForExpectations:expectations timeout:seconds]; + [timer invalidate]; +} + - (MGLStyle *)style { return self.mapView.style; } |