use of com.willwinder.universalgcodesender.utils.ContinuousJogWorker in project Universal-G-Code-Sender by winder.
the class AnalogJogActionTest method actionPerformedShouldGenerateJogCommandsWhenStateIsIdle.
@Test
public void actionPerformedShouldGenerateJogCommandsWhenStateIsIdle() {
ContinuousJogWorker worker = mock(ContinuousJogWorker.class);
AnalogJogAction action = new AnalogJogAction(worker, Axis.Y);
// Simulate the controller in running state
action.UGSEvent(new ControllerStateEvent(ControllerState.IDLE, ControllerState.IDLE));
action.actionPerformed(null);
assertTrue(action.isEnabled());
verify(worker, times(1)).setDirection(eq(Axis.Y), anyFloat());
}
use of com.willwinder.universalgcodesender.utils.ContinuousJogWorker in project Universal-G-Code-Sender by winder.
the class AnalogJogActionTest method actionPerformedShouldNotGenerateJogCommandsWhenStateIsDoor.
@Test
public void actionPerformedShouldNotGenerateJogCommandsWhenStateIsDoor() {
ContinuousJogWorker worker = mock(ContinuousJogWorker.class);
AnalogJogAction action = new AnalogJogAction(worker, Axis.Y);
// Simulate the controller in running state
action.UGSEvent(new ControllerStateEvent(ControllerState.DOOR, ControllerState.IDLE));
action.actionPerformed(null);
assertFalse(action.isEnabled());
verifyNoInteractions(worker);
}
use of com.willwinder.universalgcodesender.utils.ContinuousJogWorker in project Universal-G-Code-Sender by winder.
the class AnalogJogActionTest method actionPerformedShouldGenerateJogCommandsWhenStateIsJog.
@Test
public void actionPerformedShouldGenerateJogCommandsWhenStateIsJog() {
ContinuousJogWorker worker = mock(ContinuousJogWorker.class);
AnalogJogAction action = new AnalogJogAction(worker, Axis.Y);
// Simulate the controller in running state
action.UGSEvent(new ControllerStateEvent(ControllerState.JOG, ControllerState.IDLE));
action.actionPerformed(null);
assertTrue(action.isEnabled());
verify(worker, times(1)).setDirection(eq(Axis.Y), anyFloat());
}
use of com.willwinder.universalgcodesender.utils.ContinuousJogWorker in project Universal-G-Code-Sender by winder.
the class AnalogJogActionTest method setValueShouldSetThePercentageToUse.
@Test
public void setValueShouldSetThePercentageToUse() {
ContinuousJogWorker worker = mock(ContinuousJogWorker.class);
AnalogJogAction action = new AnalogJogAction(worker, Axis.Y);
// Simulate the controller in running state
action.setValue(0.6f);
action.UGSEvent(new ControllerStateEvent(ControllerState.JOG, ControllerState.IDLE));
action.actionPerformed(null);
assertTrue(action.isEnabled());
verify(worker, times(1)).setDirection(eq(Axis.Y), eq(0.6f));
}
use of com.willwinder.universalgcodesender.utils.ContinuousJogWorker in project Universal-G-Code-Sender by winder.
the class AnalogJogActionTest method actionPerformedShouldNotGenerateJogCommandsWhenStateIsRunning.
@Test
public void actionPerformedShouldNotGenerateJogCommandsWhenStateIsRunning() {
ContinuousJogWorker worker = mock(ContinuousJogWorker.class);
AnalogJogAction action = new AnalogJogAction(worker, Axis.Y);
// Simulate the controller in running state
action.UGSEvent(new ControllerStateEvent(ControllerState.RUN, ControllerState.IDLE));
action.actionPerformed(null);
assertFalse(action.isEnabled());
verifyNoInteractions(worker);
}
Aggregations