Changeset 16377 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/UnclosedWays.java
r15297 r16377 10 10 import java.util.Set; 11 11 12 import org.openstreetmap.josm.data.osm.OsmPrimitive;13 12 import org.openstreetmap.josm.data.osm.OsmUtils; 14 13 import org.openstreetmap.josm.data.osm.Relation; … … 143 142 144 143 new UnclosedWaysCheck(1102, "landuse", marktr("landuse type {0}")), 145 new UnclosedWaysCheck(1103, "amenit ies", marktr("amenitiestype {0}")),144 new UnclosedWaysCheck(1103, "amenity", marktr("amenity type {0}")), 146 145 new UnclosedWaysCheck(1104, "sport", marktr("sport type {0}"), 147 146 new HashSet<>(Arrays.asList("water_slide", "climbing", "skiing", "toboggan", "bobsleigh", "karting"))), … … 180 179 return; 181 180 182 for ( OsmPrimitive parent: w.getReferrers()) {183 if ( parent instanceof Relation && ((Relation) parent).isMultipolygon())181 for (UnclosedWaysCheck c : checks) { 182 if ("boundary".equals(c.key) && w.referrers(Relation.class).anyMatch(Relation::isMultipolygon)) 184 183 return; 185 }186 187 for (UnclosedWaysCheck c : checks) {188 184 TestError error = c.getTestError(w, this); 189 185 if (error != null) { -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java
r15136 r16377 79 79 80 80 /** 81 * Test to make sure the multipolygon ways are ignored 81 * Test to make sure the multipolygon ways are not ignored 82 * See #19136, #19145 82 83 * @throws Exception if an exception occurs 83 84 */ … … 96 97 uwTest.visit(w); 97 98 assertTrue(ElemStyles.hasAreaElemStyle(w, false)); 99 assertEquals(1, uwTest.getErrors().size()); 100 101 uwTest.endTest(); 102 } 103 104 /** 105 * Test to make sure the boundary ways are ignored when member of a boundary relation 106 * See #19136, #19145 107 * @throws Exception if an exception occurs 108 */ 109 @Test 110 public void testWayInBoundary() throws Exception { 111 UnclosedWays uwTest = new UnclosedWays(); 112 uwTest.initialize(); 113 uwTest.startTest(null); 114 DataSet ds = new DataSet(); 115 116 // Erroneous tag 117 Way w = createUnclosedWay("boundary=administrative", ds); 118 Relation r = (Relation) OsmUtils.createPrimitive("relation type=boundary"); 119 r.addMember(new RelationMember("inner", w)); 120 ds.addPrimitive(r); 121 uwTest.visit(w); 122 assertFalse(ElemStyles.hasAreaElemStyle(w, false)); 98 123 assertEquals(0, uwTest.getErrors().size()); 99 124 … … 101 126 } 102 127 128 /** 129 * Test to make sure that amenity=* is closed. 130 * See #19145 131 * @throws Exception if an exception occurs 132 */ 133 @Test 134 public void testAmenity() throws Exception { 135 UnclosedWays uwTest = new UnclosedWays(); 136 uwTest.initialize(); 137 uwTest.startTest(null); 138 DataSet ds = new DataSet(); 139 140 // Erroneous tag 141 Way w = createUnclosedWay("amenity=school", ds); 142 uwTest.visit(w); 143 assertTrue(ElemStyles.hasAreaElemStyle(w, false)); 144 assertEquals(1, uwTest.getErrors().size()); 145 assertEquals(1103, uwTest.getErrors().iterator().next().getCode()); 146 147 uwTest.endTest(); 148 } 149 103 150 }
Note:
See TracChangeset
for help on using the changeset viewer.