diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-05-30 11:21:05 +0300 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-05-30 13:07:03 +0300 |
commit | fb3cef632d7732fab54f93971d3c8ef4d8291bef (patch) | |
tree | 70e6ff9de77f67764630d87dc2d6b240c1f0dff9 | |
parent | 5d956d81ccd34508b206839fd688b9225c20c65d (diff) | |
download | qtlocation-mapboxgl-fb3cef632d7732fab54f93971d3c8ef4d8291bef.tar.gz |
[ios][macos] test remove source in use
-rw-r--r-- | platform/darwin/test/MGLStyleTests.mm | 16 |
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"]) { |