aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/geopoint
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-07-01 11:29:44 +0200
committerBananeweizen <bananeweizen@gmx.de>2012-07-01 11:29:44 +0200
commit13033f965e55d7abb6c0807c1853652fa51627ff (patch)
tree59fc08aa2bfa31c20ab89fa9cc21af101c5835ea /tests/src/cgeo/geocaching/geopoint
parent2b744ff80e20203f8d4e3e4a6891f799a500e8ac (diff)
downloadcgeo-13033f965e55d7abb6c0807c1853652fa51627ff.zip
cgeo-13033f965e55d7abb6c0807c1853652fa51627ff.tar.gz
cgeo-13033f965e55d7abb6c0807c1853652fa51627ff.tar.bz2
fix #1828: Coords conversion to DMS not working correct
Diffstat (limited to 'tests/src/cgeo/geocaching/geopoint')
-rw-r--r--tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java b/tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java
new file mode 100644
index 0000000..76c0f09
--- /dev/null
+++ b/tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java
@@ -0,0 +1,20 @@
+package cgeo.geocaching.geopoint;
+
+import cgeo.geocaching.ui.Formatter;
+
+import android.test.AndroidTestCase;
+
+public class GeoPointFormatterTest extends AndroidTestCase {
+
+ public static void testFormat() {
+ // taken from GC30R6G
+ Geopoint point = new Geopoint("N 51° 21.104 E 010° 15.369");
+ final String format = GeopointFormatter.format(GeopointFormatter.Format.LAT_LON_DECDEGREE_COMMA, point);
+ assertEquals(format, "51.351733,10.256150", format);
+ final String formatMinute = GeopointFormatter.format(GeopointFormatter.Format.LAT_LON_DECMINUTE_RAW, point);
+ assertEquals(formatMinute, "N 51° 21.104 E 010° 15.369", formatMinute);
+ final String formatSecond = GeopointFormatter.format(GeopointFormatter.Format.LAT_LON_DECSECOND, point).replaceAll(",", ".");
+ assertEquals(formatSecond, "N 51° 21' 06.240\"" + Formatter.SEPARATOR + "E 010° 15' 22.140\"", formatSecond);
+ }
+
+}