Changeset 15555 in josm for trunk/test


Ignore:
Timestamp:
2019-12-03T16:28:41+01:00 (5 years ago)
Author:
GerdP
Message:

fix #18385: Combine way action may remove parts of the ways

  • Count all edges that are added to the graph, even if they are rejected because they are duplicates.
  • add new method buildSpanningPathNoRemove() which returns null if any duplicate edge was found

and use this method in CombineWayAction

Location:
trunk/test
Files:
2 added
1 edited

Legend:

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

    r14604 r15555  
    33
    44import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertNull;
    56
    67import java.io.IOException;
     
    4647            DataSet ds = OsmReader.parseDataSet(is, null);
    4748            NodeGraph graph = NodeGraph.createNearlyUndirectedGraphFromNodeWays(ds.getWays());
    48             List<Node> path = graph.buildSpanningPath();
     49            List<Node> path = graph.buildSpanningPathNoRemove();
    4950            assertEquals(10, path.size());
    5051            Set<Long> firstAndLastObtained = new HashSet<>();
     
    5556            firstAndLastExpected.add(35213705L);
    5657            assertEquals(firstAndLastExpected, firstAndLastObtained);
     58        }
     59    }
     60
     61    /**
     62     * Non-regression test for bug #1835 (combine way with overlapping ways)
     63     * @throws IOException if any I/O error occurs
     64     * @throws IllegalDataException if OSM parsing fails
     65     */
     66    @Test
     67    public void testTicket18385() throws IOException, IllegalDataException {
     68        try (InputStream is = TestUtils.getRegressionDataStream(18385, "data.osm")) {
     69            DataSet ds = OsmReader.parseDataSet(is, null);
     70            NodeGraph graph = NodeGraph.createNearlyUndirectedGraphFromNodeWays(ds.getWays());
     71            List<Node> path = graph.buildSpanningPathNoRemove();
     72            assertNull(path);
    5773        }
    5874    }
Note: See TracChangeset for help on using the changeset viewer.