Changeset 15883 in josm for trunk/test


Ignore:
Timestamp:
2020-02-18T15:02:41+01:00 (4 years ago)
Author:
GerdP
Message:

fix #9599: Join Overlapping Areas" creates a new way when joining 2 buildings
Two different problems are solved with this:

  • when inner loops are removed it was possible that the old way was removed and only a new part remained
  • when ways are joined with CombineWaysAction, the first old way was kept, not the oldest one
Location:
trunk/test
Files:
3 added
1 edited

Legend:

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

    r15852 r15883  
    5252
    5353    /**
     54     * Non-regression test for bug #9599.
     55     * @throws IOException if any I/O error occurs
     56     * @throws IllegalDataException if OSM parsing fails
     57     */
     58    @Test
     59    public void testTicket9599() throws IOException, IllegalDataException {
     60        try (InputStream is = TestUtils.getRegressionDataStream(9599, "ex5.osm")) {
     61            DataSet ds = OsmReader.parseDataSet(is, null);
     62            Layer layer = new OsmDataLayer(ds, null, null);
     63            MainApplication.getLayerManager().addLayer(layer);
     64            try {
     65                new JoinAreasAction(false).join(ds.getWays());
     66                Collection<IPrimitive> found = SearchAction.searchAndReturn("type:way", SearchMode.replace);
     67                assertEquals(1, found.size());
     68                assertEquals(257786939, found.iterator().next().getUniqueId());
     69            } finally {
     70                // Ensure we clean the place before leaving, even if test fails.
     71                MainApplication.getLayerManager().removeLayer(layer);
     72            }
     73        }
     74    }
     75
     76    /**
     77     * Non-regression test for bug #9599.
     78     * @throws IOException if any I/O error occurs
     79     * @throws IllegalDataException if OSM parsing fails
     80     */
     81    @Test
     82    public void testTicket9599Simple() throws IOException, IllegalDataException {
     83        try (InputStream is = TestUtils.getRegressionDataStream(9599, "three_old.osm")) {
     84            DataSet ds = OsmReader.parseDataSet(is, null);
     85            Layer layer = new OsmDataLayer(ds, null, null);
     86            MainApplication.getLayerManager().addLayer(layer);
     87            try {
     88                new JoinAreasAction(false).join(ds.getWays());
     89                Collection<IPrimitive> found = SearchAction.searchAndReturn("type:way", SearchMode.replace);
     90                assertEquals(1, found.size());
     91                assertEquals(31567319, found.iterator().next().getUniqueId());
     92            } finally {
     93                // Ensure we clean the place before leaving, even if test fails.
     94                MainApplication.getLayerManager().removeLayer(layer);
     95            }
     96        }
     97    }
     98
     99    /**
    54100     * Non-regression test for bug #10511.
    55101     * @throws IOException if any I/O error occurs
Note: See TracChangeset for help on using the changeset viewer.