diff options
author | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-04-23 10:44:02 -0400 |
---|---|---|
committer | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-04-23 10:44:02 -0400 |
commit | e08b6fe87f5824ab05a4cc67d9a76af5bb5ddd3b (patch) | |
tree | 886e10260bfa044f62943186ec837b9ccd02934c /platform/ios/Integration Tests/MGLMapViewIntegrationTest.m | |
parent | 2bb785dad2489d04db179fa9cf65514640db0a96 (diff) | |
parent | a45670cfb5752866b9c8130024a313944684c2db (diff) | |
download | qtlocation-mapboxgl-e08b6fe87f5824ab05a4cc67d9a76af5bb5ddd3b.tar.gz |
Merge branch 'release-boba' into masterupstream/fabian-merge-v4.0.0
# Conflicts:
# circle.yml
# include/mbgl/style/expression/let.hpp
# platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java
# platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
# platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java
# platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
# platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
# platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java
# platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
# platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java
# platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
# platform/android/gradle/dependencies.gradle
# platform/android/src/example_custom_layer.cpp
# platform/android/src/geojson/point.cpp
# platform/darwin/src/NSPredicate+MGLAdditions.mm
# platform/darwin/test/MGLExpressionTests.mm
# platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec
# platform/ios/Mapbox-iOS-SDK-symbols.podspec
# platform/ios/Mapbox-iOS-SDK.podspec
# platform/ios/app/MBXViewController.m
# src/mbgl/renderer/layers/render_custom_layer.cpp
# src/mbgl/style/conversion/filter.cpp
# src/mbgl/style/expression/interpolate.cpp
# src/mbgl/style/expression/value.cpp
# test/style/filter.test.cpp
Diffstat (limited to 'platform/ios/Integration Tests/MGLMapViewIntegrationTest.m')
-rw-r--r-- | platform/ios/Integration Tests/MGLMapViewIntegrationTest.m | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m new file mode 100644 index 0000000000..fc3229c83b --- /dev/null +++ b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m @@ -0,0 +1,79 @@ +#import "MGLMapViewIntegrationTest.h" + +@implementation MGLMapViewIntegrationTest + +- (void)setUp { + [super setUp]; + + [MGLAccountManager setAccessToken:@"pk.feedcafedeadbeefbadebede"]; + NSURL *styleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"one-liner" withExtension:@"json"]; + + self.mapView = [[MGLMapView alloc] initWithFrame:UIScreen.mainScreen.bounds styleURL:styleURL]; + self.mapView.delegate = self; + + 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]; + + if (!self.mapView.style) { + [self waitForMapViewToFinishLoadingStyleWithTimeout:1]; + } +} + +- (void)tearDown { + self.styleLoadingExpectation = nil; + self.renderFinishedExpectation = nil; + self.mapView = nil; + self.style = nil; + + [super tearDown]; +} + +#pragma mark - MGLMapViewDelegate + +- (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; +} + +- (void)mapView:(MGLMapView *)mapView regionDidChangeAnimated:(BOOL)animated { + if (self.regionDidChange) { + self.regionDidChange(mapView, animated); + } +} + +- (void)mapViewRegionIsChanging:(MGLMapView *)mapView { + if (self.regionIsChanging) { + self.regionIsChanging(mapView); + } +} + +#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]; + self.renderFinishedExpectation = [self expectationWithDescription:@"Map view should be rendered"]; + [self waitForExpectations:@[self.renderFinishedExpectation] timeout:timeout]; +} + +- (MGLStyle *)style { + return self.mapView.style; +} + +@end |