aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-10-07 20:51:01 +0200
committerBananeweizen <bananeweizen@gmx.de>2013-10-07 20:51:01 +0200
commit4231aeb7ff7953e64dc4966a8ba86a676537a679 (patch)
tree2511d6595d9b27ea3774fe7c1133312d9f69ff3e
parent6523246cb5fbc887e10a4dc2fbb9314ffbbf2b11 (diff)
downloadcgeo-4231aeb7ff7953e64dc4966a8ba86a676537a679.zip
cgeo-4231aeb7ff7953e64dc4966a8ba86a676537a679.tar.gz
cgeo-4231aeb7ff7953e64dc4966a8ba86a676537a679.tar.bz2
fix #3335: calendar time recognized wrongly
-rw-r--r--main/src/cgeo/geocaching/Geocache.java2
-rw-r--r--tests/src/cgeo/geocaching/GeocacheTest.java11
2 files changed, 8 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index 76b55bc..7ca672f 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -1702,6 +1702,8 @@ public class Geocache implements ICache, IWaypoint {
// 12:34
patterns.add(Pattern.compile("\\b(\\d{1,2})\\:(\\d\\d)\\b"));
if (StringUtils.isNotBlank(hourLocalized)) {
+ // 17 - 20 o'clock
+ patterns.add(Pattern.compile("\\b(\\d{1,2})(?:\\.00)?" + "\\s*-\\s*" + "(?:\\d{1,2})(?:\\.00)?" + "\\s+" + Pattern.quote(hourLocalized), Pattern.CASE_INSENSITIVE));
// 12 o'clock, 12.00 o'clock
patterns.add(Pattern.compile("\\b(\\d{1,2})(?:\\.00)?\\s+" + Pattern.quote(hourLocalized), Pattern.CASE_INSENSITIVE));
}
diff --git a/tests/src/cgeo/geocaching/GeocacheTest.java b/tests/src/cgeo/geocaching/GeocacheTest.java
index 7d26370..6d3eec3 100644
--- a/tests/src/cgeo/geocaching/GeocacheTest.java
+++ b/tests/src/cgeo/geocaching/GeocacheTest.java
@@ -228,13 +228,14 @@ public class GeocacheTest extends CGeoTestCase {
assertTime("text 14:20 text", 14, 20);
assertNoTime("text 30:40 text");
assertNoTime("text 14:90 text");
- final String time_hours = CgeoApplication.getInstance().getString(R.string.cache_time_full_hours);
- assertTime("text 16 " + time_hours, 16, 0);
- assertTime("text 16 " + StringUtils.lowerCase(time_hours), 16, 0);
- assertTime("text 16:00 " + time_hours, 16, 0);
- assertTime("text 16.00 " + time_hours, 16, 0);
+ final String timeHours = CgeoApplication.getInstance().getString(R.string.cache_time_full_hours);
+ assertTime("text 16 " + timeHours, 16, 0);
+ assertTime("text 16 " + StringUtils.lowerCase(timeHours), 16, 0);
+ assertTime("text 16:00 " + timeHours, 16, 0);
+ assertTime("text 16.00 " + timeHours, 16, 0);
assertTime("text 14:20.", 14, 20);
assertTime("<b>14:20</b>", 14, 20);
+ assertTime("<u><em>Uhrzeit:</em></u> 17-20 " + timeHours + "</span></strong>", 17, 00);
}
private static void assertTime(final String description, final int hours, final int minutes) {