use of io.github.interacto.command.library.Undo in project latexdraw by arnobl.
the class TestCanvas method testSelectionBorderUpdatedOnUndoModifyingCmd.
@Test
public void testSelectionBorderUpdatedOnUndoModifyingCmd() {
Cmds.of(addRec, selectAllShapes).execute();
final Bounds borderInitial = canvas.getSelectionBorder().getBoundsInLocal();
final RotateShapes cmd = new RotateShapes(addedRec.getGravityCentre(), addedRec, Math.PI / 2d);
cmd.doIt();
cmd.done();
CommandsRegistry.getInstance().addCommand(cmd);
WaitForAsyncUtils.waitForFxEvents();
final Bounds border = canvas.getSelectionBorder().getBoundsInLocal();
final Undo undo = new Undo();
undo.doIt();
undo.done();
CommandsRegistry.getInstance().addCommand(undo);
WaitForAsyncUtils.waitForFxEvents();
final Bounds border2 = canvas.getSelectionBorder().getBoundsInLocal();
assertThat(border2).isNotEqualTo(border);
assertThat(border2).isEqualTo(borderInitial);
}
use of io.github.interacto.command.library.Undo in project latexdraw by arnobl.
the class TestCanvas method testSelectionBorderUpdatedOnRedoModifyingCmd.
@Test
public void testSelectionBorderUpdatedOnRedoModifyingCmd() {
Cmds.of(addRec, selectAllShapes).execute();
final RotateShapes cmd = new RotateShapes(addedRec.getGravityCentre(), addedRec, Math.PI / 2d);
cmd.doCmdBody();
cmd.done();
CommandsRegistry.getInstance().addCommand(cmd);
WaitForAsyncUtils.waitForFxEvents();
final Bounds borderInitial = canvas.getSelectionBorder().getBoundsInLocal();
final Undo undo = new Undo();
undo.doIt();
undo.done();
CommandsRegistry.getInstance().addCommand(undo);
WaitForAsyncUtils.waitForFxEvents();
final Bounds border = canvas.getSelectionBorder().getBoundsInLocal();
final Redo redo = new Redo();
redo.doIt();
redo.done();
CommandsRegistry.getInstance().addCommand(redo);
WaitForAsyncUtils.waitForFxEvents();
final Bounds border2 = canvas.getSelectionBorder().getBoundsInLocal();
assertThat(border2).isNotEqualTo(border);
assertThat(border2).isEqualTo(borderInitial);
}
Aggregations