Changeset 16377 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2020-04-24T12:06:05+02:00 (5 years ago)
Author:
GerdP
Message:

fix #19145: some unclosed ways are not found

  • fix typo amenties -> amenity
  • only ignore multipolygon members when checking unclosed boundary=* ways, others would be old style multipolygons
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java

    r15136 r16377  
    7979
    8080    /**
    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
    8283     * @throws Exception if an exception occurs
    8384     */
     
    9697        uwTest.visit(w);
    9798        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));
    98123        assertEquals(0, uwTest.getErrors().size());
    99124
     
    101126    }
    102127
     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
    103150 }
Note: See TracChangeset for help on using the changeset viewer.