Changeset 17430 in josm for trunk/test


Ignore:
Timestamp:
2021-01-02T09:37:50+01:00 (3 years ago)
Author:
GerdP
Message:

fix #20330: Crossing landuse=residential and natural=water should not produce a warning

  • ignore crossing ways when one is landuse=residential and the other is natural=water or landuse=reservoir

(both should be implemented in mapcss rules if wanted)

  • add unit test
File:
1 edited

Legend:

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

    r17400 r17430  
    4747    private static void testMessage(int code, CrossingWays test, String tags1, String tags2) {
    4848        assertEquals(code, test.createMessage(TestUtils.newWay(tags1), TestUtils.newWay(tags2)).code);
     49    }
     50
     51    private static void testIgnore(boolean expected, CrossingWays test, String tags1, String tags2) {
     52        // test both possible combinations
     53        assertEquals(expected, test.ignoreWaySegmentCombination(TestUtils.newWay(tags1), TestUtils.newWay(tags2)));
     54        assertEquals(expected, test.ignoreWaySegmentCombination(TestUtils.newWay(tags2), TestUtils.newWay(tags1)));
    4955    }
    5056
     
    156162        testMessage(665, test, "barrier=hedge", "natural=water");
    157163
     164        testIgnore(true, test, "landuse=residential", "natural=water");
     165        testIgnore(false, test, "landuse=residential", "building=yes");
     166
    158167        assertFalse(test.isPrimitiveUsable(newUsableWay("amenity=restaurant")));
    159168        assertFalse(test.isPrimitiveUsable(TestUtils.newWay("barrier=yes"))); // Unusable (0 node)
Note: See TracChangeset for help on using the changeset viewer.