Changeset 14562 in josm for trunk/test
- Timestamp:
- 2018-12-15T17:19:00+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java
r14281 r14562 73 73 } 74 74 } 75 76 /** 77 * Unit test of {@link CommandStackDialog} class - undo followed by addCommand should empty redo tree. 78 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/16911">Bug #16911</a>. 79 */ 80 @Test 81 public void testCommandStackDialogUndoAddCommand() { 82 DataSet ds = new DataSet(); 83 OsmDataLayer layer = new OsmDataLayer(ds, "", null); 84 MainApplication.getLayerManager().addLayer(layer); 85 try { 86 Command cmd1 = TestUtils.newCommand(ds); 87 Command cmd2 = TestUtils.newCommand(ds); 88 Command cmd3 = TestUtils.newCommand(ds); 89 MapFrame map = MainApplication.getMap(); 90 CommandStackDialog dlg = new CommandStackDialog(); 91 map.addToggleDialog(dlg); 92 dlg.unfurlDialog(); 93 assertTrue(dlg.isVisible()); 94 assertTrue(dlg.redoTreeIsEmpty()); 95 UndoRedoHandler.getInstance().add(cmd1); 96 assertTrue(dlg.redoTreeIsEmpty()); 97 UndoRedoHandler.getInstance().add(cmd2); 98 assertTrue(dlg.redoTreeIsEmpty()); 99 UndoRedoHandler.getInstance().undo(1); 100 assertFalse(dlg.redoTreeIsEmpty()); 101 UndoRedoHandler.getInstance().add(cmd3); 102 assertTrue(dlg.redoTreeIsEmpty()); 103 104 assertTrue(UndoRedoHandler.getInstance().hasUndoCommands()); 105 assertFalse(UndoRedoHandler.getInstance().hasRedoCommands()); 106 107 map.removeToggleDialog(dlg); 108 dlg.hideDialog(); 109 assertFalse(dlg.isVisible()); 110 } finally { 111 UndoRedoHandler.getInstance().clean(); 112 MainApplication.getLayerManager().removeLayer(layer); 113 } 114 } 75 115 }
Note:
See TracChangeset
for help on using the changeset viewer.