Changeset 12350 in josm


Ignore:
Timestamp:
2017-06-09T00:03:23+02:00 (7 years ago)
Author:
michael2402
Message:

See #13036: Add data set tests to SelectCommand

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/SelectCommand.java

    r12349 r12350  
    5959    @Override
    6060    public void undoCommand() {
     61        ensurePrimitivesAreInDataset();
     62
    6163        getAffectedDataSet().setSelected(oldSelection);
    6264    }
     
    6466    @Override
    6567    public boolean executeCommand() {
     68        ensurePrimitivesAreInDataset();
     69
    6670        oldSelection = getAffectedDataSet().getSelected();
    6771        getAffectedDataSet().setSelected(newSelection);
    6872        return true;
     73    }
     74
     75    @Override
     76    public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
     77        return Collections.unmodifiableCollection(newSelection);
    6978    }
    7079
  • trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java

    r10758 r12350  
    123123    @Test
    124124    public void testGetParticipatingPrimitives() {
    125         SelectCommand command = new SelectCommand(Arrays.asList(testData.existingNode, testData.existingWay));
     125        SelectCommand command = new SelectCommand(Arrays.asList(testData.existingNode));
    126126        command.executeCommand();
    127         assertArrayEquals(new Object[] {}, command.getParticipatingPrimitives().toArray());
     127        assertArrayEquals(new Object[] { testData.existingNode }, command.getParticipatingPrimitives().toArray());
    128128    }
    129129
Note: See TracChangeset for help on using the changeset viewer.