diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/connector/gc/AutoZoomTest.java')
| -rw-r--r-- | tests/src/cgeo/geocaching/connector/gc/AutoZoomTest.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/connector/gc/AutoZoomTest.java b/tests/src/cgeo/geocaching/connector/gc/AutoZoomTest.java new file mode 100644 index 0000000..234ff26 --- /dev/null +++ b/tests/src/cgeo/geocaching/connector/gc/AutoZoomTest.java @@ -0,0 +1,25 @@ +package cgeo.geocaching.connector.gc; + +import cgeo.geocaching.geopoint.Geopoint; + +import junit.framework.TestCase; + +public class AutoZoomTest extends TestCase { + + public static void testZoom1() { + Geopoint bottomLeft = new Geopoint(49.3, 8.3); + Geopoint topRight = new Geopoint(49.4, 8.4); + + int zoom = Tile.calcZoomLat(bottomLeft, topRight); + + assertTrue(Math.abs(new Tile(bottomLeft, zoom).getY() - new Tile(topRight, zoom).getY()) == 1); + assertTrue(Math.abs(new Tile(bottomLeft, zoom + 1).getY() - new Tile(topRight, zoom + 1).getY()) > 1); + + zoom = Tile.calcZoomLon(bottomLeft, topRight); + + assertTrue(new Tile(bottomLeft, zoom).getX() + 1 == new Tile(topRight, zoom).getX()); + assertTrue(new Tile(bottomLeft, zoom + 1).getX() + 1 < new Tile(topRight, zoom + 1).getX()); + + } + +} |
