aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo
diff options
context:
space:
mode:
authorMichael Keppler <michael.keppler@gmx.de>2014-04-26 09:32:54 +0200
committerMichael Keppler <michael.keppler@gmx.de>2014-04-26 09:32:54 +0200
commit087a8a0c4a8be25f8b10a2d2fceb6fb595740acf (patch)
treeaa5b0440b44de87794533021c61925da0c7fd998 /tests/src/cgeo
parent530440bbb9ce55f96395055abe86dcdcac3ca2a6 (diff)
downloadcgeo-087a8a0c4a8be25f8b10a2d2fceb6fb595740acf.zip
cgeo-087a8a0c4a8be25f8b10a2d2fceb6fb595740acf.tar.gz
cgeo-087a8a0c4a8be25f8b10a2d2fceb6fb595740acf.tar.bz2
fix #3677: more fields in GPX export
Diffstat (limited to 'tests/src/cgeo')
-rw-r--r--tests/src/cgeo/geocaching/export/GpxSerializerTest.java35
1 files changed, 33 insertions, 2 deletions
diff --git a/tests/src/cgeo/geocaching/export/GpxSerializerTest.java b/tests/src/cgeo/geocaching/export/GpxSerializerTest.java
index f64796a..809c121 100644
--- a/tests/src/cgeo/geocaching/export/GpxSerializerTest.java
+++ b/tests/src/cgeo/geocaching/export/GpxSerializerTest.java
@@ -28,9 +28,9 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase {
"<gpx version=\"1.0\" creator=\"c:geo - http://www.cgeo.org/\" " +
"xsi:schemaLocation=\"http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd " +
"http://www.groundspeak.com/cache/1/0 http://www.groundspeak.com/cache/1/0/1/cache.xsd " +
- "http://www.gsak.net/xmlv1/4 http://www.gsak.net/xmlv1/4/gsak.xsd\" " +
+ "http://www.gsak.net/xmlv1/6 http://www.gsak.net/xmlv1/6/gsak.xsd\" " +
"xmlns=\"http://www.topografix.com/GPX/1/0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
- "xmlns:groundspeak=\"http://www.groundspeak.com/cache/1/0\" xmlns:gsak=\"http://www.gsak.net/xmlv1/4\" " +
+ "xmlns:groundspeak=\"http://www.groundspeak.com/cache/1/0\" xmlns:gsak=\"http://www.gsak.net/xmlv1/6\" " +
"xmlns:cgeo=\"http://www.cgeo.org/wptext/1/0\" />");
}
@@ -88,4 +88,35 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase {
return writer.toString();
}
+ public static void testStateFromStateCountry() throws Exception {
+ Geocache cache = withLocation("state, country");
+ assertThat(GpxSerializer.getState(cache)).isEqualTo("state");
+ }
+
+ public static void testCountryFromStateCountry() throws Exception {
+ Geocache cache = withLocation("state, country");
+ assertThat(GpxSerializer.getCountry(cache)).isEqualTo("country");
+ }
+
+ public static void testCountryFromCountryOnly() throws Exception {
+ Geocache cache = withLocation("somewhere");
+ assertThat(GpxSerializer.getCountry(cache)).isEqualTo("somewhere");
+ }
+
+ public static void testStateFromCountryOnly() throws Exception {
+ Geocache cache = withLocation("somewhere");
+ assertThat(GpxSerializer.getState(cache)).isEmpty();
+ }
+
+ public static void testCountryFromExternalCommaString() throws Exception {
+ Geocache cache = withLocation("first,second"); // this was not created by c:geo, therefore don't split it
+ assertThat(GpxSerializer.getState(cache)).isEmpty();
+ }
+
+ private static Geocache withLocation(final String location) {
+ Geocache cache = new Geocache();
+ cache.setLocation(location);
+ return cache;
+ }
+
}