Ignore:
Timestamp:
2019-12-04T11:42:24+01:00 (5 years ago)
Author:
GerdP
Message:

fix #18387 Combine way action refuses to combine new way with oneway (regression from r15554)
I somehow expected that NodeGraph.getOutboundPairs(Node node) would return predessors and successors.
Maybe that routine should be renamed to getSuccessorPairs?

File:
1 edited

Legend:

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

    r15555 r15558  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertNull;
     6import static org.junit.Assert.assertTrue;
    67
    78import java.io.IOException;
    89import java.io.InputStream;
     10import java.util.ArrayList;
     11import java.util.Collections;
    912import java.util.HashSet;
    1013import java.util.List;
     
    1821import org.openstreetmap.josm.data.osm.NodeGraph;
    1922import org.openstreetmap.josm.data.osm.NodePair;
     23import org.openstreetmap.josm.data.osm.Way;
    2024import org.openstreetmap.josm.io.IllegalDataException;
    2125import org.openstreetmap.josm.io.OsmReader;
     
    6064
    6165    /**
    62      * Non-regression test for bug #1835 (combine way with overlapping ways)
     66     * Non-regression test for bug #18385 (combine way with overlapping ways)
    6367     * @throws IOException if any I/O error occurs
    6468     * @throws IllegalDataException if OSM parsing fails
     
    7579
    7680    /**
     81     * Non-regression test for bug #18387 (combine new way with oneway)
     82     * @throws IOException if any I/O error occurs
     83     * @throws IllegalDataException if OSM parsing fails
     84     */
     85    @Test
     86    public void testTicket18387() throws IOException, IllegalDataException {
     87        try (InputStream is = TestUtils.getRegressionDataStream(18387, "data.osm")) {
     88            DataSet ds = OsmReader.parseDataSet(is, null);
     89            ArrayList<Way> selection = new ArrayList<>(ds.getWays());
     90            assertEquals(2, selection.size());
     91            if (!selection.get(0).isNew())
     92                Collections.reverse(selection);
     93            NodeGraph graph = NodeGraph.createNearlyUndirectedGraphFromNodeWays(selection);
     94            List<Node> path = graph.buildSpanningPathNoRemove();
     95            assertTrue(path != null);
     96        }
     97    }
     98
     99    /**
    77100     * Unit test of methods {@link NodePair#equals} and {@link NodePair#hashCode}.
    78101     */
Note: See TracChangeset for help on using the changeset viewer.