aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2013-04-01 23:58:38 +0200
committerSamuel Tardieu <sam@rfc1149.net>2013-04-02 00:04:01 +0200
commit4603290a0a79498815fe8d1d80460e4c0e97fe2b (patch)
treee8193c67052f84f3b01b81072e8e789e077e67af /tests/src
parent1c34648ec943ff4f407677f14203790257b79321 (diff)
downloadcgeo-4603290a0a79498815fe8d1d80460e4c0e97fe2b.zip
cgeo-4603290a0a79498815fe8d1d80460e4c0e97fe2b.tar.gz
cgeo-4603290a0a79498815fe8d1d80460e4c0e97fe2b.tar.bz2
fix #2624: coordinates display is wrong near a confluence point
The coordinates need to be rounded differently depending on the precision which will be used for the output.
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java b/tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java
index c0cea01..a1be25d 100644
--- a/tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java
+++ b/tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java
@@ -6,6 +6,17 @@ import android.test.AndroidTestCase;
public class GeoPointFormatterTest extends AndroidTestCase {
+ public static void testConfluence() {
+ // From issue #2624: coordinate is wrong near to a confluence point
+ final Geopoint point = new Geopoint(49.9999999999999, 5.0);
+ final String format = GeopointFormatter.format(GeopointFormatter.Format.LAT_LON_DECDEGREE_COMMA, point);
+ assertEquals("50.000000,5.000000", format);
+ final String formatMinute = GeopointFormatter.format(GeopointFormatter.Format.LAT_LON_DECMINUTE_RAW, point);
+ assertEquals("N 50° 00.000 E 005° 00.000", formatMinute);
+ final String formatSecond = GeopointFormatter.format(GeopointFormatter.Format.LAT_LON_DECSECOND, point).replaceAll(",", ".");
+ assertEquals(formatSecond, "N 50° 00' 00.000\"" + Formatter.SEPARATOR + "E 005° 00' 00.000\"", formatSecond);
+ }
+
public static void testFormat() {
// taken from GC30R6G
final Geopoint point = new Geopoint("N 51° 21.104 E 010° 15.369");