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


Ignore:
Timestamp:
2020-03-24T07:37:08+01:00 (4 years ago)
Author:
GerdP
Message:

see #18863 split ways: false positive warnings about missing members
Solution for the problem case given in the unit test looks OK.
Ticket mentiones two problems, so I am not sure if both are fixed now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java

    r15943 r16200  
    290290
    291291    /**
    292      * Non-regression test for issue #17400 ( Warn when splitting way in not fully downloaded region)
     292     * Non-regression test for issue #17400 (Warn when splitting way in not fully downloaded region)
    293293     *
    294294     * Bus route 190 gets broken when the split occurs, because the two new way parts are inserted in the relation in
     
    333333        }
    334334    }
     335
     336    /**
     337     * Non-regression test for issue #18863 (Asking for download of missing members when not needed)
     338     *
     339     * A split on node 4518025255 caused the 'download missing members?' dialog to pop up for relation 68745 (CB 2),
     340     * even though the way members next to the split way were already downloaded. This happened because this relation
     341     * does not have its members connected at all.
     342     *
     343     * This split should not trigger any download action at all.
     344     *
     345     * @throws IOException if any I/O error occurs
     346     * @throws IllegalDataException if OSM parsing fails
     347     */
     348    @Test
     349    public void testTicket18863() throws IOException, IllegalDataException {
     350        try (InputStream is = TestUtils.getRegressionDataStream(18863, "data.osm.bz2")) {
     351            DataSet ds = OsmReader.parseDataSet(is, null);
     352
     353            Way splitWay = (Way) ds.getPrimitiveById(290581177L, OsmPrimitiveType.WAY);
     354            Node splitNode = (Node) ds.getPrimitiveById(4518025255L, OsmPrimitiveType.NODE);
     355
     356            final Optional<SplitWayCommand> result = SplitWayCommand.splitWay(
     357                    splitWay,
     358                    SplitWayCommand.buildSplitChunks(splitWay, Collections.singletonList(splitNode)),
     359                    new ArrayList<>(),
     360                    Strategy.keepLongestChunk(),
     361                    // This split requires no additional downloads. If any are needed, this command will fail.
     362                    SplitWayCommand.WhenRelationOrderUncertain.ABORT
     363            );
     364
     365            // Should not result in aborting the split.
     366            assertTrue(result.isPresent());
     367        }
     368    }
    335369}
Note: See TracChangeset for help on using the changeset viewer.