summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLOfflineRegionTests.m
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-04-14 14:16:00 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-04-16 22:46:24 -0700
commitbe8f83770d0a86e15ff395958b970cd69ab9c2d7 (patch)
tree6ed8ce4f634ac0704b5f795c66aa0b70bdd1980c /platform/darwin/test/MGLOfflineRegionTests.m
parentf791eb32b9ebe96845e87e5a6acd3ee46182c1d5 (diff)
downloadqtlocation-mapboxgl-be8f83770d0a86e15ff395958b970cd69ab9c2d7.tar.gz
[ios, osx] Shared test bundle
The iOS and OS X SDKs now share a non-UI test bundle. Moved the iOS UI test bundle into a uitest/ subdirectory and moved the OS X SDK tests into the darwin/ subdirectory. Upgraded KIF to v3.4.2.
Diffstat (limited to 'platform/darwin/test/MGLOfflineRegionTests.m')
-rw-r--r--platform/darwin/test/MGLOfflineRegionTests.m35
1 files changed, 35 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLOfflineRegionTests.m b/platform/darwin/test/MGLOfflineRegionTests.m
new file mode 100644
index 0000000000..63befdf14c
--- /dev/null
+++ b/platform/darwin/test/MGLOfflineRegionTests.m
@@ -0,0 +1,35 @@
+#import <Mapbox/Mapbox.h>
+
+#pragma clang diagnostic ignored "-Wgnu-statement-expression"
+#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
+
+#import <XCTest/XCTest.h>
+
+@interface MGLOfflineRegionTests : XCTestCase
+
+@end
+
+@implementation MGLOfflineRegionTests
+
+- (void)testStyleURLs {
+ MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid);
+ MGLTilePyramidOfflineRegion *region = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:nil bounds:bounds fromZoomLevel:0 toZoomLevel:DBL_MAX];
+ XCTAssertEqualObjects(region.styleURL, [MGLStyle streetsStyleURL], @"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.");
+}
+
+- (void)testEquality {
+ MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid);
+ MGLTilePyramidOfflineRegion *original = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURL] 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, original.minimumZoomLevel, @"Minimum zoom level has changed.");
+ XCTAssertEqual(original.maximumZoomLevel, original.maximumZoomLevel, @"Maximum zoom level has changed.");
+}
+
+@end