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

Commit c3cd900

Browse files
author
Julian Rex
authored
[ios] Fix integration tests failing on iOS 9 (due to UIWindow deallocation), and random fails waiting for rendering. (#15433)
1 parent ba2d804 commit c3cd900

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ - (void)waitFor:(NSTimeInterval)seconds {
801801
- (void)waitForCollisionDetectionToRun {
802802
XCTAssertNil(self.renderFinishedExpectation, @"Incorrect test setup");
803803

804+
[self.mapView setNeedsRerender];
804805
self.renderFinishedExpectation = [self expectationWithDescription:@"Map view should be rendered"];
805806
XCTestExpectation *timerExpired = [self expectationWithDescription:@"Timer expires"];
806807

platform/ios/Integration Tests/MGLMapViewIntegrationTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
@interface MGLMapViewIntegrationTest : XCTestCase <MGLMapViewDelegate>
2828
@property (nonatomic) MGLMapView *mapView;
29+
@property (nonatomic) UIWindow *window;
2930
@property (nonatomic) MGLStyle *style;
3031
@property (nonatomic) XCTestExpectation *styleLoadingExpectation;
3132
@property (nonatomic) XCTestExpectation *renderFinishedExpectation;

platform/ios/Integration Tests/MGLMapViewIntegrationTest.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ - (void)setUp {
4444

4545
UIView *superView = [[UIView alloc] initWithFrame:UIScreen.mainScreen.bounds];
4646
[superView addSubview:self.mapView];
47-
UIWindow *window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
48-
[window addSubview:superView];
49-
[window makeKeyAndVisible];
47+
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
48+
[self.window addSubview:superView];
49+
[self.window makeKeyAndVisible];
5050

5151
if (!self.mapView.style) {
5252
[self waitForMapViewToFinishLoadingStyleWithTimeout:10];
@@ -58,6 +58,7 @@ - (void)tearDown {
5858
self.renderFinishedExpectation = nil;
5959
self.mapView = nil;
6060
self.style = nil;
61+
self.window = nil;
6162
[MGLAccountManager setAccessToken:nil];
6263

6364
[super tearDown];
@@ -137,6 +138,7 @@ - (void)waitForMapViewToBeRenderedWithTimeout:(NSTimeInterval)timeout {
137138
[self.mapView setNeedsRerender];
138139
self.renderFinishedExpectation = [self expectationWithDescription:@"Map view should be rendered"];
139140
[self waitForExpectations:@[self.renderFinishedExpectation] timeout:timeout];
141+
self.renderFinishedExpectation = nil;
140142
}
141143

142144
- (void)waitForExpectations:(NSArray<XCTestExpectation *> *)expectations timeout:(NSTimeInterval)seconds {

0 commit comments

Comments
 (0)