Changeset 14134 in josm for trunk/test


Ignore:
Timestamp:
2018-08-11T23:33:58+02:00 (16 months ago)
Author:
Don-vip
Message:

see #15229 - deprecate Main*.undoRedo - make UndoRedoHandler a singleton

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java

    r14005 r14134  
    1616import org.junit.Rule;
    1717import org.junit.Test;
     18import org.openstreetmap.josm.data.UndoRedoHandler;
    1819import org.openstreetmap.josm.data.coor.EastNorth;
    1920import org.openstreetmap.josm.data.osm.DataSet;
     
    9192            assertNotNull(renderer.getListCellRendererComponent(lstPrimitives, n3, 0, false, false));
    9293
    93             MainApplication.undoRedo.undo();
     94            UndoRedoHandler.getInstance().undo();
    9495
    9596            assertEquals(2, w.getNodesCount());
  • trunk/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java

    r12729 r14134  
    1515import org.openstreetmap.josm.command.SequenceCommand;
    1616import org.openstreetmap.josm.data.APIDataSet;
     17import org.openstreetmap.josm.data.UndoRedoHandler;
    1718import org.openstreetmap.josm.data.osm.DataSet;
    1819import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1920import org.openstreetmap.josm.data.osm.Relation;
    2021import org.openstreetmap.josm.data.osm.Way;
    21 import org.openstreetmap.josm.gui.MainApplication;
    2222import org.openstreetmap.josm.testutils.JOSMTestRules;
    2323
     
    4242    public void testCheckUpload() {
    4343        // Empty data set
    44         MainApplication.undoRedo.commands.clear();
     44        UndoRedoHandler.getInstance().commands.clear();
    4545        new FixDataHook().checkUpload(new APIDataSet());
    46         assertTrue(MainApplication.undoRedo.commands.isEmpty());
     46        assertTrue(UndoRedoHandler.getInstance().commands.isEmpty());
    4747
    4848        // Complete data set (except empty node which cannot be tested anymore)
     
    7676        ads.init(new DataSet(emptyWay, emptyRelation, w1, w2, w3, w4, w5, w6, w7, r1, r2));
    7777
    78         MainApplication.undoRedo.commands.clear();
     78        UndoRedoHandler.getInstance().commands.clear();
    7979        new FixDataHook().checkUpload(ads);
    80         assertEquals(1, MainApplication.undoRedo.commands.size());
     80        assertEquals(1, UndoRedoHandler.getInstance().commands.size());
    8181
    82         SequenceCommand seq = (SequenceCommand) MainApplication.undoRedo.commands.iterator().next();
     82        SequenceCommand seq = (SequenceCommand) UndoRedoHandler.getInstance().commands.iterator().next();
    8383        Collection<? extends OsmPrimitive> prims = seq.getParticipatingPrimitives();
    8484        assertNotNull(prims);
  • trunk/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java

    r12828 r14134  
    1313import org.junit.Test;
    1414import org.openstreetmap.josm.command.SplitWayCommand.Strategy;
     15import org.openstreetmap.josm.data.UndoRedoHandler;
    1516import org.openstreetmap.josm.data.coor.LatLon;
    1617import org.openstreetmap.josm.data.osm.DataSet;
     
    2021import org.openstreetmap.josm.data.osm.RelationMember;
    2122import org.openstreetmap.josm.data.osm.Way;
    22 import org.openstreetmap.josm.gui.MainApplication;
    2323import org.openstreetmap.josm.testutils.JOSMTestRules;
    2424
     
    121121        final SplitWayCommand result = SplitWayCommand.splitWay(
    122122                w2, SplitWayCommand.buildSplitChunks(w2, Arrays.asList(n3, n4, n5)), new ArrayList<OsmPrimitive>(), strategy);
    123         MainApplication.undoRedo.add(result);
     123        UndoRedoHandler.getInstance().add(result);
    124124
    125125        assertEquals(6, route.getMembersCount());
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java

    r12726 r14134  
    99import org.openstreetmap.josm.TestUtils;
    1010import org.openstreetmap.josm.command.Command;
     11import org.openstreetmap.josm.data.UndoRedoHandler;
    1112import org.openstreetmap.josm.data.osm.DataSet;
    1213import org.openstreetmap.josm.gui.MainApplication;
     
    5253            Command cmd1 = TestUtils.newCommand(ds);
    5354            Command cmd2 = TestUtils.newCommand(ds);
    54             MainApplication.undoRedo.add(cmd1);
    55             MainApplication.undoRedo.add(cmd2);
    56             MainApplication.undoRedo.undo(1);
     55            UndoRedoHandler.getInstance().add(cmd1);
     56            UndoRedoHandler.getInstance().add(cmd2);
     57            UndoRedoHandler.getInstance().undo(1);
    5758
    58             assertFalse(MainApplication.undoRedo.commands.isEmpty());
    59             assertFalse(MainApplication.undoRedo.redoCommands.isEmpty());
     59            assertFalse(UndoRedoHandler.getInstance().commands.isEmpty());
     60            assertFalse(UndoRedoHandler.getInstance().redoCommands.isEmpty());
    6061
    6162            MapFrame map = MainApplication.getMap();
     
    6869            assertFalse(dlg.isVisible());
    6970        } finally {
    70             MainApplication.undoRedo.clean();
     71            UndoRedoHandler.getInstance().clean();
    7172            MainApplication.getLayerManager().removeLayer(layer);
    7273        }
Note: See TracChangeset for help on using the changeset viewer.