mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[commands] Remove deprecated classes and functions (#5409)
Removes:
- PerpetualCommand
- Command.perpetually()
- CommandGroupBase
- Command.IsGrouped() (C++ only)
- Command.SetGrouped() (C++ only)
- Command.withInterrupt()
- ProxyScheduleCommand
- Button
- InternalButton, JoystickButton, NetworkButton and POVButton now subclass Trigger
- Old style Trigger functions:
- Trigger.whenActive
- Trigger.whileActiveOnce
- Trigger.whileActiveContinuous
- Trigger.whenInactive
- Trigger.toggleWhenActive
- Trigger.cancelWhenActive
- CommandScheduler.clearButtons()
- CommandScheduler.addButtons() (Java only)
- Command supplier constructor of SelectCommand
This commit is contained in:
@@ -200,23 +200,6 @@ class CommandDecoratorTest extends CommandTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal") // Command.perpetually()
|
||||
@Test
|
||||
void perpetuallyTest() {
|
||||
try (CommandScheduler scheduler = new CommandScheduler()) {
|
||||
Command command = new InstantCommand();
|
||||
|
||||
Command perpetual = command.perpetually();
|
||||
|
||||
scheduler.schedule(perpetual);
|
||||
scheduler.run();
|
||||
scheduler.run();
|
||||
scheduler.run();
|
||||
|
||||
assertTrue(scheduler.isScheduled(perpetual));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void unlessTest() {
|
||||
try (CommandScheduler scheduler = new CommandScheduler()) {
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// 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.
|
||||
|
||||
package edu.wpi.first.wpilibj2.command;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class PerpetualCommandTest extends CommandTestBase {
|
||||
@SuppressWarnings("removal") // PerpetualCommand
|
||||
@Test
|
||||
void perpetualCommandScheduleTest() {
|
||||
try (CommandScheduler scheduler = new CommandScheduler()) {
|
||||
PerpetualCommand command = new PerpetualCommand(new InstantCommand());
|
||||
|
||||
scheduler.schedule(command);
|
||||
scheduler.run();
|
||||
|
||||
assertTrue(scheduler.isScheduled(command));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,34 +194,6 @@ class TriggerTest extends CommandTestBase {
|
||||
assertEquals(1, endCounter.get());
|
||||
}
|
||||
|
||||
// Binding runnables directly is deprecated -- users should create the command manually
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
void runnableBindingTest() {
|
||||
InternalButton buttonWhenActive = new InternalButton();
|
||||
InternalButton buttonWhileActiveContinuous = new InternalButton();
|
||||
InternalButton buttonWhenInactive = new InternalButton();
|
||||
|
||||
buttonWhenActive.setPressed(false);
|
||||
buttonWhileActiveContinuous.setPressed(true);
|
||||
buttonWhenInactive.setPressed(true);
|
||||
|
||||
AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
buttonWhenActive.whenPressed(counter::incrementAndGet);
|
||||
buttonWhileActiveContinuous.whileActiveContinuous(counter::incrementAndGet);
|
||||
buttonWhenInactive.whenInactive(counter::incrementAndGet);
|
||||
|
||||
CommandScheduler scheduler = CommandScheduler.getInstance();
|
||||
|
||||
scheduler.run();
|
||||
buttonWhenActive.setPressed(true);
|
||||
buttonWhenInactive.setPressed(false);
|
||||
scheduler.run();
|
||||
|
||||
assertEquals(counter.get(), 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
void triggerCompositionTest() {
|
||||
InternalButton button1 = new InternalButton();
|
||||
|
||||
Reference in New Issue
Block a user