mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[commands] Merge CommandBase into Command and SubsystemBase into Subsystem (#5392)
Moves all CommandBase functionality into Command and deprecates CommandBase for removal. Moves all SubsystemBase functionality into Subsystem and deprecates SubsystemBase for removal. Adds a function to CommandScheduler to remove all registered Subsystems.
This commit is contained in:
@@ -12,14 +12,14 @@
|
||||
#include "frc2/command/CommandHelper.h"
|
||||
#include "frc2/command/CommandScheduler.h"
|
||||
#include "frc2/command/SetUtilities.h"
|
||||
#include "frc2/command/SubsystemBase.h"
|
||||
#include "frc2/command/Subsystem.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "make_vector.h"
|
||||
|
||||
namespace frc2 {
|
||||
|
||||
class TestSubsystem : public SubsystemBase {
|
||||
class TestSubsystem : public Subsystem {
|
||||
public:
|
||||
explicit TestSubsystem(std::function<void()> periodic = [] {})
|
||||
: m_periodic{periodic} {}
|
||||
@@ -32,7 +32,7 @@ class TestSubsystem : public SubsystemBase {
|
||||
/**
|
||||
* NOTE: Moving mock objects causes EXPECT_CALL to not work correctly!
|
||||
*/
|
||||
class MockCommand : public CommandHelper<CommandBase, MockCommand> {
|
||||
class MockCommand : public CommandHelper<Command, MockCommand> {
|
||||
public:
|
||||
MOCK_CONST_METHOD0(GetRequirements, wpi::SmallSet<Subsystem*, 4>());
|
||||
MOCK_METHOD0(IsFinished, bool());
|
||||
@@ -107,12 +107,14 @@ class CommandTestBaseWithParam : public ::testing::TestWithParam<T> {
|
||||
scheduler.CancelAll();
|
||||
scheduler.Enable();
|
||||
scheduler.GetActiveButtonLoop()->Clear();
|
||||
scheduler.UnregisterAllSubsystems();
|
||||
|
||||
SetDSEnabled(true);
|
||||
}
|
||||
|
||||
~CommandTestBaseWithParam() override {
|
||||
CommandScheduler::GetInstance().GetActiveButtonLoop()->Clear();
|
||||
CommandScheduler::GetInstance().UnregisterAllSubsystems();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user