summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLOfflineRegionTests.m
diff options
context:
space:
mode:
authorWilhelm Berg <wb@BergWerk-GIS.at>2018-08-22 16:56:32 +0200
committerWilhelm Berg <wb@BergWerk-GIS.at>2018-08-22 16:56:32 +0200
commit797f622a26b34db5a30e7f1728d87c6700a2ec1e (patch)
tree75ea93979db2baf3eb2234c6fbb3d1a9c5b70329 /platform/darwin/test/MGLOfflineRegionTests.m
parent86fc3f525e42d042f239876b93525ff411ad7182 (diff)
parent520df7f02049cdbbb9e68041e755d6c3a8d5b21f (diff)
downloadqtlocation-mapboxgl-797f622a26b34db5a30e7f1728d87c6700a2ec1e.tar.gz
Merge branch 'master' of github.com:mapbox/mapbox-gl-native into bwg-vs2017
Diffstat (limited to 'platform/darwin/test/MGLOfflineRegionTests.m')
-rw-r--r--platform/darwin/test/MGLOfflineRegionTests.m20
1 files changed, 18 insertions, 2 deletions
diff --git a/platform/darwin/test/MGLOfflineRegionTests.m b/platform/darwin/test/MGLOfflineRegionTests.m
index ff079fe798..eac6da9b54 100644
--- a/platform/darwin/test/MGLOfflineRegionTests.m
+++ b/platform/darwin/test/MGLOfflineRegionTests.m
@@ -14,10 +14,10 @@
XCTAssertEqualObjects(region.styleURL, [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion], @"Streets isn’t the default style.");
NSURL *localURL = [NSURL URLWithString:@"beautiful.style"];
- XCTAssertThrowsSpecificNamed([[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:localURL bounds:bounds fromZoomLevel:0 toZoomLevel:DBL_MAX], NSException, @"Invalid style URL", @"No exception raised when initializing region with a local file URL as the style URL.");
+ XCTAssertThrowsSpecificNamed([[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:localURL bounds:bounds fromZoomLevel:0 toZoomLevel:DBL_MAX], NSException, MGLInvalidStyleURLException, @"No exception raised when initializing region with a local file URL as the style URL.");
}
-- (void)testEquality {
+- (void)testTilePyramidRegionEquality {
MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid);
MGLTilePyramidOfflineRegion *original = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion] bounds:bounds fromZoomLevel:5 toZoomLevel:10];
MGLTilePyramidOfflineRegion *copy = [original copy];
@@ -29,4 +29,20 @@
XCTAssertEqual(original.maximumZoomLevel, original.maximumZoomLevel, @"Maximum zoom level has changed.");
}
+- (void)testGeometryRegionEquality {
+ NSString *geojson = @"{\"type\": \"Point\", \"coordinates\": [-3.8671874999999996, 52.482780222078226] }";
+ NSError *error;
+ MGLShape *shape = [MGLShape shapeWithData: [geojson dataUsingEncoding:NSUTF8StringEncoding] encoding: NSUTF8StringEncoding error:&error];
+ XCTAssertNil(error);
+
+ MGLShapeOfflineRegion *original = [[MGLShapeOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion] shape:shape fromZoomLevel:5 toZoomLevel:10];
+ MGLShapeOfflineRegion *copy = [original copy];
+ XCTAssertEqualObjects(original, copy, @"Shape region should be equal to its copy.");
+
+ XCTAssertEqualObjects(original.styleURL, copy.styleURL, @"Style URL has changed.");
+ XCTAssertEqualObjects(original.shape, copy.shape, @"Geometry has changed.");
+ XCTAssertEqual(original.minimumZoomLevel, original.minimumZoomLevel, @"Minimum zoom level has changed.");
+ XCTAssertEqual(original.maximumZoomLevel, original.maximumZoomLevel, @"Maximum zoom level has changed.");
+}
+
@end