diff options
author | rsudev <rasch@munin-soft.de> | 2013-11-23 22:12:24 +0100 |
---|---|---|
committer | rsudev <rasch@munin-soft.de> | 2013-11-23 22:13:06 +0100 |
commit | 652722134c0d18dbe77dd952903a71ae14755d27 (patch) | |
tree | d3613d8d906b938de5d612b5f75b3cc72605f9c2 /tests/src/cgeo/geocaching/files | |
parent | 6240d934fc7e0d6b52fdf3b2cf21d0e72fdbf7c7 (diff) | |
download | cgeo-652722134c0d18dbe77dd952903a71ae14755d27.zip cgeo-652722134c0d18dbe77dd952903a71ae14755d27.tar.gz cgeo-652722134c0d18dbe77dd952903a71ae14755d27.tar.bz2 |
Implements stable keys for opencaching waypoints
additionally extend ex- and import (gpx) to also contain visited and
userdefined.
Diffstat (limited to 'tests/src/cgeo/geocaching/files')
-rw-r--r-- | tests/src/cgeo/geocaching/files/GPXImporterTest.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/files/GPXImporterTest.java b/tests/src/cgeo/geocaching/files/GPXImporterTest.java index 8f5d821..ee42d23 100644 --- a/tests/src/cgeo/geocaching/files/GPXImporterTest.java +++ b/tests/src/cgeo/geocaching/files/GPXImporterTest.java @@ -80,6 +80,29 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase { assertTrue(cache.getWaypoints().isEmpty()); } + public void testImportOcGpx() throws IOException { + final String geocode = "OCDDD2"; + removeCacheCompletely(geocode); + final File ocddd2 = new File(tempDir, "ocddd2.gpx"); + copyResourceToFile(R.raw.ocddd2, ocddd2); + + final GPXImporter.ImportGpxFileThread importThread = new GPXImporter.ImportGpxFileThread(ocddd2, listId, importStepHandler, progressHandler); + runImportThread(importThread); + + assertEquals(4, importStepHandler.messages.size()); + final Iterator<Message> iMsg = importStepHandler.messages.iterator(); + assertEquals(GPXImporter.IMPORT_STEP_START, iMsg.next().what); + assertEquals(GPXImporter.IMPORT_STEP_READ_FILE, iMsg.next().what); + assertEquals(GPXImporter.IMPORT_STEP_STORE_STATIC_MAPS, iMsg.next().what); + assertEquals(GPXImporter.IMPORT_STEP_FINISHED, iMsg.next().what); + final SearchResult search = (SearchResult) importStepHandler.messages.get(3).obj; + assertEquals(Collections.singletonList(geocode), new ArrayList<String>(search.getGeocodes())); + final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); + assertCacheProperties(cache); + + assertEquals("Incorrect number of waypoints imported", 4, cache.getWaypoints().size()); + } + private void runImportThread(GPXImporter.ImportThread importThread) { importThread.start(); try { |