diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2011-11-09 20:11:43 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2011-11-09 20:27:34 +0100 |
| commit | 33ceb51ad3220bad6aaa6cb741d1365fcb061027 (patch) | |
| tree | d59ba5dbadcbf79c3c2b50803fc8d81fc260e2e9 /tests/src/cgeo/geocaching/geopoint/GeopointTest.java | |
| parent | 03a048d95b13021908ea6c66cb03dd11bf2364d5 (diff) | |
| download | cgeo-33ceb51ad3220bad6aaa6cb741d1365fcb061027.zip cgeo-33ceb51ad3220bad6aaa6cb741d1365fcb061027.tar.gz cgeo-33ceb51ad3220bad6aaa6cb741d1365fcb061027.tar.bz2 | |
Accept any coordinate when creating a Geopoint
Google maps may return coordinates outside of our comfort zone. Also,
we need to deal with viewports encompassing the 180° meridian.
This fixes #771.
Diffstat (limited to 'tests/src/cgeo/geocaching/geopoint/GeopointTest.java')
| -rw-r--r-- | tests/src/cgeo/geocaching/geopoint/GeopointTest.java | 25 |
1 files changed, 1 insertions, 24 deletions
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() { |
