/** * Cast redo * * @param repaint * true to repaint the views afterwards */ @Override public void redo(boolean repaint) { app.getKernel().redo(); if (repaint) { app.doRepaintViews(); } }
@Override public void redo() { getApp().setWaitCursor(); kernel.redo(); updateActions(); getApp().resetPen(); getApp().setDefaultCursor(); }
@Test public void testUndoAddFirst() { setupUndo(); GeoLine[] lines = createLines(2); getApp().storeUndoInfo(); shouldHaveUndoPointsAndColumns(1, 1); showColumn(lines[0]); getKernel().undo(); Assert.assertTrue(view.isEmpty()); getKernel().redo(); shouldHaveUndoPointsAndColumns(2, 2); }
@Test public void testUndoAddSecond() { setupUndo(); GeoLine[] lines = createLines(2); getApp().storeUndoInfo(); shouldHaveUndoPointsAndColumns(1, 1); showColumn(lines[0]); showColumn(lines[1]); shouldHaveUndoPointsAndColumns(3, 3); getKernel().undo(); Assert.assertEquals(2, 2); getKernel().redo(); shouldHaveUndoPointsAndColumns(3, 3); }
@Test public void testUndoDeleteSecond() { setupUndo(); GeoLine[] lines = createLines(2); getApp().storeUndoInfo(); shouldHaveUndoPointsAndColumns(1, 1); showColumn(lines[0]); showColumn(lines[1]); hideColumn(lines[1]); shouldHaveUndoPointsAndColumns(4, 2); getKernel().undo(); shouldHaveUndoPointsAndColumns(3, 3); getKernel().redo(); shouldHaveUndoPointsAndColumns(4, 2); }
@Test public void testUndoShowPoints() { setupUndo(); TableValuesPoints points = setupPointListener(); GeoLine[] lines = createLines(2); getApp().storeUndoInfo(); shouldHaveUndoPointsAndColumns(1, 1); showColumn(lines[0]); points.setPointsVisible(1, false); points.setPointsVisible(1, true); shouldHaveUndoPointsAndColumns(4, 2); Assert.assertTrue(points.arePointsVisible(1)); getKernel().undo(); Assert.assertFalse(points.arePointsVisible(1)); getKernel().undo(); Assert.assertTrue(points.arePointsVisible(1)); getKernel().redo(); Assert.assertFalse(points.arePointsVisible(1)); getKernel().redo(); Assert.assertTrue(points.arePointsVisible(1)); }
@Test public void testUndoDeleteFirst() { setupUndo(); GeoLine[] lines = createLines(2); getApp().storeUndoInfo(); shouldHaveUndoPointsAndColumns(1, 1); showColumn(lines[0]); hideColumn(lines[0]); Assert.assertTrue(view.isEmpty()); getKernel().undo(); Assert.assertFalse(view.isEmpty()); getKernel().redo(); Assert.assertTrue(view.isEmpty()); shouldHaveUndoPointsAndColumns(3, 1); }
@Test public void testUndoRange() { setupUndo(); GeoLine[] lines = createLines(2); getApp().storeUndoInfo(); shouldHaveUndoPointsAndColumns(1, 1); setValuesSafe(0, 10, 2); showColumn(lines[0]); setValuesSafe(5, 20, 3); shouldHaveUndoPointsAndColumns(3, 2); Assert.assertEquals(5, view.getValuesMin(), .1); getKernel().undo(); Assert.assertEquals(0, view.getValuesMin(), .1); getKernel().redo(); Assert.assertEquals(5, view.getValuesMin(), .1); shouldHaveUndoPointsAndColumns(3, 2); }