summaryrefslogtreecommitdiff
path: root/platform/ios/Integration Tests/MGLStyleLayerIntegrationTests.m
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2018-05-17 11:47:31 -0400
committerFabian Guerra <fabian.guerra@mapbox.com>2018-05-17 11:47:31 -0400
commit30376f3ce1d17522d9e64901b1bbc52906ee5267 (patch)
tree1f00d04a223a76a86e16ddebc77f56d2cff88b5b /platform/ios/Integration Tests/MGLStyleLayerIntegrationTests.m
parent7d1e52a3255d4eecdcd37e4fb600eb76fa9333f8 (diff)
parent146057adf90e85e3edc80446f02d20e5f6cab378 (diff)
downloadqtlocation-mapboxgl-upstream/fabian-merge-release-4.0.1-master.tar.gz
Merge branch 'release-boba' into masterupstream/fabian-merge-release-4.0.1-master
# Conflicts: # mapbox-gl-js # platform/android/CHANGELOG.md # platform/android/MapboxGLAndroidSDK/gradle.properties # platform/android/gradle/dependencies.gradle # platform/darwin/src/MGLVectorTileSource.mm # platform/darwin/src/MGLVectorTileSource_Private.h # platform/ios/CHANGELOG.md # src/mbgl/style/expression/compound_expression.cpp
Diffstat (limited to 'platform/ios/Integration Tests/MGLStyleLayerIntegrationTests.m')
-rw-r--r--platform/ios/Integration Tests/MGLStyleLayerIntegrationTests.m61
1 files changed, 61 insertions, 0 deletions
diff --git a/platform/ios/Integration Tests/MGLStyleLayerIntegrationTests.m b/platform/ios/Integration Tests/MGLStyleLayerIntegrationTests.m
new file mode 100644
index 0000000000..015a58d2d2
--- /dev/null
+++ b/platform/ios/Integration Tests/MGLStyleLayerIntegrationTests.m
@@ -0,0 +1,61 @@
+#import "MGLMapViewIntegrationTest.h"
+
+@interface MGLStyleLayerIntegrationTests : MGLMapViewIntegrationTest
+@end
+
+@implementation MGLStyleLayerIntegrationTests
+
+- (MGLCircleStyleLayer*)setupCircleStyleLayer {
+ // Adapted from https://www.mapbox.com/ios-sdk/examples/dds-circle-layer/
+
+ // "mapbox://examples.2uf7qges" is a map ID referencing a tileset. For more
+ // more information, see mapbox.com/help/define-map-id/
+ MGLSource *source = [[MGLVectorTileSource alloc] initWithIdentifier:@"trees" configurationURL:[NSURL URLWithString:@"mapbox://examples.2uf7qges"]];
+ [self.mapView.style addSource:source];
+
+ MGLCircleStyleLayer *layer = [[MGLCircleStyleLayer alloc] initWithIdentifier: @"tree-style" source:source];
+
+ // The source name from the source's TileJSON metadata: mapbox.com/api-documentation/#retrieve-tilejson-metadata
+ layer.sourceLayerIdentifier = @"yoshino-trees-a0puw5";
+
+ return layer;
+}
+
+- (void)testForInterpolatingExpressionRenderCrashWithEmptyStops {
+ // Tests: https://github.com/mapbox/mapbox-gl-native/issues/9539
+ // Adapted from https://www.mapbox.com/ios-sdk/examples/dds-circle-layer/
+ self.mapView.centerCoordinate = CLLocationCoordinate2DMake(38.897,-77.039);
+ self.mapView.zoomLevel = 10.5;
+
+ MGLCircleStyleLayer *layer = [self setupCircleStyleLayer];
+
+ NSExpression *interpExpression = [NSExpression mgl_expressionForInterpolatingExpression:NSExpression.zoomLevelVariableExpression
+ withCurveType:MGLExpressionInterpolationModeLinear
+ parameters:nil
+ stops:[NSExpression expressionForConstantValue:@{}]];
+
+ XCTAssertThrowsSpecificNamed((layer.circleColor = interpExpression), NSException, NSInvalidArgumentException);
+
+ [self.mapView.style addLayer:layer];
+ [self waitForMapViewToBeRenderedWithTimeout:1.0];
+}
+
+- (void)testForSteppingExpressionRenderCrashWithEmptyStops {
+ // Tests: https://github.com/mapbox/mapbox-gl-native/issues/9539
+ // Adapted from https://www.mapbox.com/ios-sdk/examples/dds-circle-layer/
+ self.mapView.centerCoordinate = CLLocationCoordinate2DMake(38.897,-77.039);
+ self.mapView.zoomLevel = 10.5;
+
+ MGLCircleStyleLayer *layer = [self setupCircleStyleLayer];
+
+ NSExpression *steppingExpression = [NSExpression mgl_expressionForSteppingExpression:NSExpression.zoomLevelVariableExpression
+ fromExpression:[NSExpression expressionForConstantValue:[UIColor greenColor]]
+ stops:[NSExpression expressionForConstantValue:@{}]];
+
+ XCTAssertThrowsSpecificNamed((layer.circleColor = steppingExpression), NSException, NSInvalidArgumentException);
+
+ [self.mapView.style addLayer:layer];
+ [self waitForMapViewToBeRenderedWithTimeout:1.0];
+}
+
+@end