diff options
author | blafoo <github@blafoo.de> | 2012-03-18 23:57:34 +0100 |
---|---|---|
committer | blafoo <github@blafoo.de> | 2012-03-18 23:57:34 +0100 |
commit | e666a0aeccb85ff6782c22686f48a9186a4634a9 (patch) | |
tree | 0a1ae96f8bd9b2b01f892c938bf0c689746ec47d | |
parent | 762d3dfbd8059b10393a791a2e6990827c3634df (diff) | |
download | cgeo-e666a0aeccb85ff6782c22686f48a9186a4634a9.zip cgeo-e666a0aeccb85ff6782c22686f48a9186a4634a9.tar.gz cgeo-e666a0aeccb85ff6782c22686f48a9186a4634a9.tar.bz2 |
Unit test for #1268
-rw-r--r-- | main/src/cgeo/geocaching/cgCache.java | 1 | ||||
-rw-r--r-- | tests/src/cgeo/geocaching/cgeoApplicationTest.java | 19 |
2 files changed, 17 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java index 155d150..62f114f 100644 --- a/main/src/cgeo/geocaching/cgCache.java +++ b/main/src/cgeo/geocaching/cgCache.java @@ -219,6 +219,7 @@ public class cgCache implements ICache { coords = other.coords; } if (zoomlevel < other.zoomlevel) { + zoomlevel = other.zoomlevel; coords = other.coords; } diff --git a/tests/src/cgeo/geocaching/cgeoApplicationTest.java b/tests/src/cgeo/geocaching/cgeoApplicationTest.java index 3f5f9ec..89c46c4 100644 --- a/tests/src/cgeo/geocaching/cgeoApplicationTest.java +++ b/tests/src/cgeo/geocaching/cgeoApplicationTest.java @@ -226,16 +226,17 @@ public class cgeoApplicationTest extends ApplicationTestCase<cgeoapplication> { public static void testSearchByViewport() { Strategy strategy = Settings.getLiveMapStrategy(); - Settings.setLiveMapStrategy(Strategy.DETAILED); try { GC2CJPF mockedCache = new GC2CJPF(); - deleteCacheFromDB(mockedCache.getGeocode()); final String tokens[] = GCBase.getTokens(); final Viewport viewport = new Viewport(mockedCache.getCoords(), 0.003, 0.003); - final SearchResult search = ConnectorFactory.searchByViewport(viewport, tokens); + + // check coords for DETAILED + Settings.setLiveMapStrategy(Strategy.DETAILED); + SearchResult search = ConnectorFactory.searchByViewport(viewport, tokens); assertNotNull(search); assertTrue(search.getGeocodes().contains(mockedCache.getGeocode())); @@ -243,6 +244,18 @@ public class cgeoApplicationTest extends ApplicationTestCase<cgeoapplication> { assertEquals(Settings.isPremiumMember(), mockedCache.getCoords().isEqualTo(parsedCache.getCoords())); assertEquals(Settings.isPremiumMember(), parsedCache.isReliableLatLon()); + + // check update after switch strategy to FAST + Settings.setLiveMapStrategy(Strategy.FAST); + search = ConnectorFactory.searchByViewport(viewport, tokens); + assertNotNull(search); + assertTrue(search.getGeocodes().contains(mockedCache.getGeocode())); + + parsedCache = cgeoapplication.getInstance().loadCache(mockedCache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB); + + assertEquals(Settings.isPremiumMember(), mockedCache.getCoords().isEqualTo(parsedCache.getCoords())); + assertEquals(Settings.isPremiumMember(), parsedCache.isReliableLatLon()); + } finally { Settings.setLiveMapStrategy(strategy); } |