Changeset 11102 in josm for trunk/test/unit
- Timestamp:
- 2016-10-08T14:04:09+02:00 (8 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 4 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/TestUtils.java
r10580 r11102 10 10 import java.io.InputStream; 11 11 import java.util.Arrays; 12 import java.util.Collection; 12 13 import java.util.Comparator; 13 14 15 import org.openstreetmap.josm.command.Command; 14 16 import org.openstreetmap.josm.data.osm.Node; 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 18 import org.openstreetmap.josm.data.osm.OsmUtils; 16 19 import org.openstreetmap.josm.data.osm.Relation; … … 245 248 return relation; 246 249 } 250 251 /** 252 * Creates a new empty command. 253 * @return a new empty command 254 */ 255 public static Command newCommand() { 256 return new Command() { 257 @Override 258 public String getDescriptionText() { 259 return ""; 260 } 261 262 @Override 263 public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, 264 Collection<OsmPrimitive> added) { 265 // Do nothing 266 } 267 }; 268 } 247 269 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java
r11024 r11102 7 7 import org.junit.Rule; 8 8 import org.junit.Test; 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.TestUtils; 11 import org.openstreetmap.josm.command.Command; 12 import org.openstreetmap.josm.data.osm.DataSet; 13 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 9 14 import org.openstreetmap.josm.testutils.JOSMTestRules; 10 15 … … 24 29 25 30 /** 26 * Unit test of {@link CommandStackDialog} class .31 * Unit test of {@link CommandStackDialog} class - empty case. 27 32 */ 28 33 @Test 29 public void testCommandStackDialog () {34 public void testCommandStackDialogEmpty() { 30 35 CommandStackDialog dlg = new CommandStackDialog(); 31 36 dlg.showDialog(); … … 34 39 assertFalse(dlg.isVisible()); 35 40 } 41 42 /** 43 * Unit test of {@link CommandStackDialog} class - not empty case. 44 */ 45 @Test 46 public void testCommandStackDialogNotEmpty() { 47 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 48 Main.getLayerManager().addLayer(layer); 49 try { 50 Command cmd1 = TestUtils.newCommand(); 51 Command cmd2 = TestUtils.newCommand(); 52 Main.main.undoRedo.add(cmd1); 53 Main.main.undoRedo.add(cmd2); 54 Main.main.undoRedo.undo(1); 55 56 assertFalse(Main.main.undoRedo.commands.isEmpty()); 57 assertFalse(Main.main.undoRedo.redoCommands.isEmpty()); 58 59 CommandStackDialog dlg = new CommandStackDialog(); 60 dlg.showDialog(); 61 assertTrue(dlg.isVisible()); 62 dlg.hideDialog(); 63 assertFalse(dlg.isVisible()); 64 } finally { 65 Main.main.undoRedo.clean(); 66 Main.getLayerManager().removeLayer(layer); 67 } 68 } 36 69 }
Note:
See TracChangeset
for help on using the changeset viewer.