diff options
author | Julian Rex <julian.rex@mapbox.com> | 2019-08-20 22:22:55 -0400 |
---|---|---|
committer | Julian Rex <julian.rex@mapbox.com> | 2019-08-20 22:22:55 -0400 |
commit | a6a76f074028ac204488351293ccf47fd6921d75 (patch) | |
tree | 665b3e1af7042421f02a415f8a6a5688561f305f | |
parent | 2f43a7b87b7d12298318cb6611ac9a7ef8868b09 (diff) | |
download | qtlocation-mapboxgl-upstream/jrex/integration-test-fixup.tar.gz |
[ios] Fix integration tests failing on iOS 9 (due to UIWindow deallocation), and random fails waiting for rendering.upstream/jrex/integration-test-fixup
3 files changed, 7 insertions, 3 deletions
diff --git a/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.mm b/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.mm index eb3c85e30d..1b3603419e 100644 --- a/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.mm +++ b/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.mm @@ -801,6 +801,7 @@ static const CGPoint kAnnotationRelativeScale = { 0.05f, 0.125f }; - (void)waitForCollisionDetectionToRun { XCTAssertNil(self.renderFinishedExpectation, @"Incorrect test setup"); + [self.mapView setNeedsRerender]; self.renderFinishedExpectation = [self expectationWithDescription:@"Map view should be rendered"]; XCTestExpectation *timerExpired = [self expectationWithDescription:@"Timer expires"]; diff --git a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h index dedafdb83a..07d8698f38 100644 --- a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h +++ b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h @@ -26,6 +26,7 @@ @interface MGLMapViewIntegrationTest : XCTestCase <MGLMapViewDelegate> @property (nonatomic) MGLMapView *mapView; +@property (nonatomic) UIWindow *window; @property (nonatomic) MGLStyle *style; @property (nonatomic) XCTestExpectation *styleLoadingExpectation; @property (nonatomic) XCTestExpectation *renderFinishedExpectation; diff --git a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m index 62e038855d..3fa191dfcd 100644 --- a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m +++ b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m @@ -44,9 +44,9 @@ UIView *superView = [[UIView alloc] initWithFrame:UIScreen.mainScreen.bounds]; [superView addSubview:self.mapView]; - UIWindow *window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds]; - [window addSubview:superView]; - [window makeKeyAndVisible]; + self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds]; + [self.window addSubview:superView]; + [self.window makeKeyAndVisible]; if (!self.mapView.style) { [self waitForMapViewToFinishLoadingStyleWithTimeout:10]; @@ -58,6 +58,7 @@ self.renderFinishedExpectation = nil; self.mapView = nil; self.style = nil; + self.window = nil; [MGLAccountManager setAccessToken:nil]; [super tearDown]; @@ -137,6 +138,7 @@ [self.mapView setNeedsRerender]; self.renderFinishedExpectation = [self expectationWithDescription:@"Map view should be rendered"]; [self waitForExpectations:@[self.renderFinishedExpectation] timeout:timeout]; + self.renderFinishedExpectation = nil; } - (void)waitForExpectations:(NSArray<XCTestExpectation *> *)expectations timeout:(NSTimeInterval)seconds { |