Changeset 19624 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2026-09-16T10:31:15+02:00 (38 hours ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/actions/mapmode
- Files:
-
- 1 added
- 1 edited
-
ParallelWayActionTest.java (modified) (2 diffs)
-
ParallelWaysTest.java (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java
r19227 r19624 13 13 import org.openstreetmap.josm.data.coor.LatLon; 14 14 import org.openstreetmap.josm.data.osm.DataSet; 15 import org.openstreetmap.josm.data.osm.Node; 16 import org.openstreetmap.josm.data.osm.Way; 15 17 import org.openstreetmap.josm.gui.MainApplication; 16 18 import org.openstreetmap.josm.gui.MapFrame; … … 71 73 72 74 /** 75 * Several selected ways connected by common nodes are offset together, one result way per source way. 76 */ 77 @Test 78 void testMultipleSelectedWays() { 79 Node a = new Node(LatLon.ZERO); 80 Node b = new Node(new LatLon(0, 0.0001)); 81 Node c = new Node(new LatLon(0, 0.0002)); 82 Way w1 = new Way(); 83 w1.addNode(a); 84 w1.addNode(b); 85 Way w2 = new Way(); 86 w2.addNode(b); 87 w2.addNode(c); 88 for (Node n : new Node[] {a, b, c}) { 89 this.dataSet.addPrimitive(n); 90 } 91 this.dataSet.addPrimitive(w1); 92 this.dataSet.addPrimitive(w2); 93 this.dataSet.setSelected(w1, w2); 94 this.map.selectMapMode(mapMode); 95 MapModeUtils.dragFromTo(new LatLon(0, 0.00005), new LatLon(0.00005, 0.00005)); 96 assertEquals(2, this.dataSet.getWays().size() - 2, "two parallel ways expected: " + this.dataSet.getWays()); 97 assertEquals(3 + 3 + 2 + 2, this.dataSet.allPrimitives().size()); 98 } 99 100 /** 101 * The selection changed while in the mode (e.g. by Selection > Non-branching way sequences, after a first 102 * parallel way has been created) is used as source. 103 */ 104 @Test 105 void testSelectionChangedInMode() { 106 Node a = new Node(LatLon.ZERO); 107 Node b = new Node(new LatLon(0, 0.0001)); 108 Node c = new Node(new LatLon(0, 0.0002)); 109 Way w1 = new Way(); 110 w1.addNode(a); 111 w1.addNode(b); 112 Way w2 = new Way(); 113 w2.addNode(b); 114 w2.addNode(c); 115 for (Node n : new Node[] {a, b, c}) { 116 this.dataSet.addPrimitive(n); 117 } 118 this.dataSet.addPrimitive(w1); 119 this.dataSet.addPrimitive(w2); 120 this.dataSet.setSelected(w1); 121 this.map.selectMapMode(mapMode); 122 // first parallel of the single selected way 123 MapModeUtils.dragFromTo(new LatLon(0, 0.00005), new LatLon(0.00005, 0.00005)); 124 assertEquals(3, this.dataSet.getWays().size()); 125 // now the selection is extended by other means, the next drag must use both ways 126 this.dataSet.setSelected(w1, w2); 127 MapModeUtils.dragFromTo(new LatLon(0, 0.00005), new LatLon(-0.00005, 0.00005)); 128 assertEquals(5, this.dataSet.getWays().size(), this.dataSet.getWays().toString()); 129 } 130 131 /** 73 132 * Unit test of {@link Mode} enum. 74 133 */
Note:
See TracChangeset
for help on using the changeset viewer.
