aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/connector/gc/WaypointsTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/cgeo/geocaching/connector/gc/WaypointsTest.java')
-rw-r--r--tests/src/cgeo/geocaching/connector/gc/WaypointsTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/connector/gc/WaypointsTest.java b/tests/src/cgeo/geocaching/connector/gc/WaypointsTest.java
new file mode 100644
index 0000000..f4b1e0c
--- /dev/null
+++ b/tests/src/cgeo/geocaching/connector/gc/WaypointsTest.java
@@ -0,0 +1,35 @@
+package cgeo.geocaching.connector.gc;
+
+import cgeo.CGeoTestCase;
+import cgeo.geocaching.SearchResult;
+import cgeo.geocaching.Geocache;
+import cgeo.geocaching.cgData;
+import cgeo.geocaching.enumerations.LoadFlags;
+import cgeo.geocaching.utils.CancellableHandler;
+
+import android.os.Message;
+
+public class WaypointsTest extends CGeoTestCase {
+
+ public static CancellableHandler handler = new CancellableHandler() {
+ @Override
+ protected void handleRegularMessage(final Message message) {
+ // Dummy
+ }
+ };
+
+ private static Geocache downloadCache(final String geocode) {
+ final SearchResult searchResult = Geocache.searchByGeocode(geocode, null, 0, true, handler);
+ assertEquals(1, searchResult.getCount());
+ return searchResult.getFirstCacheFromResult(LoadFlags.LOAD_WAYPOINTS);
+ }
+
+ public static void testDownloadWaypoints() {
+ // Check that repeated loads of "GC33HXE" hold the right number of waypoints (issue #2430).
+ final String GEOCODE = "GC33HXE";
+ cgData.removeCache(GEOCODE, LoadFlags.REMOVE_ALL);
+ assertEquals(9, downloadCache(GEOCODE).getWaypoints().size());
+ assertEquals(9, downloadCache(GEOCODE).getWaypoints().size());
+ }
+
+}