diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2014-01-20 19:40:02 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2014-01-20 19:40:02 +0100 |
| commit | 4afef68a1364ad0c3619bccd1e99a99892c2174f (patch) | |
| tree | 638486dd014c663f9ad3d10cabe42c134c8453df | |
| parent | ca1c1d31bbb8e34498bbb9e27675b18b8f6fc6d7 (diff) | |
| download | cgeo-4afef68a1364ad0c3619bccd1e99a99892c2174f.zip cgeo-4afef68a1364ad0c3619bccd1e99a99892c2174f.tar.gz cgeo-4afef68a1364ad0c3619bccd1e99a99892c2174f.tar.bz2 | |
fix #3556: Calendar plugin should also read short description for time
| -rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 3 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/GeocacheTest.java | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index b0a229e..364683e 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -1705,8 +1705,9 @@ public class Geocache implements ICache, IWaypoint { patterns.add(Pattern.compile("\\b(\\d{1,2})(?:\\.00)?\\s+" + Pattern.quote(hourLocalized), Pattern.CASE_INSENSITIVE)); } + final String searchText = getShortDescription() + ' ' + getDescription(); for (Pattern pattern : patterns) { - final MatcherWrapper matcher = new MatcherWrapper(pattern, getDescription()); + final MatcherWrapper matcher = new MatcherWrapper(pattern, searchText); while (matcher.find()) { try { final int hours = Integer.parseInt(matcher.group(1)); diff --git a/tests/src/cgeo/geocaching/GeocacheTest.java b/tests/src/cgeo/geocaching/GeocacheTest.java index cdca9b7..b49048b 100644 --- a/tests/src/cgeo/geocaching/GeocacheTest.java +++ b/tests/src/cgeo/geocaching/GeocacheTest.java @@ -249,6 +249,14 @@ public class GeocacheTest extends CGeoTestCase { assertTime("from 11 to 13 " + timeHours, 11, 00); } + public static void testGuessEventTimeShortDescription() { + Geocache cache = new Geocache(); + cache.setType(CacheType.EVENT); + cache.setDescription(StringUtils.EMPTY); + cache.setShortDescription("text 14:20 text"); + assertEquals(String.valueOf(14 * 60 + 20), cache.guessEventTimeMinutes()); + } + private static void assertTime(final String description, final int hours, final int minutes) { final Geocache cache = new Geocache(); cache.setDescription(description); |
