summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLStyleTests.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/test/MGLStyleTests.mm')
-rw-r--r--platform/darwin/test/MGLStyleTests.mm16
1 files changed, 16 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm
index f80d5776f0..d93483ea6e 100644
--- a/platform/darwin/test/MGLStyleTests.mm
+++ b/platform/darwin/test/MGLStyleTests.mm
@@ -240,6 +240,22 @@
XCTAssertTrue([[self.style sourceWithIdentifier:shapeSource.identifier] isMemberOfClass:[MGLVectorSource class]]);
}
+- (void)testRemovingSourceInUse {
+ // Add a raster source
+ MGLRasterSource *rasterSource = [[MGLRasterSource alloc] initWithIdentifier:@"some-identifier" tileURLTemplates:@[] options:nil];
+ [self.style addSource:rasterSource];
+
+ // Add a layer using it
+ MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"fillLayer" source:rasterSource];
+ [self.style addLayer:fillLayer];
+
+ // Attempt to remove the raster source
+ [self.style removeSource:rasterSource];
+
+ // Ensure it is still there
+ XCTAssertTrue([[self.style sourceWithIdentifier:rasterSource.identifier] isMemberOfClass:[MGLRasterSource class]]);
+}
+
- (void)testLayers {
NSArray<MGLStyleLayer *> *initialLayers = self.style.layers;
if ([initialLayers.firstObject.identifier isEqualToString:@"com.mapbox.annotations.points"]) {