Changeset 11118 in josm for trunk/test/unit/org
- Timestamp:
- 2016-10-11T20:20:06+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java
r10436 r11118 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNotNull; 5 6 import static org.junit.Assert.assertTrue; 7 8 import java.util.Collection; 9 import java.util.Collections; 10 import java.util.stream.Stream; 6 11 7 12 import org.junit.BeforeClass; … … 9 14 import org.openstreetmap.josm.JOSMFixture; 10 15 import org.openstreetmap.josm.Main; 16 import org.openstreetmap.josm.command.DeleteCommand; 17 import org.openstreetmap.josm.command.SequenceCommand; 11 18 import org.openstreetmap.josm.data.coor.LatLon; 12 19 import org.openstreetmap.josm.data.osm.DataSet; … … 14 21 import org.openstreetmap.josm.data.osm.Way; 15 22 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 23 import org.openstreetmap.josm.tools.Utils; 16 24 17 25 /** … … 97 105 } 98 106 } 107 108 /** 109 * Tests that also the first node may be simplified, see #13094. 110 */ 111 @Test 112 public void testSimplifyFirstNode() { 113 final DataSet ds = new DataSet(); 114 final Node n1 = new Node(new LatLon(47.26269614984, 11.34044231149)); 115 final Node n2 = new Node(new LatLon(47.26274590831, 11.34053120859)); 116 final Node n3 = new Node(new LatLon(47.26276562382, 11.34034715039)); 117 final Node n4 = new Node(new LatLon(47.26264639132, 11.34035341438)); 118 final Way w = new Way(); 119 Stream.of(n1, n2, n3, n4, w).forEach(ds::addPrimitive); 120 Stream.of(n1, n2, n3, n4, n1).forEach(w::addNode); 121 final SequenceCommand command = action.simplifyWay(w); 122 assertNotNull(command); 123 assertEquals(2, command.getChildren().size()); 124 final Collection<DeleteCommand> deleteCommands = Utils.filteredCollection(command.getChildren(), DeleteCommand.class); 125 assertEquals(1, deleteCommands.size()); 126 assertEquals(Collections.singleton(n1), deleteCommands.iterator().next().getParticipatingPrimitives()); 127 } 99 128 }
Note:
See TracChangeset
for help on using the changeset viewer.