aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2013-07-09 21:53:53 +0200
committerSamuel Tardieu <sam@rfc1149.net>2013-07-14 13:50:37 +0200
commitf5a8c176e160812b7350f88d7bc4d3014e3ec060 (patch)
tree3734c66adbb827fc2440b71398c6f9d7e290fcfa /tests/src/cgeo
parentb7a84cf3cd81526f3396735e2134771a73cbb7a7 (diff)
downloadcgeo-f5a8c176e160812b7350f88d7bc4d3014e3ec060.zip
cgeo-f5a8c176e160812b7350f88d7bc4d3014e3ec060.tar.gz
cgeo-f5a8c176e160812b7350f88d7bc4d3014e3ec060.tar.bz2
Remove elevation handling
Geocaches do not contain useful elevation information. We used to get it using Google API, but the information was not very useful because our handling of altitude was inconsistent. Also, the Google elevation API usage limits states that "the Elevation API may only be used in conjunction with displaying results on a Google map; using elevation data without displaying a map for which elevation data was requested is prohibited". This removes elevation handling completely, except in the settings to avoid getting in the way of the settings rewrite. The elevation related settings should be removed there instead when both works are merged.
Diffstat (limited to 'tests/src/cgeo')
-rw-r--r--tests/src/cgeo/geocaching/geopoint/GeopointTest.java8
-rw-r--r--tests/src/cgeo/geocaching/geopoint/UnitsTest.java33
2 files changed, 2 insertions, 39 deletions
diff --git a/tests/src/cgeo/geocaching/geopoint/GeopointTest.java b/tests/src/cgeo/geocaching/geopoint/GeopointTest.java
index 8aaeef8..e64028f 100644
--- a/tests/src/cgeo/geocaching/geopoint/GeopointTest.java
+++ b/tests/src/cgeo/geocaching/geopoint/GeopointTest.java
@@ -1,10 +1,10 @@
package cgeo.geocaching.geopoint;
+import junit.framework.Assert;
+
import android.os.Bundle;
import android.test.AndroidTestCase;
-import junit.framework.Assert;
-
public class GeopointTest extends AndroidTestCase {
public static void testCreation() {
@@ -230,10 +230,6 @@ public class GeopointTest extends AndroidTestCase {
Assert.assertEquals(lonSecFrac, gp.getLonSecFrac());
}
- public static void testElevation() {
- assertEquals(125.663703918457, (new Geopoint(48.0, 2.0)).getElevation(), 0.1);
- }
-
private static void assertParseException(Runnable runnable) {
try {
runnable.run();
diff --git a/tests/src/cgeo/geocaching/geopoint/UnitsTest.java b/tests/src/cgeo/geocaching/geopoint/UnitsTest.java
index 3b7331c..52c5adf 100644
--- a/tests/src/cgeo/geocaching/geopoint/UnitsTest.java
+++ b/tests/src/cgeo/geocaching/geopoint/UnitsTest.java
@@ -42,39 +42,6 @@ public class UnitsTest extends CGeoTestCase {
// Make method non-static so that Settings is initialized
@SuppressWarnings("static-method")
- public void testElevation() {
- final boolean savedImperial = Settings.isUseImperialUnits();
- try {
- TestSettings.setUseImperialUnits(false);
- assertElevation("↥ 123 m", 122.782f);
- assertElevation("↥ 123 m", 123.456f);
- assertElevation("↥ 12 m", 12.3456f);
- assertElevation("↥ 1 m", 1.23456f);
- assertElevation("↥ 2 m", 1.6f);
- assertElevation("↥ 0 m", 0.123456f);
- assertElevation("↧ 123 m", -122.782f);
- assertElevation("↧ 123 m", -123.456f);
- assertElevation("↧ 12 m", -12.3456f);
- assertElevation("↧ 1 m", -1.23456f);
- assertElevation("↧ 2 m", -1.6f);
- assertElevation("↧ 0 m", -0.123456f);
- TestSettings.setUseImperialUnits(true);
- assertElevation("↥ 405 ft", 123.456f);
- assertElevation("↥ 41 ft", 12.3456f);
- } finally {
- TestSettings.setUseImperialUnits(savedImperial);
- }
- }
-
- private static void assertElevation(final String expected, final float meters) {
- final String actual = Units.getElevation(meters);
- if (!StringUtils.equals(expected, actual.replace(',', '.'))) {
- fail("elevation " + actual + " does not match expected " + expected);
- }
- }
-
- // Make method non-static so that Settings is initialized
- @SuppressWarnings("static-method")
public void testSpeed() {
assertEquals("?", Units.getDistanceFromKilometers(null));
final boolean savedImperial = Settings.isUseImperialUnits();