diff options
author | Jason Wray <friedbunny@users.noreply.github.com> | 2019-03-12 14:49:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-12 14:49:49 -0700 |
commit | fb1b6010383f9991c2e95b25bf96e17ff44961d9 (patch) | |
tree | fa1c234c44bcc279d4cd96277da548cb36f5b9fb /platform/darwin/test/MGLMapViewTests.m | |
parent | 103f86c4bca08c34c592edd481f078b7bf77cb3f (diff) | |
download | qtlocation-mapboxgl-fb1b6010383f9991c2e95b25bf96e17ff44961d9.tar.gz |
[darwin] Fix MGLMapView.direction wrapping
Re-adds the 0-to-360° wrapping for MGLMapView.direction. Without this wrapping, we’d get ±180° from core, which results in invalid CLLocationDirection for the negative half of the rotational spectrum.
Diffstat (limited to 'platform/darwin/test/MGLMapViewTests.m')
-rw-r--r-- | platform/darwin/test/MGLMapViewTests.m | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/platform/darwin/test/MGLMapViewTests.m b/platform/darwin/test/MGLMapViewTests.m index eb40ff724a..9a8e7bdb64 100644 --- a/platform/darwin/test/MGLMapViewTests.m +++ b/platform/darwin/test/MGLMapViewTests.m @@ -4,20 +4,27 @@ static MGLMapView *mapView; @interface MGLMapViewTests : XCTestCase - @end @implementation MGLMapViewTests -+ (void)setUp { +- (void)setUp { [super setUp]; [MGLAccountManager setAccessToken:@"pk.feedcafedeadbeefbadebede"]; - mapView = [[MGLMapView alloc] initWithFrame:CGRectMake(0, 0, 64, 64) styleURL:MGLStyle.streetsStyleURL]; - [mapView setCenterCoordinate:CLLocationCoordinate2DMake(33, 179)]; + NSURL *styleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"one-liner" withExtension:@"json"]; + mapView = [[MGLMapView alloc] initWithFrame:CGRectMake(0, 0, 64, 64) styleURL:styleURL]; +} + +- (void)tearDown { + mapView = nil; + [MGLAccountManager setAccessToken:nil]; + [super tearDown]; } - (void)testCoordinateBoundsConversion { + [mapView setCenterCoordinate:CLLocationCoordinate2DMake(33, 179)]; + MGLCoordinateBounds leftAntimeridianBounds = MGLCoordinateBoundsMake(CLLocationCoordinate2DMake(-75, 175), CLLocationCoordinate2DMake(75, 180)); CGRect leftAntimeridianBoundsRect = [mapView convertCoordinateBounds:leftAntimeridianBounds toRectToView:mapView]; @@ -30,14 +37,8 @@ static MGLMapView *mapView; // If the resulting CGRect from -convertCoordinateBounds:toRectToView: // intersects the set of bounds to the left and right of the // antimeridian, then we know that the CGRect spans across the antimeridian - XCTAssertTrue(CGRectIntersectsRect(spanningBoundsRect, leftAntimeridianBoundsRect), @"Resulting "); + XCTAssertTrue(CGRectIntersectsRect(spanningBoundsRect, leftAntimeridianBoundsRect), @"Resulting"); XCTAssertTrue(CGRectIntersectsRect(spanningBoundsRect, rightAntimeridianBoundsRect), @"Something"); } -+ (void)tearDown { - mapView = nil; - [MGLAccountManager setAccessToken:nil]; - [super tearDown]; -} - @end |