summaryrefslogtreecommitdiff
path: root/platform/darwin/test
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2018-02-07 12:27:01 -0800
committerMinh Nguyễn <mxn@1ec5.org>2018-02-08 12:03:27 -0800
commitc3bf7c55a1f648e57c3853d555ff5f63c989f8c4 (patch)
treeb09d58daa5bbfbc5170cd1c27f423a3076fbae57 /platform/darwin/test
parent4498917a3b9dbf6cc9728da01f479a027f27f902 (diff)
downloadqtlocation-mapboxgl-c3bf7c55a1f648e57c3853d555ff5f63c989f8c4.tar.gz
[ios, macos] Added option to restrict tile source to bounds
Diffstat (limited to 'platform/darwin/test')
-rw-r--r--platform/darwin/test/MGLTileSetTests.mm14
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLTileSetTests.mm b/platform/darwin/test/MGLTileSetTests.mm
index 40eab5f974..4d5e1fcd05 100644
--- a/platform/darwin/test/MGLTileSetTests.mm
+++ b/platform/darwin/test/MGLTileSetTests.mm
@@ -2,6 +2,7 @@
#import <Mapbox/Mapbox.h>
#import "MGLTileSource_Private.h"
+#import "MGLGeometry_Private.h"
#include <mbgl/util/tileset.hpp>
@@ -40,6 +41,19 @@
XCTAssertEqual(tileSet.zoomRange.min, 1);
XCTAssertEqual(tileSet.zoomRange.max, 2);
+ // when the tile set has a bounds set
+ MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(CLLocationCoordinate2DMake(12, 34), CLLocationCoordinate2DMake(56, 78));
+ tileSet = MGLTileSetFromTileURLTemplates(@[@"tile.1"], @{
+ MGLTileSourceOptionCoordinateBounds: @(bounds),
+ });
+
+ // the mbgl object reflects the set values for the bounds
+ XCTAssert(!!tileSet.bounds, @"The bounds are set after setting the bounds");
+ if (tileSet.bounds) {
+ MGLCoordinateBounds actual = MGLCoordinateBoundsFromLatLngBounds(*tileSet.bounds);
+ XCTAssert(MGLCoordinateBoundsEqualToCoordinateBounds(bounds, actual), @"The bounds round-trip");
+ }
+
// when the tile set has an attribution
NSString *attribution = @"my tileset © ©️🎈";
tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, @{