use of com.willwinder.universalgcodesender.model.PartialPosition in project Universal-G-Code-Sender by winder.
the class G2CoreControllerTest method jogMachineTo.
@Test
public void jogMachineTo() throws Exception {
// Given
when(communicator.isConnected()).thenReturn(true);
// Simulate that the machine is running in mm
controller.getCurrentGcodeState().units = Code.G21;
// When
InOrder orderVerifier = inOrder(communicator);
controller.jogMachineTo(new PartialPosition(1.0, 2.0, 3.0, UnitUtils.Units.MM), 1000);
// Then
orderVerifier.verify(communicator, times(1)).queueCommand(any(GcodeCommand.class));
orderVerifier.verify(communicator).streamCommands();
GcodeCommand command = queueCommandArgumentCaptor.getAllValues().get(0);
assertEquals("G21G90G1X1Y2Z3F1000", command.getCommandString());
assertTrue(command.isGenerated());
assertTrue(command.isTemporaryParserModalChange());
}
use of com.willwinder.universalgcodesender.model.PartialPosition in project Universal-G-Code-Sender by winder.
the class G2CoreControllerTest method jogMachineShouldTurnSwitchOfIsJoggingWhenComplete.
@Test
public void jogMachineShouldTurnSwitchOfIsJoggingWhenComplete() throws Exception {
// Given
when(communicator.isConnected()).thenReturn(true);
controller.jogMachine(new PartialPosition(1.0, 2.0, 3.0, UnitUtils.Units.MM), 1000d);
// receive IDLE
controller.rawResponseHandler("{\"sr\":{\"stat\": 1}}");
// When
controller.sendCommandImmediately(new GcodeCommand("G0 X1"));
// receive RUN
controller.rawResponseHandler("{\"sr\":{\"stat\": 5}}");
// Then
assertEquals("Should now consider send commands as a normal run state", ControllerState.RUN, controller.getControllerStatus().getState());
}
use of com.willwinder.universalgcodesender.model.PartialPosition in project Universal-G-Code-Sender by winder.
the class G2CoreControllerTest method jogMachine.
@Test
public void jogMachine() throws Exception {
// Given
when(communicator.isConnected()).thenReturn(true);
// Simulate that the machine is running in inches
controller.getCurrentGcodeState().units = Code.G21;
// When
InOrder orderVerifier = inOrder(communicator);
controller.jogMachine(new PartialPosition(100., 100., 100., UnitUtils.Units.MM), 1000);
// Then
orderVerifier.verify(communicator, times(1)).queueCommand(any(GcodeCommand.class));
orderVerifier.verify(communicator).streamCommands();
GcodeCommand command = queueCommandArgumentCaptor.getAllValues().get(0);
assertEquals("G21G91G1X100Y100Z100F1000", command.getCommandString());
assertTrue(command.isGenerated());
assertTrue(command.isTemporaryParserModalChange());
}
use of com.willwinder.universalgcodesender.model.PartialPosition in project Universal-G-Code-Sender by winder.
the class G2CoreControllerTest method jogMachineWhenUsingInchesShouldConvertCoordinates.
@Test
public void jogMachineWhenUsingInchesShouldConvertCoordinates() throws Exception {
// Given
when(communicator.isConnected()).thenReturn(true);
// Simulate that the machine is running in inches
controller.getCurrentGcodeState().units = Code.G20;
// When
InOrder orderVerifier = inOrder(communicator);
controller.jogMachine(new PartialPosition(100., 100., 100., UnitUtils.Units.MM), 1000);
// Then
orderVerifier.verify(communicator, times(1)).queueCommand(any(GcodeCommand.class));
orderVerifier.verify(communicator).streamCommands();
GcodeCommand command = queueCommandArgumentCaptor.getAllValues().get(0);
assertEquals("G20G91G1X3.937Y3.937Z3.937F39.37", command.getCommandString());
assertTrue(command.isGenerated());
assertTrue(command.isTemporaryParserModalChange());
}
use of com.willwinder.universalgcodesender.model.PartialPosition in project Universal-G-Code-Sender by winder.
the class TinyGControllerTest method jogMachine.
@Test
public void jogMachine() throws Exception {
// Given
when(communicator.isConnected()).thenReturn(true);
// Simulate that the machine is running in inches
controller.getCurrentGcodeState().units = Code.G21;
// When
InOrder orderVerifier = inOrder(communicator);
controller.jogMachine(new PartialPosition(100., 100., 100., UnitUtils.Units.MM), 1000);
// Then
orderVerifier.verify(communicator, times(1)).queueCommand(any(GcodeCommand.class));
orderVerifier.verify(communicator).streamCommands();
GcodeCommand command = queueCommandArgumentCaptor.getAllValues().get(0);
assertEquals("G21G91G1X100Y100Z100F1000", command.getCommandString());
assertTrue(command.isGenerated());
assertTrue(command.isTemporaryParserModalChange());
}
Aggregations