From 6ec5e4f8cdb98227db11e5989376c31832ca2048 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 9 Jun 2017 12:05:54 +0200 Subject: Cherry picks to release branch (#9230) * [ios][macos] test remove source in use * [android] test remove source in use * [core] check source usage before remove * [core] ensure layer::accept works with non-void return values on gcc * [android] - remove upgrade runtime exceptions (#9191) --- platform/darwin/test/MGLStyleTests.mm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'platform/darwin') 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 *initialLayers = self.style.layers; if ([initialLayers.firstObject.identifier isEqualToString:@"com.mapbox.annotations.points"]) { -- cgit v1.2.1