[android] LatLngBounds.union() should take date line into account

This commit is contained in:
Osana Babayan
2018-02-28 10:10:09 -05:00
committed by GitHub
parent ab27e24ab0
commit f4833a2c4e
3 changed files with 54 additions and 4 deletions

View File

@@ -337,6 +337,27 @@ public class LatLngBoundsTest {
.build());
}
@Test
public void unionOverDateLine() {
LatLngBounds latLngBounds1 = new LatLngBounds.Builder()
.include(new LatLng(10, 170))
.include(new LatLng(0, 160))
.build();
LatLngBounds latLngBounds2 = new LatLngBounds.Builder()
.include(new LatLng(0, -170))
.include(new LatLng(-10, -160))
.build();
assertEquals("outer union should match",
latLngBounds1.union(latLngBounds2),
new LatLngBounds.Builder()
.include(new LatLng(10, 160))
.include(new LatLng(-10, -160))
.build());
}
@Test
public void northWest() {
double minLat = 5;