Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[ios][macos] test remove source in use
Browse files Browse the repository at this point in the history
  • Loading branch information
ivovandongen committed May 30, 2017
1 parent 5d956d8 commit fb3cef6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions platform/darwin/test/MGLStyleTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,22 @@ - (void)testAddingSourceOfTypeABeforeSourceOfTypeBWithSameIdentifier {
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"]) {
Expand Down

0 comments on commit fb3cef6

Please sign in to comment.