From ac2ad993a594e309362787e0697ff1727b799e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Fri, 26 Jun 2015 14:27:44 -0700 Subject: 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. --- test/ios/MapViewTests.m | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/ios') 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 { -- cgit v1.2.1