Legend:
- Unmodified
- Added
- Removed
-
trunk/data/defaultpresets.xml
r6562 r6568 237 237 <combo key="layer" text="Layer" values="5,4,3,2,1,0,-1,-2,-3,-4,-5" length="3" /> 238 238 </chunk> 239 <chunk id="service_times"> 240 <combo key="service_times" text="Service Times" delimiter="|" values="18:00|sunset,sunrise|Su 09:30,11:00|Sa,Su,PH 09:00|Sa 18:00; Su 10:45|Fr 08:00-18:00; Apr 10-15 off; Jun 07:00-20:00; Aug off; Dec 24 08:00-24:00|Sa 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" /> 241 </chunk> 239 242 <chunk id="oh"> 240 <combo key="opening_hours" text="Opening Hours" delimiter="|" values="24/7|08:30-12:30,15:30-20:00|Sa-Su 00:00-24:00|Mo-Fr 08:30-20:00; Sa,Su 08:00-15:00; PH off|Mo-Fr 08:30-20:00, Tu-Su 08:00-15:00; Sa 08:00-12:00|Mo-Su 08:00-18:00; Apr 10-15 off; Jun 08:00-14:00; Aug off; Dec 25 off|sunrise-sunset|Su 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" />243 <combo key="opening_hours" text="Opening Hours" delimiter="|" values="24/7|08:30-12:30,15:30-20:00|Sa-Su 00:00-24:00|Mo-Fr 08:30-20:00; Sa,Su 08:00-15:00; PH off|Mo-Fr 08:30-20:00, Tu-Su 08:00-15:00; Sa 08:00-12:00|Mo-Su 08:00-18:00; Apr 10-15 off; Jun 08:00-14:00; Aug off; Dec 25 off|sunrise-sunset|Su 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" /> 241 244 </chunk> 242 245 <chunk id="name_oh"> … … 3612 3615 <combo key="building" text="Building type" values="basilica,cathedral,chapel,church,temple" values_searchable="true" /> 3613 3616 <combo key="denomination" text="Denomination" values="anglican,baptist,catholic,evangelical,greek_catholic,greek_orthodox,jehovahs_witness,lutheran,methodist,mormon,new_apostolic,orthodox,pentecostal,presbyterian,protestant,quaker,roman_catholic,russian_orthodox,seventh_day_adventist" values_searchable="true" /> 3614 < combo key="service_times" text="Service Times" delimiter="|" values="18:00|sunset,sunrise|Su 9:30,11:00|Sa,Su,PH 9:00|Sa 18:00; Su 10:45|Fr 08:00-18:00; Apr 10-15 off; Jun 07:00-20:00; Aug off; Dec 24 08:00-24:00|Sa 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" />3617 <reference ref="service_times" /> 3615 3618 <reference ref="oh" /> 3616 3619 </item> … … 3636 3639 <combo key="building" text="Building type" values="mosque" values_searchable="true" /> 3637 3640 <combo key="denomination" text="Denomination" values="ibadi,shia,sunni" values_searchable="true" /> 3638 < combo key="service_times" text="Service Times" delimiter="|" values="18:00|sunset,sunrise|Su 9:30,11:00|Sa,Su,PH 9:00|Sa 18:00; Su 10:45|Fr 08:00-18:00; Apr 10-15 off; Jun 07:00-20:00; Aug off; Dec 24 08:00-24:00|Sa 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" />3641 <reference ref="service_times" /> 3639 3642 <reference ref="oh" /> 3640 3643 </item> … … 3660 3663 <combo key="building" text="Building type" values="synagogue" values_searchable="true" /> 3661 3664 <combo key="denomination" text="Denomination" values="orthodox,conservative,reform" values_searchable="true" /> 3662 < combo key="service_times" text="Service Times" delimiter="|" values="18:00|sunset,sunrise|Su 9:30,11:00|Sa,Su,PH 9:00|Sa 18:00; Su 10:45|Fr 08:00-18:00; Apr 10-15 off; Jun 07:00-20:00; Aug off; Dec 24 08:00-24:00|Sa 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" />3665 <reference ref="service_times" /> 3663 3666 <reference ref="oh" /> 3664 3667 </item> … … 3683 3686 <text key="name" text="Name" /> 3684 3687 <combo key="denomination" text="Denomination" values="theravada,mahayana,vajrayana" values_searchable="true" /> 3685 < combo key="service_times" text="Service Times" delimiter="|" values="18:00|sunset,sunrise|Su 9:30,11:00|Sa,Su,PH 9:00|Sa 18:00; Su 10:45|Fr 08:00-18:00; Apr 10-15 off; Jun 07:00-20:00; Aug off; Dec 24 08:00-24:00|Sa 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" />3688 <reference ref="service_times" /> 3686 3689 <reference ref="oh" /> 3687 3690 </item> … … 3706 3709 <text key="name" text="Name" /> 3707 3710 <combo key="denomination" text="Denomination" values="vaishnavism,shaivism,shaktism,smartism" values_searchable="true" /> 3708 < combo key="service_times" text="Service Times" delimiter="|" values="18:00|sunset,sunrise|Su 9:30,11:00|Sa,Su,PH 9:00|Sa 18:00; Su 10:45|Fr 08:00-18:00; Apr 10-15 off; Jun 07:00-20:00; Aug off; Dec 24 08:00-24:00|Sa 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" />3711 <reference ref="service_times" /> 3709 3712 <reference ref="oh" /> 3710 3713 </item> … … 3728 3731 <key key="religion" value="shinto" /> 3729 3732 <text key="name" text="Name" /> 3730 < combo key="service_times" text="Service Times" delimiter="|" values="18:00|sunset,sunrise|Su 9:30,11:00|Sa,Su,PH 9:00|Sa 18:00; Su 10:45|Fr 08:00-18:00; Apr 10-15 off; Jun 07:00-20:00; Aug off; Dec 24 08:00-24:00|Sa 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" />3733 <reference ref="service_times" /> 3731 3734 <reference ref="oh" /> 3732 3735 </item> … … 3750 3753 <text key="name" text="Name" /> 3751 3754 <combo key="religion" text="Religion" values="bahai,jain,sikh,spiritualist,taoist,unitarian,zoroastrian" match="keyvalue" values_searchable="true" /> 3752 < combo key="service_times" text="Service Times" delimiter="|" values="18:00|sunset,sunrise|Su 9:30,11:00|Sa,Su,PH 9:00|Sa 18:00; Su 10:45|Fr 08:00-18:00; Apr 10-15 off; Jun 07:00-20:00; Aug off; Dec 24 08:00-24:00|Sa 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" />3755 <reference ref="service_times" /> 3753 3756 <reference ref="oh" /> 3754 3757 </item> … … 4100 4103 <text key="operator" text="Operator" /> 4101 4104 <text key="ref" text="Reference number" /> 4102 <combo key="collection_times" text="Collection times" delimiter="|" values="11:30|Mo-Fr 15:00,17:45,19:00,23:00; Sa 15:10; Su 10:30,23:00|Mo-Fr 09:00-12:00,17:15; Sa 14:00; S o,PH off" />4105 <combo key="collection_times" text="Collection times" delimiter="|" values="11:30|Mo-Fr 15:00,17:45,19:00,23:00; Sa 15:10; Su 10:30,23:00|Mo-Fr 09:00-12:00,17:15; Sa 14:00; Su,PH off" /> 4103 4106 <check key="drive_through" text="Drive through" /> 4104 4107 </item> … … 4149 4152 <space /> 4150 4153 <key key="emergency" value="aed" /> 4151 < combo key="opening_hours" text="Opening Hours" values="24/7,limited" />4154 <reference ref="oh" /> 4152 4155 <text key="operator" text="Operator" /> 4153 4156 <check key="indoor" text="Located inside a building?" /> -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r6552 r6568 123 123 124 124 /** 125 * Constructs a new {@code OpeningHoursTestError}.126 * @param message The error message127 * @param severity The error severity128 */129 public OpeningHoursTestError(String message, Severity severity) {130 this(message, severity, null);131 }132 133 /**134 125 * Returns the real test error given to JOSM validator. 135 126 * @param p The incriminated OSM primitive. … … 168 159 public Severity getSeverity() { 169 160 return severity; 161 } 162 163 @Override 164 public String toString() { 165 return getMessage() + " => " + getPrettifiedValue(); 170 166 } 171 167 } … … 217 213 */ 218 214 public List<OpeningHoursTestError> checkOpeningHourSyntax(final String key, final String value) { 219 return checkOpeningHourSyntax(key, value, CheckMode.TIME_RANGE);215 return checkOpeningHourSyntax(key, value, "opening_hours".equals(key) ? CheckMode.TIME_RANGE : CheckMode.BOTH); 220 216 } 221 217 -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
r6533 r6568 5 5 import org.junit.Test; 6 6 import org.openstreetmap.josm.Main; 7 import org.openstreetmap.josm.data.osm.Tag; 7 8 import org.openstreetmap.josm.data.validation.Severity; 9 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 10 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 11 import org.openstreetmap.josm.gui.tagging.TaggingPresetItem; 12 import org.openstreetmap.josm.gui.tagging.TaggingPresetItems; 13 import org.openstreetmap.josm.gui.tagging.TaggingPresetReader; 14 import org.openstreetmap.josm.gui.tagging.TaggingPresetSearchAction; 8 15 16 import java.util.Arrays; 17 import java.util.Collection; 18 import java.util.LinkedHashSet; 9 19 import java.util.List; 20 import java.util.Set; 10 21 11 22 import static org.CustomMatchers.hasSize; … … 128 139 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo-Fr 13:30, 17:45, 19:00; Sa 15:00; Su 11:00", OpeningHourTest.CheckMode.BOTH).get(0).getPrettifiedValue(), is("Mo-Fr 13:30,17:45,19:00; Sa 15:00; Su 11:00")); 129 140 } 141 142 @Test 143 public void testPresetValues() throws Exception { 144 final Collection<TaggingPreset> presets = TaggingPresetReader.readFromPreferences(false); 145 final Set<Tag> values = new LinkedHashSet<Tag>(); 146 for (final TaggingPreset p : presets) { 147 for (final TaggingPresetItem i : p.data) { 148 if (i instanceof TaggingPresetItems.KeyedItem && 149 Arrays.asList("opening_hours", "service_times", "collection_times").contains(((TaggingPresetItems.KeyedItem) i).key)) { 150 for (final String v : ((TaggingPresetItems.KeyedItem) i).getValues()) { 151 values.add(new Tag(((TaggingPresetItems.KeyedItem) i).key, v)); 152 } 153 } 154 } 155 } 156 for (final Tag t : values) { 157 final List<OpeningHourTest.OpeningHoursTestError> errors = OPENING_HOUR_TEST.checkOpeningHourSyntax(t.getKey(), t.getValue()); 158 assertThat(t + " is valid", errors, isEmpty()); 159 } 160 } 130 161 }
Note:
See TracChangeset
for help on using the changeset viewer.