2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "CommandTestBase.hpp"
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2025-11-07 20:00:05 -05:00
|
|
|
using namespace wpi::cmd;
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
CommandTestBase::CommandTestBase() {
|
|
|
|
|
auto& scheduler = CommandScheduler::GetInstance();
|
|
|
|
|
scheduler.CancelAll();
|
|
|
|
|
scheduler.Enable();
|
2022-06-09 08:16:51 +03:00
|
|
|
scheduler.GetActiveButtonLoop()->Clear();
|
2023-07-14 01:12:01 -04:00
|
|
|
scheduler.UnregisterAllSubsystems();
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2023-06-19 22:56:56 -07:00
|
|
|
SetDSEnabled(true);
|
2020-12-28 12:58:06 -08:00
|
|
|
}
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2023-06-19 22:56:56 -07:00
|
|
|
CommandTestBase::~CommandTestBase() {
|
|
|
|
|
CommandScheduler::GetInstance().GetActiveButtonLoop()->Clear();
|
2023-07-14 01:12:01 -04:00
|
|
|
CommandScheduler::GetInstance().UnregisterAllSubsystems();
|
2020-12-28 12:58:06 -08:00
|
|
|
}
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2023-06-19 22:56:56 -07:00
|
|
|
CommandScheduler CommandTestBase::GetScheduler() {
|
|
|
|
|
return CommandScheduler();
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandTestBase::SetDSEnabled(bool enabled) {
|
2025-11-07 20:00:05 -05:00
|
|
|
wpi::sim::DriverStationSim::SetDsAttached(true);
|
|
|
|
|
wpi::sim::DriverStationSim::SetEnabled(enabled);
|
|
|
|
|
wpi::sim::DriverStationSim::NotifyNewData();
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|