mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal,tests] Use waitForProgramStart in tests (#8429)
Change setProgramStarted to accept a boolean so it can be set back to false by tests. This allows properly waiting for program start in tests.
This commit is contained in:
@@ -35,6 +35,7 @@ class ArmSimulationTest {
|
||||
void startThread() {
|
||||
HAL.initialize(500, 0);
|
||||
SimHooks.pauseTiming();
|
||||
SimHooks.setProgramStarted(false);
|
||||
DriverStationSim.resetData();
|
||||
m_robot = new Robot();
|
||||
m_thread = new Thread(m_robot::startCompetition);
|
||||
@@ -43,7 +44,7 @@ class ArmSimulationTest {
|
||||
m_joystickSim = new JoystickSim(Constants.kJoystickPort);
|
||||
|
||||
m_thread.start();
|
||||
SimHooks.stepTiming(0.0); // Wait for Notifiers
|
||||
SimHooks.waitForProgramStart();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
||||
@@ -33,11 +33,12 @@ class DigitalCommunicationTest {
|
||||
void startThread() {
|
||||
HAL.initialize(500, 0);
|
||||
SimHooks.pauseTiming();
|
||||
SimHooks.setProgramStarted(false);
|
||||
DriverStationSim.resetData();
|
||||
m_robot = new Robot();
|
||||
m_thread = new Thread(m_robot::startCompetition);
|
||||
m_thread.start();
|
||||
SimHooks.stepTiming(0.0); // Wait for Notifiers
|
||||
SimHooks.waitForProgramStart();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
||||
@@ -32,6 +32,7 @@ class ElevatorSimulationTest {
|
||||
void startThread() {
|
||||
HAL.initialize(500, 0);
|
||||
SimHooks.pauseTiming();
|
||||
SimHooks.setProgramStarted(false);
|
||||
DriverStationSim.resetData();
|
||||
m_robot = new Robot();
|
||||
m_thread = new Thread(m_robot::startCompetition);
|
||||
@@ -40,7 +41,7 @@ class ElevatorSimulationTest {
|
||||
m_joystickSim = new JoystickSim(Constants.kJoystickPort);
|
||||
|
||||
m_thread.start();
|
||||
SimHooks.stepTiming(0.0); // Wait for Notifiers
|
||||
SimHooks.waitForProgramStart();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
||||
@@ -36,6 +36,7 @@ class I2CCommunicationTest {
|
||||
void startThread() {
|
||||
HAL.initialize(500, 0);
|
||||
SimHooks.pauseTiming();
|
||||
SimHooks.setProgramStarted(false);
|
||||
DriverStationSim.resetData();
|
||||
m_future = new CompletableFuture<>();
|
||||
m_callback =
|
||||
@@ -44,7 +45,7 @@ class I2CCommunicationTest {
|
||||
m_robot = new Robot();
|
||||
m_thread = new Thread(m_robot::startCompetition);
|
||||
m_thread.start();
|
||||
SimHooks.stepTiming(0.0); // Wait for Notifiers
|
||||
SimHooks.waitForProgramStart();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
||||
@@ -43,6 +43,7 @@ class PotentiometerPIDTest {
|
||||
void startThread() {
|
||||
HAL.initialize(500, 0);
|
||||
SimHooks.pauseTiming();
|
||||
SimHooks.setProgramStarted(false);
|
||||
DriverStationSim.resetData();
|
||||
m_robot = new Robot();
|
||||
m_thread = new Thread(m_robot::startCompetition);
|
||||
@@ -78,7 +79,7 @@ class PotentiometerPIDTest {
|
||||
});
|
||||
|
||||
m_thread.start();
|
||||
SimHooks.stepTiming(0.0); // Wait for Notifiers
|
||||
SimHooks.waitForProgramStart();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
||||
Reference in New Issue
Block a user