summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-06-26 14:27:44 -0700
committerMinh Nguyễn <mxn@1ec5.org>2015-06-26 21:46:15 -0700
commitac2ad993a594e309362787e0697ff1727b799e8e (patch)
tree8347096c4f0c0de64bfadb514387b44d27427f66 /test
parent7b22caddd0bb58677cc29a29c005bec621368d4b (diff)
downloadqtlocation-mapboxgl-ac2ad993a594e309362787e0697ff1727b799e8e.tar.gz
Fit to coordinates
Whoever determined the boundaries of the District of Columbia did not have fit-to-bounds implementations in mind. With this change, shapes that are not unrotated rectangles fit much, much better.
Diffstat (limited to 'test')
-rw-r--r--test/ios/MapViewTests.m21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ios/MapViewTests.m b/test/ios/MapViewTests.m
index de4095497a..82360db231 100644
--- a/test/ios/MapViewTests.m
+++ b/test/ios/MapViewTests.m
@@ -183,6 +183,27 @@
@"after panning 30° to the east, setting visible coordinate bounds back to %@ should not leave them at %@",
MGLStringFromCoordinateBounds(initialBounds),
MGLStringFromCoordinateBounds(tester.mapView.visibleCoordinateBounds));
+
+ // Inscribed shapes with rotation
+ tester.mapView.direction = 45;
+ // https://en.wikipedia.org/wiki/Boundary_Markers_of_the_Original_District_of_Columbia
+ CLLocationCoordinate2D dcCoordinates[] = {
+ {38.790339, -77.040583},
+ {38.893219, -77.172304},
+ {38.995946, -77.040947},
+ {38.892829, -76.909229},
+ };
+ MGLCoordinateBounds dcBounds = {{38.790339, -77.172304}, {38.995946, -76.909229}};
+ [tester.mapView setVisibleCoordinateBounds:dcBounds
+ animated:NO];
+ double zoomLevel = tester.mapView.zoomLevel;
+ [tester.mapView setVisibleCoordinates:dcCoordinates
+ count:sizeof(dcCoordinates) / sizeof(dcCoordinates[0])
+ edgePadding:UIEdgeInsetsZero
+ animated:NO];
+ XCTAssertGreaterThan(tester.mapView.zoomLevel, zoomLevel,
+ @"when the map is rotated, DC should fit at a zoom level higher than %f, but instead the zoom level is %f",
+ zoomLevel, tester.mapView.zoomLevel);
}
- (void)testPan {