summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLStyleTests.mm
diff options
context:
space:
mode:
authorJesse Bounds <jesse@rebounds.net>2017-02-20 15:06:46 -0800
committerJesse Bounds <jesse@rebounds.net>2017-02-23 15:07:43 -0800
commitc0718a863d0a915641857bc9cd4ff51cd508f222 (patch)
tree0d63485afba44e45d4dbb21492d25a36591f7089 /platform/darwin/test/MGLStyleTests.mm
parente860fa6f0a71805dafd03a1ac02980369b799f9e (diff)
downloadqtlocation-mapboxgl-c0718a863d0a915641857bc9cd4ff51cd508f222.tar.gz
[core, ios, macos] Return null when removing nonexistent source
Diffstat (limited to 'platform/darwin/test/MGLStyleTests.mm')
-rw-r--r--platform/darwin/test/MGLStyleTests.mm17
1 files changed, 17 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm
index 7939db576e..86cf11d4aa 100644
--- a/platform/darwin/test/MGLStyleTests.mm
+++ b/platform/darwin/test/MGLStyleTests.mm
@@ -174,6 +174,23 @@
XCTAssertThrowsSpecificNamed([self.style addSource: source2], NSException, @"MGLRedundantSourceIdentifierException");
}
+- (void)testRemovingSourcesBeforeAddingThem {
+ MGLRasterSource *rasterSource = [[MGLRasterSource alloc] initWithIdentifier:@"raster-source" tileURLTemplates:@[] options:nil];
+ [self.style removeSource:rasterSource];
+ [self.style addSource:rasterSource];
+ XCTAssertNotNil([self.style sourceWithIdentifier:rasterSource.identifier]);
+
+ MGLShapeSource *shapeSource = [[MGLShapeSource alloc] initWithIdentifier:@"shape-source" shape:nil options:nil];
+ [self.style removeSource:shapeSource];
+ [self.style addSource:shapeSource];
+ XCTAssertNotNil([self.style sourceWithIdentifier:shapeSource.identifier]);
+
+ MGLVectorSource *vectorSource = [[MGLVectorSource alloc] initWithIdentifier:@"vector-source" tileURLTemplates:@[] options:nil];
+ [self.style removeSource:vectorSource];
+ [self.style addSource:vectorSource];
+ XCTAssertNotNil([self.style sourceWithIdentifier:vectorSource.identifier]);
+}
+
- (void)testLayers {
NSArray<MGLStyleLayer *> *initialLayers = self.style.layers;
if ([initialLayers.firstObject.identifier isEqualToString:@"com.mapbox.annotations.points"]) {