summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLOfflineRegionTests.m
diff options
context:
space:
mode:
authorm-stephen <truestyle2005@163.com>2019-07-16 11:39:34 +0800
committerGitHub <noreply@github.com>2019-07-16 11:39:34 +0800
commitd2434d07517619d390e2e1f4b7952f6cf2c9e4ff (patch)
tree80f44eb79ebf47dd2fb7ebf1a5a8835615d61ec9 /platform/darwin/test/MGLOfflineRegionTests.m
parent3c488e05efdb9415e658fa820504692b906c3443 (diff)
downloadqtlocation-mapboxgl-d2434d07517619d390e2e1f4b7952f6cf2c9e4ff.tar.gz
[ios , macos] Exclude CJK resources from offline download by default (#14952)
* [iOS, macOS] exclude CJK glyphs resources download by default. * [iOS, macOS] update iosapp * [iOS, macOS] update macOS * [iOS, macOS] update iOS change log * [iOS, macOS] update macOS change log * [iOS, macOS] update comment & add test cases * Update platform/darwin/test/MGLOfflineRegionTests.m Co-Authored-By: Jason Wray <friedbunny@users.noreply.github.com> * Update platform/darwin/test/MGLOfflineRegionTests.m Co-Authored-By: Jason Wray <friedbunny@users.noreply.github.com> * Update platform/darwin/test/MGLOfflineRegionTests.m Co-Authored-By: Jason Wray <friedbunny@users.noreply.github.com> * Update platform/ios/CHANGELOG.md Co-Authored-By: Jason Wray <friedbunny@users.noreply.github.com> * Update platform/macos/CHANGELOG.md Co-Authored-By: Jason Wray <friedbunny@users.noreply.github.com> * Update platform/darwin/test/MGLOfflineRegionTests.m Co-Authored-By: Jason Wray <friedbunny@users.noreply.github.com>
Diffstat (limited to 'platform/darwin/test/MGLOfflineRegionTests.m')
-rw-r--r--platform/darwin/test/MGLOfflineRegionTests.m24
1 files changed, 22 insertions, 2 deletions
diff --git a/platform/darwin/test/MGLOfflineRegionTests.m b/platform/darwin/test/MGLOfflineRegionTests.m
index 4d5767a8d2..0af9ebb5fa 100644
--- a/platform/darwin/test/MGLOfflineRegionTests.m
+++ b/platform/darwin/test/MGLOfflineRegionTests.m
@@ -12,7 +12,7 @@
MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid);
MGLTilePyramidOfflineRegion *region = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:nil bounds:bounds fromZoomLevel:0 toZoomLevel:DBL_MAX];
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, MGLInvalidStyleURLException, @"No exception raised when initializing region with a local file URL as the style URL.");
}
@@ -22,7 +22,7 @@
MGLTilePyramidOfflineRegion *original = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion] bounds:bounds fromZoomLevel:5 toZoomLevel:10];
MGLTilePyramidOfflineRegion *copy = [original copy];
XCTAssertEqualObjects(original, copy, @"Tile pyramid region should be equal to its copy.");
-
+
XCTAssertEqualObjects(original.styleURL, copy.styleURL, @"Style URL has changed.");
XCTAssert(MGLCoordinateBoundsEqualToCoordinateBounds(original.bounds, copy.bounds), @"Bounds have changed.");
XCTAssertEqual(original.minimumZoomLevel, copy.minimumZoomLevel, @"Minimum zoom level has changed.");
@@ -48,4 +48,24 @@
XCTAssertEqual(original.includesIdeographicGlyphs, copy.includesIdeographicGlyphs, @"Include ideographs has changed.");
}
+- (void)testIncludesIdeographicGlyphsByDefault {
+
+ // Tile pyramid offline region
+ {
+ MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid);
+ MGLTilePyramidOfflineRegion *tilePyramidOfflineRegion = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion] bounds:bounds fromZoomLevel:5 toZoomLevel:10];
+ XCTAssertFalse(tilePyramidOfflineRegion.includesIdeographicGlyphs, @"tile pyramid offline region should not include ideographic glyphs");
+ }
+
+ // Shape offline region
+ {
+ 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 *shapeOfflineRegion = [[MGLShapeOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion] shape:shape fromZoomLevel:5 toZoomLevel:10];
+ XCTAssertFalse(shapeOfflineRegion.includesIdeographicGlyphs, @"tile pyramid offline region should not include ideographic glyphs");
+ }
+}
+
@end