Skip to content

Commit

Permalink
[PlaybackController] Fix tests failing
Browse files Browse the repository at this point in the history
  • Loading branch information
ScribbleTAS committed Feb 28, 2024
1 parent 7d7bab2 commit da93fcb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ public static void register(EventBase eventListener) {
}
}
}

public static void register(EventBase... eventListeners) {
for(EventBase eventListener : eventListeners) {
register(eventListener);
}
}

/**
* Unregisters an object from being an event listener.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class PlaybackControllerClient implements ClientPacketHandler, EventVirtu
* The state of the controller when the state is paused
*/
private TASstate tempPause = TASstate.NONE;

/**
* The current index of the inputs
*/
Expand Down
13 changes: 13 additions & 0 deletions src/test/java/tasmod/virtual/VirtualInputTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
import org.apache.commons.lang3.tuple.Triple;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import com.minecrafttas.mctcommon.events.EventListenerRegistry;
import com.minecrafttas.tasmod.events.EventClient.EventVirtualCameraAngleTick;
import com.minecrafttas.tasmod.events.EventClient.EventVirtualKeyboardTick;
import com.minecrafttas.tasmod.events.EventClient.EventVirtualMouseTick;
import com.minecrafttas.tasmod.virtual.VirtualCameraAngle;
import com.minecrafttas.tasmod.virtual.VirtualInput;
import com.minecrafttas.tasmod.virtual.VirtualKey;
Expand All @@ -21,6 +26,14 @@ class VirtualInputTest {

private final Logger LOGGER = LogManager.getLogger("TASmod");

@BeforeAll
static void beforeAll() {
EventVirtualKeyboardTick kb = (keyboard)->null;
EventVirtualMouseTick ms = (mouse)->null;
EventVirtualCameraAngleTick cmra = (cameraangle)->null;
EventListenerRegistry.register(kb, ms, cmra);
}

/**
* Test constructor initializing keyboard, mouse and camera_angle
*/
Expand Down

0 comments on commit da93fcb

Please sign in to comment.