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


Ignore:
Timestamp:
2020-11-23T21:39:48+01:00 (3 years ago)
Author:
GerdP
Message:

fix #20110: "Update multipolygon" strips natural=coastline from member ways

  • fix and unit test
File:
1 edited

Legend:

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

    r17275 r17343  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
    67import static org.junit.jupiter.api.Assertions.assertTrue;
    78
     
    1213import java.util.TreeMap;
    1314
     15import org.junit.jupiter.api.Test;
    1416import org.junit.jupiter.api.extension.RegisterExtension;
    15 import org.junit.jupiter.api.Test;
    1617import org.openstreetmap.josm.TestUtils;
    1718import org.openstreetmap.josm.command.SequenceCommand;
     
    156157
    157158    }
     159
     160    /**
     161     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/20110">Bug #20110</a>.
     162     * @throws Exception if an error occurs
     163     */
     164    @Test
     165    void testTicket20110() throws Exception {
     166        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(20110, "data.osm"), null);
     167        assertEquals(1, ds.getRelations().size());
     168        Relation mp = ds.getRelations().iterator().next();
     169        assertEquals("wetland", mp.get("natural"));
     170        long numCoastlineWays = ds.getWays().stream().filter(w -> "coastline".equals(w.get("natural"))).count();
     171        Relation modMp = createMultipolygon(ds.getWays(), "type:way", mp, false);
     172        assertNotNull(modMp);
     173        assertEquals("wetland", modMp.get("natural"));
     174        assertEquals(numCoastlineWays, ds.getWays().stream().filter(w -> "coastline".equals(w.get("natural"))).count());
     175    }
    158176}
Note: See TracChangeset for help on using the changeset viewer.