[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:
Ryan Blue
2023-07-10 12:56:18 -04:00
committed by GitHub
parent b250a03944
commit 7a099cb02a
49 changed files with 82 additions and 2031 deletions

View File

@@ -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()) {

View File

@@ -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));
}
}
}

View File

@@ -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();