summaryrefslogtreecommitdiff
path: root/platform/darwin/test
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/test')
-rw-r--r--platform/darwin/test/MGLStyleTests.mm17
1 files changed, 16 insertions, 1 deletions
diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm
index 86cf11d4aa..4f6f5f0dba 100644
--- a/platform/darwin/test/MGLStyleTests.mm
+++ b/platform/darwin/test/MGLStyleTests.mm
@@ -284,12 +284,27 @@
[self.style addLayer:circleLayer];
XCTAssertNotNil([self.style layerWithIdentifier:circleLayer.identifier]);
- MGLBackgroundStyleLayer *backgroundLayer = [[MGLBackgroundStyleLayer alloc] initWithIdentifier:@"circle-layer"];
+ MGLBackgroundStyleLayer *backgroundLayer = [[MGLBackgroundStyleLayer alloc] initWithIdentifier:@"background-layer"];
[self.style removeLayer:backgroundLayer];
[self.style addLayer:backgroundLayer];
XCTAssertNotNil([self.style layerWithIdentifier:backgroundLayer.identifier]);
}
+- (void)testAddingLayerOfTypeABeforeRemovingLayerOfTypeBWithSameIdentifier {
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"shape-source-removing-before-adding" shape:nil options:nil];
+ [self.style addSource:source];
+
+ // Add a fill layer with an identifer
+ MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"some-identifier" source:source];
+ [self.style addLayer:fillLayer];
+
+ // Remove a line layer (before adding it) with the same identifier as the fill layer previously added
+ MGLLineStyleLayer *lineLayer = [[MGLLineStyleLayer alloc] initWithIdentifier:fillLayer.identifier source:source];
+ [self.style removeLayer:lineLayer];
+
+ XCTAssertTrue([[self.style layerWithIdentifier:fillLayer.identifier] isMemberOfClass:[MGLFillStyleLayer class]]);
+}
+
- (NSString *)stringWithContentsOfStyleHeader {
NSURL *styleHeaderURL = [[[NSBundle mgl_frameworkBundle].bundleURL
URLByAppendingPathComponent:@"Headers" isDirectory:YES]