use of org.malai.command.Command in project Malai by arnobl.
the class TestInteractor method testInteractionStartsOkCauseOfTheNonPublicAction.
@Test
void testInteractionStartsOkCauseOfTheNonPublicAction() throws CancelFSMException {
final boolean[] ok = { false };
ErrorCatcher.INSTANCE.setNotifier(exception -> ok[0] = true);
StubInstrument ins = new StubInstrument();
WidgetBinding interactor2 = new WidgetBindingImpl<CommandImplStub2, InteractionMock, StubInstrument>(ins, false, CommandImplStub2.class, new InteractionMock()) {
@Override
public void first() {
}
@Override
public boolean when() {
return true;
}
@Override
protected void executeCmdAsync(final Command cmd) {
}
};
ins.setActivated(true);
interactor2.fsmStarts();
assertTrue(ok[0]);
assertNull(interactor.getCommand());
}
use of org.malai.command.Command in project Malai by arnobl.
the class TestKeyNodeBinder method testCommandExecutedOnTwoCanvas.
@Test
public void testCommandExecutedOnTwoCanvas() {
new KeyNodeBinder<>(StubCmd.class, instrument).on(widget1, widget2).with(KeyCode.C).bind();
grabFocus(widget2);
type(KeyCode.C);
WaitForAsyncUtils.waitForFxEvents();
assertEquals(1, instrument.exec.get());
Command cmd = instrument.lastCreatedCmd;
assertEquals(1, ((StubCmd) instrument.lastCreatedCmd).exec.get());
grabFocus(widget1);
type(KeyCode.C);
WaitForAsyncUtils.waitForFxEvents();
assertEquals(2, instrument.exec.get());
assertEquals(1, ((StubCmd) instrument.lastCreatedCmd).exec.get());
assertNotSame(cmd, instrument.lastCreatedCmd);
}
use of org.malai.command.Command in project Malai by arnobl.
the class TestInteractor method testInteractionStartsOkCauseOfTheNonPublicAction2.
@Test
void testInteractionStartsOkCauseOfTheNonPublicAction2() throws CancelFSMException {
final boolean[] ok = { false };
ErrorCatcher.INSTANCE.setNotifier(exception -> ok[0] = true);
StubInstrument ins = new StubInstrument();
WidgetBinding interactor2 = new WidgetBindingImpl<CommandImplStub3, InteractionMock, StubInstrument>(ins, false, CommandImplStub3.class, new InteractionMock()) {
@Override
public void first() {
}
@Override
public boolean when() {
return true;
}
@Override
protected void executeCmdAsync(final Command cmd) {
}
};
ins.setActivated(true);
interactor2.fsmStarts();
assertTrue(ok[0]);
assertNull(interactor2.getCommand());
}
Aggregations