From 33ceb51ad3220bad6aaa6cb741d1365fcb061027 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Wed, 9 Nov 2011 20:11:43 +0100 Subject: Accept any coordinate when creating a Geopoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Google maps may return coordinates outside of our comfort zone. Also, we need to deal with viewports encompassing the 180° meridian. This fixes #771. --- .../src/cgeo/geocaching/geopoint/GeopointTest.java | 25 +--------------------- 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'tests/src') diff --git a/tests/src/cgeo/geocaching/geopoint/GeopointTest.java b/tests/src/cgeo/geocaching/geopoint/GeopointTest.java index 068b8cc..e67bc99 100644 --- a/tests/src/cgeo/geocaching/geopoint/GeopointTest.java +++ b/tests/src/cgeo/geocaching/geopoint/GeopointTest.java @@ -1,8 +1,5 @@ package cgeo.geocaching.geopoint; -import cgeo.geocaching.geopoint.Geopoint; -import cgeo.geocaching.geopoint.Geopoint.GeopointException; - import android.test.AndroidTestCase; import junit.framework.Assert; @@ -16,7 +13,7 @@ public class GeopointTest extends AndroidTestCase { } public static void testCreationAtLimit() { - // No exception should be raised at limits. + // No exception should be raised. final Geopoint gp1 = new Geopoint(90.0, 10.0); Assert.assertEquals(90, gp1.getLatitude(), 1e-8); @@ -25,26 +22,6 @@ public class GeopointTest extends AndroidTestCase { final Geopoint gp3 = new Geopoint(10.0, 180.0); Assert.assertEquals(180, gp3.getLongitude(), 1e-8); - - // 180 should be preferred to -180 - final Geopoint gp4 = new Geopoint(10.0, -180.0); - Assert.assertEquals(180, gp4.getLongitude(), 1e-8); - } - - private static void createShouldFail(final double lat, final double lon) { - try { - final Geopoint gp = new Geopoint(lat, lon); - Assert.fail("creation should fail: " + gp); - } catch (GeopointException e) { - // Success - } - } - - public static void testCreationFails() { - createShouldFail(90.1, 0.0); - createShouldFail(-90.1, 0.0); - createShouldFail(0.0, 180.1); - createShouldFail(0.0, -180.1); } public static void testEqual() { -- cgit v1.1