aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmkiley <jordan.kiley@mapbox.com>2019-06-14 11:54:45 -0700
committerjmkiley <jordan.kiley@mapbox.com>2019-06-14 11:54:45 -0700
commit6d87fecc61c96935f53911549de574e094898e92 (patch)
treec97185ce2f2ad0c33fa2bddddb9d13871da445cf
parent532012522ded6651bd93d5a3628dd6dde056f72e (diff)
[ios] start to breakup integration tests
-rw-r--r--platform/ios/Integration Tests/MGLMapViewIntegrationTest.h1
-rw-r--r--platform/ios/Integration Tests/MGLMapViewIntegrationTest.m17
-rw-r--r--platform/ios/Integration Tests/MGLStyleLoadingIntegrationTests.m37
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj4
4 files changed, 41 insertions, 18 deletions
diff --git a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h
index b152be8ce..e0b02675c 100644
--- a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h
+++ b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h
@@ -29,7 +29,6 @@
@property (nonatomic) UIWindow *window;
@property (nonatomic) MBXTestMapView *mapView;
@property (nonatomic) MGLStyle *style;
-@property (nonatomic) XCTestExpectation *styleLoadingExpectation;
@property (nonatomic) XCTestExpectation *renderFinishedExpectation;
@property (nonatomic) MGLAnnotationView * (^viewForAnnotation)(MGLMapView *mapView, id<MGLAnnotation> annotation);
@property (nonatomic) void (^regionWillChange)(MGLMapView *mapView, BOOL animated);
diff --git a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m
index 90457081f..153ebfac7 100644
--- a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m
+++ b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m
@@ -42,13 +42,9 @@
[self.window addSubview:superView];
[self.window makeKeyAndVisible];
- if (!self.mapView.style) {
- [self waitForMapViewToFinishLoadingStyleWithTimeout:10];
- }
}
- (void)tearDown {
- self.styleLoadingExpectation = nil;
self.renderFinishedExpectation = nil;
self.mapView = nil;
self.style = nil;
@@ -67,13 +63,6 @@
return nil;
}
-- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style {
- XCTAssertNotNil(mapView.style);
- XCTAssertEqual(mapView.style, style);
-
- [self.styleLoadingExpectation fulfill];
-}
-
- (void)mapViewDidFinishRenderingFrame:(MGLMapView *)mapView fullyRendered:(__unused BOOL)fullyRendered {
[self.renderFinishedExpectation fulfill];
self.renderFinishedExpectation = nil;
@@ -120,12 +109,6 @@
#pragma mark - Utilities
-- (void)waitForMapViewToFinishLoadingStyleWithTimeout:(NSTimeInterval)timeout {
- XCTAssertNil(self.styleLoadingExpectation);
- self.styleLoadingExpectation = [self expectationWithDescription:@"Map view should finish loading style."];
- [self waitForExpectations:@[self.styleLoadingExpectation] timeout:timeout];
-}
-
- (void)waitForMapViewToBeRenderedWithTimeout:(NSTimeInterval)timeout {
XCTAssertNil(self.renderFinishedExpectation);
[self.mapView setNeedsDisplay];
diff --git a/platform/ios/Integration Tests/MGLStyleLoadingIntegrationTests.m b/platform/ios/Integration Tests/MGLStyleLoadingIntegrationTests.m
new file mode 100644
index 000000000..38f3e5134
--- /dev/null
+++ b/platform/ios/Integration Tests/MGLStyleLoadingIntegrationTests.m
@@ -0,0 +1,37 @@
+
+#import "MGLMapViewIntegrationTest.h"
+
+@interface MGLStyleLoadingIntegrationTests : MGLMapViewIntegrationTest
+@property (nonatomic) XCTestExpectation *styleLoadingExpectation;
+@end
+
+@implementation MGLStyleLoadingIntegrationTests
+
+- (void)setUp {
+ [super setUp];
+ if (!self.mapView.style) {
+ [self waitForMapViewToFinishLoadingStyleWithTimeout:10];
+ }
+}
+
+- (void)tearDown {
+ self.styleLoadingExpectation = nil;
+}
+
+- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style {
+ XCTAssertNotNil(mapView.style);
+ XCTAssertEqual(mapView.style, style);
+
+ [self.styleLoadingExpectation fulfill];
+}
+
+- (void)waitForMapViewToFinishLoadingStyleWithTimeout:(NSTimeInterval)timeout {
+ XCTAssertNil(self.styleLoadingExpectation);
+ self.styleLoadingExpectation = [self expectationWithDescription:@"Map view should finish loading style."];
+ [self waitForExpectations:@[self.styleLoadingExpectation] timeout:timeout];
+}
+
+- (MGLStyle *)style {
+ return self.mapView.style;
+}
+@end
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index 884668a11..862dbc188 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -439,6 +439,7 @@
A46E4C9E228CE392009CAD5B /* MGLTabBarControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A46E4C9C228CB74B009CAD5B /* MGLTabBarControllerTests.m */; };
A46E4C9F228CE5FD009CAD5B /* IntegrationTest.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A46E4C99228CB731009CAD5B /* IntegrationTest.storyboard */; };
A46E4CA2228F4D6B009CAD5B /* IntegrationTest.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A46E4C99228CB731009CAD5B /* IntegrationTest.storyboard */; };
+ A489BDC322B2D3B20026931C /* MGLStyleLoadingIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A489BDC222B2D3B20026931C /* MGLStyleLoadingIntegrationTests.m */; };
A4EE317022973F2E006A8F2F /* MBXTestMapView.m in Sources */ = {isa = PBXBuildFile; fileRef = A4EE316F22973F2E006A8F2F /* MBXTestMapView.m */; };
A4F3FB1D2254865900A30170 /* missing_icon.json in Resources */ = {isa = PBXBuildFile; fileRef = A4F3FB1C2254865900A30170 /* missing_icon.json */; };
AC1B0916221CA14D00DB56C8 /* CLLocationManager+MMEMobileEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = AC1B0914221CA14500DB56C8 /* CLLocationManager+MMEMobileEvents.h */; };
@@ -1108,6 +1109,7 @@
96F3F73B1F5711F1003E2D2C /* MGLUserLocationHeadingIndicator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLUserLocationHeadingIndicator.h; sourceTree = "<group>"; };
A46E4C99228CB731009CAD5B /* IntegrationTest.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = IntegrationTest.storyboard; sourceTree = "<group>"; };
A46E4C9C228CB74B009CAD5B /* MGLTabBarControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLTabBarControllerTests.m; sourceTree = "<group>"; };
+ A489BDC222B2D3B20026931C /* MGLStyleLoadingIntegrationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLStyleLoadingIntegrationTests.m; sourceTree = "<group>"; };
A4EE316E22973F2E006A8F2F /* MBXTestMapView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MBXTestMapView.h; sourceTree = "<group>"; };
A4EE316F22973F2E006A8F2F /* MBXTestMapView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MBXTestMapView.m; sourceTree = "<group>"; };
A4F3FB1C2254865900A30170 /* missing_icon.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = missing_icon.json; sourceTree = "<group>"; };
@@ -1485,6 +1487,7 @@
A46E4C9C228CB74B009CAD5B /* MGLTabBarControllerTests.m */,
CA0C27952076CA50001CE5B7 /* MGLMapViewIntegrationTest.h */,
CA0C27932076CA19001CE5B7 /* MGLMapViewIntegrationTest.m */,
+ A489BDC222B2D3B20026931C /* MGLStyleLoadingIntegrationTests.m */,
CA4EB8C620863487006AB465 /* MGLStyleLayerIntegrationTests.m */,
CA88DC2F21C85D900059ED5A /* MGLStyleURLIntegrationTest.m */,
077061DB215DA11F000FEF62 /* MGLTestLocationManager.h */,
@@ -3056,6 +3059,7 @@
CA7766842229C11A0008DE9E /* SMCalloutView.m in Sources */,
CA34C9C3207FD272005C1A06 /* MGLCameraTransitionTests.mm in Sources */,
16376B0A1FFD9DAF0000563E /* MBGLIntegrationTests.m in Sources */,
+ A489BDC322B2D3B20026931C /* MGLStyleLoadingIntegrationTests.m in Sources */,
CA88DC3021C85D900059ED5A /* MGLStyleURLIntegrationTest.m in Sources */,
CA0C27942076CA19001CE5B7 /* MGLMapViewIntegrationTest.m in Sources */,
CA7766832229C10E0008DE9E /* MGLCompactCalloutView.m in Sources */,