aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/geopoint
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-08-20 08:05:48 +0200
committerBananeweizen <bananeweizen@gmx.de>2013-08-20 08:05:48 +0200
commitc08ef3d80d4847389f0e6a39a254d6ec567260f8 (patch)
tree672d4f29dd8dd4542ba84dbcca1676040189b794 /tests/src/cgeo/geocaching/geopoint
parent672b3ca96cfb8273c0eafaa0ed3e1da73244af39 (diff)
downloadcgeo-c08ef3d80d4847389f0e6a39a254d6ec567260f8.zip
cgeo-c08ef3d80d4847389f0e6a39a254d6ec567260f8.tar.gz
cgeo-c08ef3d80d4847389f0e6a39a254d6ec567260f8.tar.bz2
fix #2867: Multiple distance
* workaround distance calculation for all 4.2.x versions
Diffstat (limited to 'tests/src/cgeo/geocaching/geopoint')
-rw-r--r--tests/src/cgeo/geocaching/geopoint/GeopointTest.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/src/cgeo/geocaching/geopoint/GeopointTest.java b/tests/src/cgeo/geocaching/geopoint/GeopointTest.java
index e64028f..9e65a02 100644
--- a/tests/src/cgeo/geocaching/geopoint/GeopointTest.java
+++ b/tests/src/cgeo/geocaching/geopoint/GeopointTest.java
@@ -1,10 +1,11 @@
package cgeo.geocaching.geopoint;
-import junit.framework.Assert;
-
+import android.os.Build;
import android.os.Bundle;
import android.test.AndroidTestCase;
+import junit.framework.Assert;
+
public class GeopointTest extends AndroidTestCase {
public static void testCreation() {
@@ -49,7 +50,15 @@ public class GeopointTest extends AndroidTestCase {
final Geopoint gp2 = new Geopoint(-30.1, -2.3);
final float d12 = gp1.distanceTo(gp2);
- Assert.assertEquals(110.967995, d12, 1e-6);
+
+ // broken distance calculation in 4.2.1
+ if (Build.VERSION.SDK_INT == 17) {
+ Assert.assertEquals(110.83107, d12, 1e-6);
+ }
+ else {
+ Assert.assertEquals(110.967995, d12, 1e-6);
+ }
+
Assert.assertEquals(d12, gp2.distanceTo(gp1), 1e-6);
// Bearing in both directions cannot be added, as this is