Ignore:
Timestamp:
2024-04-28T11:24:57+02:00 (3 weeks ago)
Author:
GerdP
Message:

fix #23641: When mapping a forest inside a forest and make that inner, the inner landuse=forest tag is removed.

  • change code so the tags of inner ways which are common to the multipolygon are not removed.
  • add unit test
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java

    r18870 r19066  
    291291    }
    292292
     293    /**
     294     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/23641">Bug #23641</a>.
     295     * @throws Exception if an error occurs
     296     */
     297    @Test
     298    void testTicket23642() throws Exception {
     299        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(23641, "data.osm"), null);
     300        assertEquals(0, ds.getRelations().size());
     301        Pair<SequenceCommand, Relation> cmd = CreateMultipolygonAction.createMultipolygonCommand(ds.getWays(), null);
     302        assertNotNull(cmd);
     303        cmd.a.executeCommand();
     304        assertEquals(1, ds.getRelations().size());
     305        Relation mp = ds.getRelations().iterator().next();
     306        assertTrue(mp.hasTag("landuse", "forest"));
     307        assertTrue(mp.hasTag("leaf_type", "needleleaved"));
     308        assertEquals(0, ds.getWays().stream().filter(w -> w.hasTag("leaf_type", "needleleaved")).count());
     309        assertEquals(1, ds.getWays().stream().filter(w -> w.hasTag("leaf_type", "broadleaved")).count());
     310        assertEquals(1, mp.getMembers().stream()
     311                .filter(m -> "inner".equals(m.getRole()) && m.getMember().hasTag("landuse", "forest")).count());
     312        Pair<SequenceCommand, Relation> updateCmd = CreateMultipolygonAction.createMultipolygonCommand(ds.getWays(), mp);
     313        assertNull(updateCmd);
     314    }
     315
    293316}
Note: See TracChangeset for help on using the changeset viewer.