aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/res/values/strings.xml2
-rw-r--r--main/src/cgeo/geocaching/cgeocaches.java4
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCConstants.java2
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheSize.java18
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheType.java32
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java196
-rw-r--r--tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java7
-rw-r--r--tests/src/cgeo/geocaching/enumerations/CacheTypeTest.java15
8 files changed, 156 insertions, 120 deletions
diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml
index f9bcace..90ce91b 100644
--- a/main/res/values/strings.xml
+++ b/main/res/values/strings.xml
@@ -1039,7 +1039,7 @@
<string name="changelog">\n
<b>Next release</b>\n\n
<b>New Features/Functions:</b>\n
- · Add/remove cache to/from Favorites #676
+ · Add/remove cache to/from Favorites\n
· Export caches as GPX file\n
· Filter for D/T in lists\n
· Allow close of popup by click on map\n
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java
index 894671f..e24a4da 100644
--- a/main/src/cgeo/geocaching/cgeocaches.java
+++ b/main/src/cgeo/geocaching/cgeocaches.java
@@ -986,6 +986,7 @@ public class cgeocaches extends AbstractListActivity {
if (cacheLists.size() > 1) {
menu.add(0, MENU_MOVE_TO_LIST, 0, res.getString(R.string.cache_menu_move_list));
}
+ menu.add(0, MENU_EXPORT, 0, res.getString(R.string.export));
}
else {
menu.add(0, MENU_STORE_CACHE, 0, res.getString(R.string.cache_offline_store));
@@ -1070,6 +1071,9 @@ public class cgeocaches extends AbstractListActivity {
//FIXME: this must use the same handler like in the CacheDetailActivity. Will be done by moving the handler into the store method.
cache.store(null);
break;
+ case MENU_EXPORT:
+ ExportFactory.showExportMenu(Collections.singletonList(cache), this);
+ return false;
default:
// we must remember the menu info for the sub menu, there is a bug
// in Android:
diff --git a/main/src/cgeo/geocaching/connector/gc/GCConstants.java b/main/src/cgeo/geocaching/connector/gc/GCConstants.java
index 7edeec5..8d3a1ae 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCConstants.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCConstants.java
@@ -97,7 +97,7 @@ public final class GCConstants {
public final static Pattern PATTERN_TRACKABLE_ICON = Pattern.compile("<img id=\"ctl00_ContentBody_BugTypeImage\" class=\"TravelBugHeaderIcon\" src=\"([^\"]+)\"[^>]*>");
public final static Pattern PATTERN_TRACKABLE_TYPE = Pattern.compile("<img id=\"ctl00_ContentBody_BugTypeImage\" class=\"TravelBugHeaderIcon\" src=\"[^\"]+\" alt=\"([^\"]+)\"[^>]*>");
public final static Pattern PATTERN_TRACKABLE_DISTANCE = Pattern.compile("<h4[^>]*\\W*Tracking History \\(([0-9.,]+(km|mi))[^\\)]*\\)");
- public final static Pattern PATTERN_TRACKABLE_LOG = Pattern.compile("<tr class=\"Data.+?src=\"/images/icons/([^.]+)\\.gif[^>]+>&nbsp;([^<]+)</td>.+?guid.+?>([^<]+)</a>.+?(?:guid=([^\"]+)\">(<span class=\"Strike\">)?([^<]+)</.+?)?<td colspan=\"4\">(.+?)(?:<ul.+?ul>)?\\s*</td>\\s*</tr>");
+ public final static Pattern PATTERN_TRACKABLE_LOG = Pattern.compile("<tr class=\"Data.+?src=\"/images/icons/([^.]+)\\.gif[^>]+>&nbsp;([^<]+)</td>.+?guid.+?>([^<]+)</a>.+?(?:guid=([^\"]+)\">(<span[^>]+>)?([^<]+)</.+?)?<td colspan=\"4\">(.+?)(?:<ul.+?ul>)?\\s*</td>\\s*</tr>");
public final static Pattern PATTERN_TRACKABLE_LOG_IMAGES = Pattern.compile(".+?<li><a href=\"([^\"]+)\".+?LogImgTitle.+?>([^<]+)</");
/**
diff --git a/main/src/cgeo/geocaching/enumerations/CacheSize.java b/main/src/cgeo/geocaching/enumerations/CacheSize.java
index 6fffcdb..0c0be3f 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheSize.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheSize.java
@@ -13,14 +13,14 @@ import java.util.Map;
* @author koem
*/
public enum CacheSize {
- MICRO("micro", 1, R.string.cache_size_micro),
- SMALL("small", 2, R.string.cache_size_small),
- REGULAR("regular", 3, R.string.cache_size_regular),
- LARGE("large", 4, R.string.cache_size_large),
- VIRTUAL("virtual", 0, R.string.cache_size_virtual),
- NOT_CHOSEN("not chosen", 0, R.string.cache_size_notchosen),
- OTHER("other", 0, R.string.cache_size_other),
- UNKNOWN("unknown", 0, R.string.cache_size_unknown); // CacheSize not init. yet
+ MICRO("Micro", 1, R.string.cache_size_micro),
+ SMALL("Small", 2, R.string.cache_size_small),
+ REGULAR("Regular", 3, R.string.cache_size_regular),
+ LARGE("Large", 4, R.string.cache_size_large),
+ VIRTUAL("Virtual", 0, R.string.cache_size_virtual),
+ NOT_CHOSEN("Not chosen", 0, R.string.cache_size_notchosen),
+ OTHER("Other", 0, R.string.cache_size_other),
+ UNKNOWN("Unknown", 0, R.string.cache_size_unknown); // CacheSize not init. yet
public final String id;
public final int comparable;
@@ -36,7 +36,7 @@ public enum CacheSize {
static {
final HashMap<String, CacheSize> mapping = new HashMap<String, CacheSize>();
for (CacheSize cs : values()) {
- mapping.put(cs.id, cs);
+ mapping.put(cs.id.toLowerCase(), cs);
}
FIND_BY_ID = Collections.unmodifiableMap(mapping);
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheType.java b/main/src/cgeo/geocaching/enumerations/CacheType.java
index 9667911..86ff2c6 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheType.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheType.java
@@ -14,21 +14,21 @@ import java.util.Map;
*/
public enum CacheType {
- TRADITIONAL("traditional", "traditional cache", "32bc9333-5e52-4957-b0f6-5a2c8fc7b257", R.string.traditional, R.drawable.type_traditional),
- MULTI("multi", "multi-cache", "a5f6d0ad-d2f2-4011-8c14-940a9ebf3c74", R.string.multi, R.drawable.type_multi),
- MYSTERY("mystery", "unknown cache", "40861821-1835-4e11-b666-8d41064d03fe", R.string.mystery, R.drawable.type_mystery),
- LETTERBOX("letterbox", "letterbox hybrid", "4bdd8fb2-d7bc-453f-a9c5-968563b15d24", R.string.letterbox, R.drawable.type_letterbox),
- EVENT("event", "event cache", "69eb8534-b718-4b35-ae3c-a856a55b0874", R.string.event, R.drawable.type_event),
- MEGA_EVENT("mega", "mega-event cache", "69eb8535-b718-4b35-ae3c-a856a55b0874", R.string.mega, R.drawable.type_mega),
- EARTH("earth", "earthcache", "c66f5cf3-9523-4549-b8dd-759cd2f18db8", R.string.earth, R.drawable.type_earth),
- CITO("cito", "cache in trash out event", "57150806-bc1a-42d6-9cf0-538d171a2d22", R.string.cito, R.drawable.type_cito),
- WEBCAM("webcam", "webcam cache", "31d2ae3c-c358-4b5f-8dcd-2185bf472d3d", R.string.webcam, R.drawable.type_webcam),
- VIRTUAL("virtual", "virtual cache", "294d4360-ac86-4c83-84dd-8113ef678d7e", R.string.virtual, R.drawable.type_virtual),
- WHERIGO("wherigo", "wherigo cache", "0544fa55-772d-4e5c-96a9-36a51ebcf5c9", R.string.wherigo, R.drawable.type_wherigo),
- LOSTANDFOUND("lostfound", "lost & found", "3ea6533d-bb52-42fe-b2d2-79a3424d4728", R.string.lostfound, R.drawable.type_event), // icon missing
- PROJECT_APE("ape", "project ape cache", "2555690d-b2bc-4b55-b5ac-0cb704c0b768", R.string.ape, R.drawable.type_ape),
- GCHQ("gchq", "groundspeak hq", "416f2494-dc17-4b6a-9bab-1a29dd292d8c", R.string.gchq, R.drawable.type_hq),
- GPS_EXHIBIT("gps", "gps cache exhibit", "72e69af2-7986-4990-afd9-bc16cbbb4ce3", R.string.gps, R.drawable.type_traditional), // icon missing
+ TRADITIONAL("traditional", "Traditional Cache", "32bc9333-5e52-4957-b0f6-5a2c8fc7b257", R.string.traditional, R.drawable.type_traditional),
+ MULTI("multi", "Multi-cache", "a5f6d0ad-d2f2-4011-8c14-940a9ebf3c74", R.string.multi, R.drawable.type_multi),
+ MYSTERY("mystery", "Unknown Cache", "40861821-1835-4e11-b666-8d41064d03fe", R.string.mystery, R.drawable.type_mystery),
+ LETTERBOX("letterbox", "Letterbox hybrid", "4bdd8fb2-d7bc-453f-a9c5-968563b15d24", R.string.letterbox, R.drawable.type_letterbox),
+ EVENT("event", "Event Cache", "69eb8534-b718-4b35-ae3c-a856a55b0874", R.string.event, R.drawable.type_event),
+ MEGA_EVENT("mega", "Mega-event Cache", "69eb8535-b718-4b35-ae3c-a856a55b0874", R.string.mega, R.drawable.type_mega),
+ EARTH("earth", "Earthcache", "c66f5cf3-9523-4549-b8dd-759cd2f18db8", R.string.earth, R.drawable.type_earth),
+ CITO("cito", "Cache in Trash out Event", "57150806-bc1a-42d6-9cf0-538d171a2d22", R.string.cito, R.drawable.type_cito),
+ WEBCAM("webcam", "Webcam Cache", "31d2ae3c-c358-4b5f-8dcd-2185bf472d3d", R.string.webcam, R.drawable.type_webcam),
+ VIRTUAL("virtual", "Virtual Cache", "294d4360-ac86-4c83-84dd-8113ef678d7e", R.string.virtual, R.drawable.type_virtual),
+ WHERIGO("wherigo", "Wherigo Cache", "0544fa55-772d-4e5c-96a9-36a51ebcf5c9", R.string.wherigo, R.drawable.type_wherigo),
+ LOSTANDFOUND("lostfound", "Lost & Found", "3ea6533d-bb52-42fe-b2d2-79a3424d4728", R.string.lostfound, R.drawable.type_event), // icon missing
+ PROJECT_APE("ape", "Project Ape Cache", "2555690d-b2bc-4b55-b5ac-0cb704c0b768", R.string.ape, R.drawable.type_ape),
+ GCHQ("gchq", "Groundspeak HQ", "416f2494-dc17-4b6a-9bab-1a29dd292d8c", R.string.gchq, R.drawable.type_hq),
+ GPS_EXHIBIT("gps", "GPS Cache Exhibit", "72e69af2-7986-4990-afd9-bc16cbbb4ce3", R.string.gps, R.drawable.type_traditional), // icon missing
UNKNOWN("unknown", "unknown", "", R.string.unknown, R.drawable.type_unknown),
/** No real cache type -> filter */
ALL("all", "display all caches", "9a79e6ce-3344-409c-bbe9-496530baf758", R.string.all_types, R.drawable.type_unknown);
@@ -54,7 +54,7 @@ public enum CacheType {
final HashMap<String, CacheType> mappingPattern = new HashMap<String, CacheType>();
for (CacheType ct : values()) {
mappingId.put(ct.id, ct);
- mappingPattern.put(ct.pattern, ct);
+ mappingPattern.put(ct.pattern.toLowerCase(), ct);
}
FIND_BY_ID = Collections.unmodifiableMap(mappingId);
FIND_BY_PATTERN = Collections.unmodifiableMap(mappingPattern);
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index 554db2c..156d9d4 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -9,6 +9,7 @@ import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.activity.Progress;
import cgeo.geocaching.enumerations.CacheAttribute;
import cgeo.geocaching.enumerations.LoadFlags;
+import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.utils.BaseUtils;
import cgeo.geocaching.utils.Log;
@@ -46,6 +47,7 @@ class GpxExport extends AbstractExport {
private final Activity activity;
private final Progress progress = new Progress();
private File exportFile;
+ private Writer gpx;
/**
* Instantiates and configures the task for exporting field notes.
@@ -75,8 +77,6 @@ class GpxExport extends AbstractExport {
return false;
}
- Writer gpx = null;
-
try {
exportLocation.mkdirs();
@@ -90,11 +90,8 @@ class GpxExport extends AbstractExport {
for (int i = 0; i < caches.size(); i++) {
- cgCache cache = caches.get(i);
-
- if (!cache.isDetailed()) {
- cache = cgeoapplication.getInstance().loadCache(caches.get(i).getGeocode(), LoadFlags.LOAD_ALL_DB_ONLY);
- }
+ // reload the cache. otherwise logs, attributes and other detailed information is not available
+ final cgCache cache = cgeoapplication.getInstance().loadCache(caches.get(i).getGeocode(), LoadFlags.LOAD_ALL_DB_ONLY);
gpx.write("<wpt ");
gpx.write("lat=\"");
@@ -121,7 +118,7 @@ class GpxExport extends AbstractExport {
gpx.write("</sym>");
gpx.write("<type>");
- gpx.write(StringEscapeUtils.escapeXml("Geocache|" + cache.getType().id));
+ gpx.write(StringEscapeUtils.escapeXml("Geocache|" + cache.getType().pattern));
gpx.write("</type>");
gpx.write("<groundspeak:cache ");
@@ -145,36 +142,14 @@ class GpxExport extends AbstractExport {
gpx.write("</groundspeak:owner>");
gpx.write("<groundspeak:type>");
- gpx.write(StringEscapeUtils.escapeXml(cache.getType().id));
+ gpx.write(StringEscapeUtils.escapeXml(cache.getType().pattern));
gpx.write("</groundspeak:type>");
gpx.write("<groundspeak:container>");
gpx.write(StringEscapeUtils.escapeXml(cache.getSize().id));
gpx.write("</groundspeak:container>");
- if (cache.hasAttributes()) {
- //TODO: Attribute conversion required: English verbose name, gpx-id
- gpx.write("<groundspeak:attributes>");
-
- for (String attribute : cache.getAttributes()) {
- final CacheAttribute attr = CacheAttribute.getByGcRawName(CacheAttribute.trimAttributeName(attribute));
- final boolean enabled = CacheAttribute.isEnabled(attribute);
-
- gpx.write("<groundspeak:attribute id=\"");
- gpx.write(Integer.toString(attr.id));
- gpx.write("\" inc=\"");
- if (enabled) {
- gpx.write('1');
- } else {
- gpx.write('0');
- }
- gpx.write("\">");
- gpx.write(StringEscapeUtils.escapeXml(attr.getL10n(enabled)));
- gpx.write("</groundspeak:attribute>");
- }
-
- gpx.write("</groundspeak:attributes>");
- }
+ writeAttributes(cache);
gpx.write("<groundspeak:difficulty>");
gpx.write(Float.toString(cache.getDifficulty()));
@@ -188,9 +163,7 @@ class GpxExport extends AbstractExport {
gpx.write(StringEscapeUtils.escapeXml(cache.getLocation()));
gpx.write("</groundspeak:country>");
- gpx.write("<groundspeak:state>");
- gpx.write(StringEscapeUtils.escapeXml(cache.getLocation()));
- gpx.write("</groundspeak:state>");
+ gpx.write("<groundspeak:state></groundspeak:state>"); // c:geo cannot manage 2 separate fields, so we export as country
gpx.write("<groundspeak:short_description html=\"");
if (BaseUtils.containsHtml(cache.getShortDescription())) {
@@ -216,68 +189,13 @@ class GpxExport extends AbstractExport {
gpx.write(StringEscapeUtils.escapeXml(cache.getHint()));
gpx.write("</groundspeak:encoded_hints>");
- gpx.write("</groundspeak:cache>");
-
- if (cache.getLogs().size() > 0) {
- gpx.write("<groundspeak:logs>");
-
- for (LogEntry log : cache.getLogs()) {
- gpx.write("<groundspeak:log id=\"");
- gpx.write(Integer.toString(log.id));
- gpx.write("\">");
-
- gpx.write("<groundspeak:date>");
- gpx.write(StringEscapeUtils.escapeXml(dateFormatZ.format(new Date(log.date))));
- gpx.write("</groundspeak:date>");
-
- gpx.write("<groundspeak:type>");
- gpx.write(StringEscapeUtils.escapeXml(log.type.type));
- gpx.write("</groundspeak:type>");
-
- gpx.write("<groundspeak:finder id=\"\">");
- gpx.write(StringEscapeUtils.escapeXml(log.author));
- gpx.write("</groundspeak:finder>");
-
- gpx.write("<groundspeak:text encoded=\"False\">");
- gpx.write(StringEscapeUtils.escapeXml(log.log));
- gpx.write("</groundspeak:text>");
-
- gpx.write("</groundspeak:log>");
- }
+ writeLogs(cache);
- gpx.write("</groundspeak:logs>");
- }
+ gpx.write("</groundspeak:cache>");
gpx.write("</wpt>");
- for (cgWaypoint wp : cache.getWaypoints()) {
- gpx.write("<wpt lat=\"");
- gpx.write(Double.toString(wp.getCoords().getLatitude()));
- gpx.write("\" lon=\"");
- gpx.write(Double.toString(wp.getCoords().getLongitude()));
- gpx.write("\">");
-
- gpx.write("<name>");
- gpx.write(StringEscapeUtils.escapeXml(wp.getPrefix()));
- gpx.write(StringEscapeUtils.escapeXml(cache.getGeocode().substring(2)));
- gpx.write("</name>");
-
- gpx.write("<cmt />");
-
- gpx.write("<desc>");
- gpx.write(StringEscapeUtils.escapeXml(wp.getNote()));
- gpx.write("</desc>");
-
- gpx.write("<sym>");
- gpx.write(StringEscapeUtils.escapeXml(wp.getWaypointType().toString())); //TODO: Correct identifier string
- gpx.write("</sym>");
-
- gpx.write("<type>Waypoint|");
- gpx.write(StringEscapeUtils.escapeXml(wp.getWaypointType().toString())); //TODO: Correct identifier string
- gpx.write("</type>");
-
- gpx.write("</wpt>");
- }
+ writeWaypoints(cache);
publishProgress(i + 1);
}
@@ -306,6 +224,98 @@ class GpxExport extends AbstractExport {
return true;
}
+ private void writeWaypoints(final cgCache cache) throws IOException {
+ for (cgWaypoint wp : cache.getWaypoints()) {
+ gpx.write("<wpt lat=\"");
+ final Geopoint coords = wp.getCoords();
+ gpx.write(coords != null ? Double.toString(coords.getLatitude()) : ""); // TODO: check whether is the best way to handle unknown waypoint coordinates
+ gpx.write("\" lon=\"");
+ gpx.write(coords != null ? Double.toString(coords.getLongitude()) : "");
+ gpx.write("\">");
+
+ gpx.write("<name>");
+ gpx.write(StringEscapeUtils.escapeXml(wp.getPrefix()));
+ gpx.write(StringEscapeUtils.escapeXml(cache.getGeocode().substring(2)));
+ gpx.write("</name>");
+
+ gpx.write("<cmt />");
+
+ gpx.write("<desc>");
+ gpx.write(StringEscapeUtils.escapeXml(wp.getNote()));
+ gpx.write("</desc>");
+
+ gpx.write("<sym>");
+ gpx.write(StringEscapeUtils.escapeXml(wp.getWaypointType().toString())); //TODO: Correct identifier string
+ gpx.write("</sym>");
+
+ gpx.write("<type>Waypoint|");
+ gpx.write(StringEscapeUtils.escapeXml(wp.getWaypointType().toString())); //TODO: Correct identifier string
+ gpx.write("</type>");
+
+ gpx.write("</wpt>");
+ }
+ }
+
+ private void writeLogs(final cgCache cache) throws IOException {
+ if (cache.getLogs().size() <= 0) {
+ return;
+ }
+ gpx.write("<groundspeak:logs>");
+
+ for (LogEntry log : cache.getLogs()) {
+ gpx.write("<groundspeak:log id=\"");
+ gpx.write(Integer.toString(log.id));
+ gpx.write("\">");
+
+ gpx.write("<groundspeak:date>");
+ gpx.write(StringEscapeUtils.escapeXml(dateFormatZ.format(new Date(log.date))));
+ gpx.write("</groundspeak:date>");
+
+ gpx.write("<groundspeak:type>");
+ gpx.write(StringEscapeUtils.escapeXml(log.type.type));
+ gpx.write("</groundspeak:type>");
+
+ gpx.write("<groundspeak:finder id=\"\">");
+ gpx.write(StringEscapeUtils.escapeXml(log.author));
+ gpx.write("</groundspeak:finder>");
+
+ gpx.write("<groundspeak:text encoded=\"False\">");
+ gpx.write(StringEscapeUtils.escapeXml(log.log));
+ gpx.write("</groundspeak:text>");
+
+ gpx.write("</groundspeak:log>");
+ }
+
+ gpx.write("</groundspeak:logs>");
+ }
+
+ private void writeAttributes(final cgCache cache) throws IOException {
+ if (!cache.hasAttributes()) {
+ return;
+ }
+ //TODO: Attribute conversion required: English verbose name, gpx-id
+ gpx.write("<groundspeak:attributes>");
+
+ for (String attribute : cache.getAttributes()) {
+ final CacheAttribute attr = CacheAttribute.getByGcRawName(CacheAttribute.trimAttributeName(attribute));
+ final boolean enabled = CacheAttribute.isEnabled(attribute);
+
+ gpx.write("<groundspeak:attribute id=\"");
+ gpx.write(Integer.toString(attr.id));
+ gpx.write("\" inc=\"");
+ if (enabled) {
+ gpx.write('1');
+ } else {
+ gpx.write('0');
+ }
+ gpx.write("\">");
+ gpx.write(StringEscapeUtils.escapeXml(attr.getL10n(enabled)));
+ gpx.write("</groundspeak:attribute>");
+ }
+
+ gpx.write("</groundspeak:attributes>");
+ }
+
@Override
protected void onPostExecute(Boolean result) {
if (null != activity) {
diff --git a/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java b/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java
index fb0a16f..c872c9d 100644
--- a/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java
+++ b/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java
@@ -17,4 +17,11 @@ public class CacheSizeTest extends AndroidTestCase {
assertEquals(CacheSize.LARGE, CacheSize.getById("large"));
}
+ public static void testGetByIdComplete() {
+ for (CacheSize size : CacheSize.values()) {
+ assertEquals(size, CacheSize.getById(size.id));
+ assertEquals(size, CacheSize.getById(size.id.toLowerCase()));
+ assertEquals(size, CacheSize.getById(size.id.toUpperCase()));
+ }
+ }
}
diff --git a/tests/src/cgeo/geocaching/enumerations/CacheTypeTest.java b/tests/src/cgeo/geocaching/enumerations/CacheTypeTest.java
index 3ed949d..dd35669 100644
--- a/tests/src/cgeo/geocaching/enumerations/CacheTypeTest.java
+++ b/tests/src/cgeo/geocaching/enumerations/CacheTypeTest.java
@@ -18,4 +18,19 @@ public class CacheTypeTest extends AndroidTestCase {
assertEquals(CacheType.CITO, CacheType.getByPattern("cache in trash out event"));
}
+ public static void testGetByIdComplete() {
+ for (CacheType type : CacheType.values()) {
+ assertEquals(type, CacheType.getById(type.id));
+ assertEquals(type, CacheType.getById(type.id.toLowerCase()));
+ assertEquals(type, CacheType.getById(type.id.toUpperCase()));
+ }
+ }
+
+ public static void testGetByPatternComplete() {
+ for (CacheType type : CacheType.values()) {
+ assertEquals(type, CacheType.getByPattern(type.pattern));
+ assertEquals(type, CacheType.getByPattern(type.pattern.toLowerCase()));
+ assertEquals(type, CacheType.getByPattern(type.pattern.toUpperCase()));
+ }
+ }
}