aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-04-06 15:43:28 +0200
committerBananeweizen <bananeweizen@gmx.de>2013-04-06 15:43:28 +0200
commit0856587453f4df9379cda95891b9a785f3673095 (patch)
tree7fe08476212a4ea9f45066ba12e3d65ac3857ff3 /tests
parent6d6ada1924129ee0b97a6dab7427f134faca0178 (diff)
downloadcgeo-0856587453f4df9379cda95891b9a785f3673095.zip
cgeo-0856587453f4df9379cda95891b9a785f3673095.tar.gz
cgeo-0856587453f4df9379cda95891b9a785f3673095.tar.bz2
fix #2555: try to detect waypoint type in personal note
Diffstat (limited to 'tests')
-rw-r--r--tests/src/cgeo/geocaching/connector/gc/GCParserTest.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
index cf1df46..ff7ddff 100644
--- a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
+++ b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
@@ -7,6 +7,7 @@ import cgeo.geocaching.Settings;
import cgeo.geocaching.Waypoint;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.enumerations.StatusCode;
+import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.test.AbstractResourceInstrumentationTestCase;
import cgeo.geocaching.test.R;
@@ -22,6 +23,7 @@ import android.os.Handler;
import android.test.suitebuilder.annotation.MediumTest;
import java.util.ArrayList;
+import java.util.List;
public class GCParserTest extends AbstractResourceInstrumentationTestCase {
@@ -187,6 +189,22 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase {
assertEquals(13, cache.getWaypoints().size());
}
+ public static void testNoteParsingWaypointTypes() {
+ final Geocache cache = new Geocache();
+ cache.setWaypoints(new ArrayList<Waypoint>(), false);
+ cache.setPersonalNote("\"Parking area at PARKING=N 50° 40.666E 006° 58.222\n" +
+ "My calculated final coordinates: FINAL=N 50° 40.777E 006° 58.111\n" +
+ "Get some ice cream at N 50° 40.555E 006° 58.000\"");
+
+ cache.parseWaypointsFromNote();
+ final List<Waypoint> waypoints = cache.getWaypoints();
+
+ assertEquals(3, waypoints.size());
+ assertEquals(WaypointType.PARKING, waypoints.get(0).getWaypointType());
+ assertEquals(WaypointType.FINAL, waypoints.get(1).getWaypointType());
+ assertEquals(WaypointType.WAYPOINT, waypoints.get(2).getWaypointType());
+ }
+
private Geocache parseCache(int resourceId) {
final String page = getFileContent(resourceId);
final SearchResult result = GCParser.parseCacheFromText(page, null);