Changeset 15728 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2020-01-19T10:54:23+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java
r15186 r15728 7 7 import java.util.Arrays; 8 8 9 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 9 10 import org.junit.Assert; 10 11 import org.junit.Rule; … … 20 21 import org.openstreetmap.josm.testutils.JOSMTestRules; 21 22 22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;23 24 23 /** 25 24 * Unit tests for class {@link SplitWayAction}. … … 33 32 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 33 public JOSMTestRules test = new JOSMTestRules().projection(); 34 private final DataSet dataSet = new DataSet(); 35 36 private Node addNode(int east, int north) { 37 final Node node = new Node(new EastNorth(east, north)); 38 dataSet.addPrimitive(node); 39 return node; 40 } 35 41 36 42 /** … … 40 46 @Test 41 47 public void testTicket11184() { 42 DataSet dataSet = new DataSet(); 43 44 Node n1 = new Node(new EastNorth(0, 0)); 45 Node n2 = new Node(new EastNorth(-1, 1)); 46 Node n3 = new Node(new EastNorth(1, 1)); 47 Node n4 = new Node(new EastNorth(-1, -1)); 48 Node n5 = new Node(new EastNorth(1, -1)); 49 Node n6 = new Node(new EastNorth(-1, 0)); 50 Node n7 = new Node(new EastNorth(1, 0)); 51 dataSet.addPrimitive(n1); 52 dataSet.addPrimitive(n2); 53 dataSet.addPrimitive(n3); 54 dataSet.addPrimitive(n4); 55 dataSet.addPrimitive(n5); 56 dataSet.addPrimitive(n6); 57 dataSet.addPrimitive(n7); 48 Node n1 = addNode(0, 0); 49 Node n2 = addNode(-1, 1); 50 Node n3 = addNode(1, 1); 51 Node n4 = addNode(-1, -1); 52 Node n5 = addNode(1, -1); 53 Node n6 = addNode(-1, 0); 54 Node n7 = addNode(1, 0); 58 55 59 56 Way w1 = new Way(); … … 96 93 new Node(new LatLon(0.00033, 0.00033)), new Node(new LatLon(0.00066, 0.00066)), 97 94 new Node(new LatLon(0.001, 0.001))); 98 from.getNodes().forEach( node -> dataSet.addPrimitive(node));95 from.getNodes().forEach(dataSet::addPrimitive); 99 96 dataSet.addPrimitive(from); 100 97 Node via = from.lastNode(); … … 119 116 } 120 117 } 118 119 /** 120 * Test case: smart way selection 121 * see #18477 122 */ 123 @Test 124 public void testTicket18477() { 125 final Node n10 = addNode(1, 0); 126 final Node n21 = addNode(2, 1); 127 final Way highway = TestUtils.newWay("highway=residential", 128 addNode(0, 0), n10, n21, addNode(3, 1)); 129 final Way bridge = TestUtils.newWay("man_made=bridge", 130 n10, addNode(2, 0), n21, addNode(1, 1), n10); 131 dataSet.addPrimitive(highway); 132 dataSet.addPrimitive(bridge); 133 dataSet.setSelected(n10, n21); 134 SplitWayAction.runOn(dataSet); 135 assertSame(String.format("Found %d ways after split action instead of 4.", dataSet.getWays().size()), 136 dataSet.getWays().size(), 4); 137 } 121 138 }
Note:
See TracChangeset
for help on using the changeset viewer.