From a877b6dbe8ff576f82ab9222f418da51591dd423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Fri, 30 Mar 2018 05:43:56 -0700 Subject: [ios, macos] Renamed MGLVectorSource to MGLVectorTileSource --- .../darwin/test/MGLDocumentationExampleTests.swift | 18 ++++++------ platform/darwin/test/MGLSourceQueryTests.m | 4 +-- platform/darwin/test/MGLStyleTests.mm | 34 +++++++++++----------- 3 files changed, 28 insertions(+), 28 deletions(-) (limited to 'platform/darwin/test') diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift index 08650e8647..6c16ed426c 100644 --- a/platform/darwin/test/MGLDocumentationExampleTests.swift +++ b/platform/darwin/test/MGLDocumentationExampleTests.swift @@ -109,9 +109,9 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { XCTAssertNotNil(mapView.style?.source(withIdentifier: "hills")) } - func testMGLVectorSource() { + func testMGLVectorTileSource() { //#-example-code - let source = MGLVectorSource(identifier: "pois", tileURLTemplates: ["https://example.com/vector-tiles/{z}/{x}/{y}.mvt"], options: [ + let source = MGLVectorTileSource(identifier: "pois", tileURLTemplates: ["https://example.com/vector-tiles/{z}/{x}/{y}.mvt"], options: [ .minimumZoomLevel: 9, .maximumZoomLevel: 16, .attributionInfos: [ @@ -151,7 +151,7 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { } func testMGLCircleStyleLayer() { - let population = MGLVectorSource(identifier: "population", configurationURL: URL(string: "https://example.com/style.json")!) + let population = MGLVectorTileSource(identifier: "population", configurationURL: URL(string: "https://example.com/style.json")!) mapView.style?.addSource(population) //#-example-code @@ -174,7 +174,7 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { } func testMGLLineStyleLayer() { - let trails = MGLVectorSource(identifier: "trails", configurationURL: URL(string: "https://example.com/style.json")!) + let trails = MGLVectorTileSource(identifier: "trails", configurationURL: URL(string: "https://example.com/style.json")!) mapView.style?.addSource(trails) //#-example-code @@ -197,7 +197,7 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { } func testMGLFillStyleLayer() { - let parks = MGLVectorSource(identifier: "parks", configurationURL: URL(string: "https://example.com/style.json")!) + let parks = MGLVectorTileSource(identifier: "parks", configurationURL: URL(string: "https://example.com/style.json")!) mapView.style?.addSource(parks) //#-example-code @@ -216,7 +216,7 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { } func testMGLFillExtrusionStyleLayer() { - let buildings = MGLVectorSource(identifier: "buildings", configurationURL: URL(string: "https://example.com/style.json")!) + let buildings = MGLVectorTileSource(identifier: "buildings", configurationURL: URL(string: "https://example.com/style.json")!) mapView.style?.addSource(buildings) //#-example-code @@ -250,7 +250,7 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { } func testMGLSymbolStyleLayer() { - let pois = MGLVectorSource(identifier: "pois", configurationURL: URL(string: "https://example.com/style.json")!) + let pois = MGLVectorTileSource(identifier: "pois", configurationURL: URL(string: "https://example.com/style.json")!) mapView.style?.addSource(pois) //#-example-code @@ -305,7 +305,7 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { ]) mapView.style?.addSource(source) - let canals = MGLVectorSource(identifier: "canals", configurationURL: URL(string: "https://example.com/style.json")!) + let canals = MGLVectorTileSource(identifier: "canals", configurationURL: URL(string: "https://example.com/style.json")!) mapView.style?.addSource(canals) let canalShadowLayer = MGLLineStyleLayer(identifier: "waterway-river-canal-shadow", source: canals) mapView.style?.addLayer(canalShadowLayer) @@ -322,7 +322,7 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { } func testMGLVectorStyleLayer$predicate() { - let terrain = MGLVectorSource(identifier: "terrain", configurationURL: URL(string: "https://example.com/style.json")!) + let terrain = MGLVectorTileSource(identifier: "terrain", configurationURL: URL(string: "https://example.com/style.json")!) mapView.style?.addSource(terrain) //#-example-code diff --git a/platform/darwin/test/MGLSourceQueryTests.m b/platform/darwin/test/MGLSourceQueryTests.m index d1ef180a52..b321da1ea4 100644 --- a/platform/darwin/test/MGLSourceQueryTests.m +++ b/platform/darwin/test/MGLSourceQueryTests.m @@ -7,8 +7,8 @@ @implementation MGLSourceQueryTests -- (void) testQueryVectorSource { - MGLVectorSource *source = [[MGLVectorSource alloc] initWithIdentifier:@"vector" tileURLTemplates:@[@"fake"] options:nil]; +- (void) testQueryVectorTileSource { + MGLVectorTileSource *source = [[MGLVectorTileSource alloc] initWithIdentifier:@"vector" tileURLTemplates:@[@"fake"] options:nil]; NSSet *sourceLayers = [NSSet setWithObjects:@"buildings", @"water", nil]; NSArray* features = [source featuresInSourceLayersWithIdentifiers:sourceLayers predicate:nil]; // Source not added yet, so features is 0 diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm index b9fbe1cfd4..7b1cc56ba4 100644 --- a/platform/darwin/test/MGLStyleTests.mm +++ b/platform/darwin/test/MGLStyleTests.mm @@ -161,14 +161,14 @@ [self.style addSource:rasterTileSource]; XCTAssertThrowsSpecificNamed([self.style addSource:rasterTileSource], NSException, @"MGLRedundantSourceException"); - MGLVectorSource *vectorSource = [[MGLVectorSource alloc] initWithIdentifier:@"vectorSource" configurationURL:[NSURL URLWithString:@".json"]]; - [self.style addSource:vectorSource]; - XCTAssertThrowsSpecificNamed([self.style addSource:vectorSource], NSException, @"MGLRedundantSourceException"); + MGLVectorTileSource *vectorTileSource = [[MGLVectorTileSource alloc] initWithIdentifier:@"vectorTileSource" configurationURL:[NSURL URLWithString:@".json"]]; + [self.style addSource:vectorTileSource]; + XCTAssertThrowsSpecificNamed([self.style addSource:vectorTileSource], NSException, @"MGLRedundantSourceException"); } - (void)testAddingSourcesWithDuplicateIdentifiers { - MGLVectorSource *source1 = [[MGLVectorSource alloc] initWithIdentifier:@"my-source" configurationURL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]]; - MGLVectorSource *source2 = [[MGLVectorSource alloc] initWithIdentifier:@"my-source" configurationURL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]]; + MGLVectorTileSource *source1 = [[MGLVectorTileSource alloc] initWithIdentifier:@"my-source" configurationURL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]]; + MGLVectorTileSource *source2 = [[MGLVectorTileSource alloc] initWithIdentifier:@"my-source" configurationURL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]]; [self.style addSource: source1]; XCTAssertThrowsSpecificNamed([self.style addSource: source2], NSException, @"MGLRedundantSourceIdentifierException"); @@ -185,10 +185,10 @@ [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]); + MGLVectorTileSource *vectorTileSource = [[MGLVectorTileSource alloc] initWithIdentifier:@"vector-tile-source" tileURLTemplates:@[] options:nil]; + [self.style removeSource:vectorTileSource]; + [self.style addSource:vectorTileSource]; + XCTAssertNotNil([self.style sourceWithIdentifier:vectorTileSource.identifier]); } - (void)testAddingSourceOfTypeABeforeSourceOfTypeBWithSameIdentifier { @@ -208,22 +208,22 @@ // Add the shape source [self.style addSource:imageSource]; - // Attempt to remove a vector source with the same identifer as the shape source - MGLVectorSource *vectorSource = [[MGLVectorSource alloc] initWithIdentifier:@"some-identifier" tileURLTemplates:@[] options:nil]; - [self.style removeSource:vectorSource]; + // Attempt to remove a vector tile source with the same identifer as the shape source + MGLVectorTileSource *vectorTileSource = [[MGLVectorTileSource alloc] initWithIdentifier:@"some-identifier" tileURLTemplates:@[] options:nil]; + [self.style removeSource:vectorTileSource]; // The image source should still be added XCTAssertTrue([[self.style sourceWithIdentifier:imageSource.identifier] isMemberOfClass:[MGLImageSource class]]); // Remove the image source [self.style removeSource:imageSource]; - // Add the vector source - [self.style addSource:vectorSource]; + // Add the vector tile source + [self.style addSource:vectorTileSource]; // Attempt to remove the previously created raster tile source that has the same identifer as the shape source [self.style removeSource:rasterTileSource]; - // The vector source should still be added - XCTAssertTrue([[self.style sourceWithIdentifier:imageSource.identifier] isMemberOfClass:[MGLVectorSource class]]); + // The vector tile source should still be added + XCTAssertTrue([[self.style sourceWithIdentifier:imageSource.identifier] isMemberOfClass:[MGLVectorTileSource class]]); } - (void)testRemovingSourceInUse { @@ -289,7 +289,7 @@ - (void)testAddingLayersWithDuplicateIdentifiers { // Just some source - MGLVectorSource *source = [[MGLVectorSource alloc] initWithIdentifier:@"my-source" configurationURL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]]; + MGLVectorTileSource *source = [[MGLVectorTileSource alloc] initWithIdentifier:@"my-source" configurationURL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]]; [self.style addSource: source]; // Add initial layer -- cgit v1.2.1