Changeset 15186 in josm for trunk/test
- Timestamp:
- 2019-06-21T01:53:11+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java
r14542 r15186 7 7 import java.util.Arrays; 8 8 9 import org.junit.Assert; 9 10 import org.junit.Rule; 10 11 import org.junit.Test; 12 import org.openstreetmap.josm.TestUtils; 11 13 import org.openstreetmap.josm.data.coor.EastNorth; 14 import org.openstreetmap.josm.data.coor.LatLon; 12 15 import org.openstreetmap.josm.data.osm.DataSet; 13 16 import org.openstreetmap.josm.data.osm.Node; 17 import org.openstreetmap.josm.data.osm.Relation; 18 import org.openstreetmap.josm.data.osm.RelationMember; 14 19 import org.openstreetmap.josm.data.osm.Way; 15 20 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 79 84 } 80 85 } 86 87 /** 88 * Test case: when a way is split with a turn restriction relation, 89 * the relation should not be broken. 90 * see #17810 91 */ 92 @Test 93 public void testTicket17810() { 94 DataSet dataSet = new DataSet(); 95 Way from = TestUtils.newWay("highway=residential", new Node(new LatLon(0.0, 0.0)), 96 new Node(new LatLon(0.00033, 0.00033)), new Node(new LatLon(0.00066, 0.00066)), 97 new Node(new LatLon(0.001, 0.001))); 98 from.getNodes().forEach(node -> dataSet.addPrimitive(node)); 99 dataSet.addPrimitive(from); 100 Node via = from.lastNode(); 101 Way to = TestUtils.newWay("highway=residential", new Node(new LatLon(0.002, 0.001)), via); 102 to.getNodes().forEach(node -> { 103 if (!dataSet.containsNode(node)) { 104 dataSet.addPrimitive(node); 105 } 106 }); 107 dataSet.addPrimitive(to); 108 Relation restriction = TestUtils.newRelation("type=restriction restriction=no_left_turn", 109 new RelationMember("from", from), new RelationMember("to", to), 110 new RelationMember("via", via)); 111 dataSet.addPrimitive(restriction); 112 dataSet.clearSelection(); 113 dataSet.addSelected(from.getNode(2), from); 114 SplitWayAction.runOn(dataSet); 115 for (RelationMember member : restriction.getMembers()) { 116 if ("from".equals(member.getRole())) { 117 Assert.assertTrue(member.getWay().containsNode(via)); 118 } 119 } 120 } 81 121 }
Note:
See TracChangeset
for help on using the changeset viewer.