Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
breiler committed Jan 4, 2025
1 parent 2ae0dc4 commit 9236286
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ This file is part of Universal Gcode Sender (UGS).
import static com.willwinder.universalgcodesender.model.CommunicatorState.COMM_CHECK;
import static com.willwinder.universalgcodesender.model.CommunicatorState.COMM_IDLE;
import static com.willwinder.universalgcodesender.model.CommunicatorState.COMM_SENDING;
import com.willwinder.universalgcodesender.model.Overrides;
import com.willwinder.universalgcodesender.model.PartialPosition;
import com.willwinder.universalgcodesender.model.UnitUtils;
import com.willwinder.universalgcodesender.services.MessageService;
Expand Down Expand Up @@ -717,22 +718,22 @@ public void cancelSendOnDoorStateShouldCancelCommandAndIssueReset() throws Excep

assertEquals(1, mgc.numCancelSendCalls);
assertEquals(0, mgc.numPauseSendCalls);
assertEquals(0, mgc.sentBytes.size());
assertEquals(3, mgc.sentBytes.size());

// First round we will store the last position
instance.rawResponseHandler("<Door|MPos:0.000,0.000,0.000|FS:0,0|Pn:XYZ>");

assertEquals(1, mgc.numCancelSendCalls);
assertEquals(0, mgc.numPauseSendCalls);
assertEquals(0, mgc.sentBytes.size());
assertEquals(3, mgc.sentBytes.size());

// Now we will do the actual cancel
instance.rawResponseHandler("<Door|MPos:0.000,0.000,0.000|FS:0,0|Pn:XYZ>");

assertEquals(2, mgc.numCancelSendCalls);
assertEquals(0, mgc.numPauseSendCalls);
assertEquals(1, mgc.sentBytes.size());
assertEquals(Byte.valueOf(GRBL_RESET_COMMAND), mgc.sentBytes.get(0));
assertEquals(4, mgc.sentBytes.size());
assertEquals(Byte.valueOf(GRBL_RESET_COMMAND), mgc.sentBytes.get(3));
}

private void sendStuff(GrblController instance) throws Exception {
Expand Down Expand Up @@ -1293,7 +1294,10 @@ public void errorInCheckModeSending() throws Exception {
assertEquals(COMM_SENDING, gc.getCommunicatorState());
assertEquals(ControllerState.CHECK, gc.getControllerStatus().getState());
assertFalse(gc.isPaused());
assertEquals(Byte.valueOf(GRBL_PAUSE_COMMAND), mgc.sentBytes.get(0));
assertEquals(GrblUtils.getOverrideForEnum(Overrides.CMD_RAPID_OVR_RESET, gc.getCapabilities()), mgc.sentBytes.get(0));
assertEquals(GrblUtils.getOverrideForEnum(Overrides.CMD_FEED_OVR_RESET, gc.getCapabilities()), mgc.sentBytes.get(1));
assertEquals(GrblUtils.getOverrideForEnum(Overrides.CMD_SPINDLE_OVR_RESET, gc.getCapabilities()), mgc.sentBytes.get(2));
assertEquals(Byte.valueOf(GRBL_PAUSE_COMMAND), mgc.sentBytes.get(3));
}

@Test
Expand Down

0 comments on commit 9236286

Please sign in to comment.