[wpilib] Add way to silence joystick connection warnings (#2845)

Warnings cannot be silenced when connected to FMS.
This commit is contained in:
Prateek Machiraju
2020-11-14 15:00:56 -05:00
committed by GitHub
parent 7a73946ce1
commit 2ef67f20a7
5 changed files with 121 additions and 8 deletions

View File

@@ -41,4 +41,23 @@ class DriverStationTest {
arguments(4, 10, 1, true)
);
}
@MethodSource("connectionWarningProvider")
void testConnectionWarnings(boolean fms, boolean silence, boolean expected) {
DriverStationSim.setFmsAttached(fms);
DriverStationSim.notifyNewData();
DriverStation.getInstance().silenceJoystickConnectionWarning(silence);
assertEquals(expected,
DriverStation.getInstance().isJoystickConnectionWarningSilenced());
}
static Stream<Arguments> connectionWarningProvider() {
return Stream.of(
arguments(false, true, true),
arguments(false, false, false),
arguments(true, true, false),
arguments(true, false, false)
);
}
}