diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2018-03-27 00:39:59 +0300 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2018-08-20 22:49:01 +0300 |
commit | ca0f2f925d38c190957241f7fa2375a90fa87f45 (patch) | |
tree | 92b642bb87e1fd25e22bc9458ae6c7155237472f /platform/darwin/test/MGLOfflineRegionTests.m | |
parent | 4fedcf8d061d835e71df80dbc20a32ee4ec8fd21 (diff) | |
download | qtlocation-mapboxgl-ca0f2f925d38c190957241f7fa2375a90fa87f45.tar.gz |
[darwin] arbitrary offline region geometries
Diffstat (limited to 'platform/darwin/test/MGLOfflineRegionTests.m')
-rw-r--r-- | platform/darwin/test/MGLOfflineRegionTests.m | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/platform/darwin/test/MGLOfflineRegionTests.m b/platform/darwin/test/MGLOfflineRegionTests.m index da9928741b..eac6da9b54 100644 --- a/platform/darwin/test/MGLOfflineRegionTests.m +++ b/platform/darwin/test/MGLOfflineRegionTests.m @@ -17,7 +17,7 @@ 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 |