[wpilib] Split DriverStation into smaller classes (#8628)

This commit is contained in:
Thad House
2026-04-18 19:56:45 -07:00
committed by GitHub
parent 58ad633ae2
commit ab2aef2c29
108 changed files with 4406 additions and 3211 deletions

View File

@@ -2,14 +2,13 @@
// 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.
#include "wpi/driverstation/DriverStation.hpp"
#include <string>
#include <tuple>
#include <gtest/gtest.h>
#include "wpi/driverstation/Joystick.hpp"
#include "wpi/driverstation/internal/DriverStationBackend.hpp"
#include "wpi/simulation/DriverStationSim.hpp"
#include "wpi/simulation/SimHooks.hpp"
@@ -26,7 +25,7 @@ TEST_P(IsJoystickConnectedParametersTest, IsJoystickConnected) {
wpi::sim::DriverStationSim::NotifyNewData();
ASSERT_EQ(std::get<3>(GetParam()),
wpi::DriverStation::IsJoystickConnected(1));
wpi::internal::DriverStationBackend::IsJoystickConnected(1));
}
INSTANTIATE_TEST_SUITE_P(IsConnectedTests, IsJoystickConnectedParametersTest,
@@ -47,14 +46,16 @@ TEST_P(JoystickConnectionWarningTest, JoystickConnectionWarnings) {
// Set FMS and Silence settings
wpi::sim::DriverStationSim::SetFmsAttached(std::get<0>(GetParam()));
wpi::sim::DriverStationSim::NotifyNewData();
wpi::DriverStation::SilenceJoystickConnectionWarning(std::get<1>(GetParam()));
wpi::internal::DriverStationBackend::SilenceJoystickConnectionWarning(
std::get<1>(GetParam()));
// Create joystick and attempt to retrieve button.
wpi::Joystick joystick(0);
joystick.GetRawButton(1);
wpi::sim::StepTiming(1_s);
EXPECT_EQ(wpi::DriverStation::IsJoystickConnectionWarningSilenced(),
EXPECT_EQ(wpi::internal::DriverStationBackend::
IsJoystickConnectionWarningSilenced(),
std::get<2>(GetParam()));
EXPECT_EQ(::testing::internal::GetCapturedStderr().substr(
0, std::get<3>(GetParam()).size()),