[android] - unwrap LatLngBounds for the shortest path when passing to core (#11759)

This commit is contained in:
Łukasz Paczos
2018-04-24 11:31:29 +02:00
committed by GitHub
parent c5625f988a
commit eb39c80604
3 changed files with 66 additions and 14 deletions

View File

@@ -524,7 +524,6 @@ public class LatLngBoundsTest {
LatLngBounds.from(0, Double.POSITIVE_INFINITY, -20, -20);
}
@Test
public void testConstructorChecksSouthLatitudeNaN() {
exception.expect(IllegalArgumentException.class);
@@ -543,7 +542,7 @@ public class LatLngBoundsTest {
public void testConstructorChecksSouthLatitudeGreaterThan90() {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("latitude must be between -90 and 90");
LatLngBounds.from(20, 20,95, 0);
LatLngBounds.from(20, 20, 95, 0);
}
@Test
@@ -566,4 +565,23 @@ public class LatLngBoundsTest {
exception.expectMessage("LatSouth cannot be less than latNorth");
LatLngBounds.from(0, 20, 20, 0);
}
@Test
public void testCopyConstructor() {
LatLngBounds bounds = LatLngBounds.from(50, 10, -20, -30);
LatLngBounds copyBounds = new LatLngBounds(bounds);
assertEquals(bounds, copyBounds);
}
@Test
public void testUnwrapBounds() {
LatLngBounds bounds = LatLngBounds.from(16.5, -172.8, -35.127709, 172.6);
LatLngBounds unwrappedBounds = bounds.unwrapBounds();
assertEquals(bounds.getCenter().wrap(), unwrappedBounds.getCenter().wrap());
assertEquals(bounds.getSpan(), unwrappedBounds.getSpan());
assertTrue(unwrappedBounds.getLonEast() < 0 && unwrappedBounds.getLonWest() < 0);
LatLngBounds bounds2 = LatLngBounds.from(16.5, -162.8, -35.127709, -177.4);
assertEquals(bounds2, bounds2.unwrapBounds());
}
}