mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Fix shuffleboard C++ tests, and run them on desktop (#1351)
This commit is contained in:
committed by
Peter Johnson
parent
7b471d8c62
commit
fd82153456
@@ -60,8 +60,8 @@ SimpleWidget& ShuffleboardContainer::Add(
|
||||
|
||||
auto widget = std::make_unique<SimpleWidget>(*this, title);
|
||||
auto ptr = widget.get();
|
||||
widget->GetEntry().SetDefaultValue(defaultValue);
|
||||
m_components.emplace_back(std::move(widget));
|
||||
ptr->GetEntry().SetDefaultValue(defaultValue);
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
@@ -85,6 +85,11 @@ SimpleWidget& ShuffleboardContainer::Add(const wpi::Twine& title,
|
||||
return Add(title, nt::Value::MakeString(defaultValue));
|
||||
}
|
||||
|
||||
SimpleWidget& ShuffleboardContainer::Add(const wpi::Twine& title,
|
||||
const char* defaultValue) {
|
||||
return Add(title, nt::Value::MakeString(defaultValue));
|
||||
}
|
||||
|
||||
SimpleWidget& ShuffleboardContainer::Add(const wpi::Twine& title,
|
||||
wpi::ArrayRef<bool> defaultValue) {
|
||||
return Add(title, nt::Value::MakeBooleanArray(defaultValue));
|
||||
|
||||
@@ -12,7 +12,7 @@ using namespace frc;
|
||||
ShuffleboardLayout::ShuffleboardLayout(ShuffleboardContainer& parent,
|
||||
const wpi::Twine& name,
|
||||
const wpi::Twine& type)
|
||||
: ShuffleboardValue(name),
|
||||
: ShuffleboardValue(type),
|
||||
ShuffleboardComponent(parent, type, name),
|
||||
ShuffleboardContainer(name) {
|
||||
m_isLayout = true;
|
||||
|
||||
@@ -15,12 +15,11 @@ using namespace frc;
|
||||
|
||||
SimpleWidget::SimpleWidget(ShuffleboardContainer& parent,
|
||||
const wpi::Twine& title)
|
||||
: ShuffleboardValue(title), ShuffleboardWidget(parent, title) {}
|
||||
: ShuffleboardValue(title), ShuffleboardWidget(parent, title), m_entry() {}
|
||||
|
||||
nt::NetworkTableEntry SimpleWidget::GetEntry() {
|
||||
if (!m_entryInitialized) {
|
||||
if (!m_entry) {
|
||||
ForceGenerate();
|
||||
m_entryInitialized = true;
|
||||
}
|
||||
return m_entry;
|
||||
}
|
||||
@@ -28,9 +27,8 @@ nt::NetworkTableEntry SimpleWidget::GetEntry() {
|
||||
void SimpleWidget::BuildInto(std::shared_ptr<nt::NetworkTable> parentTable,
|
||||
std::shared_ptr<nt::NetworkTable> metaTable) {
|
||||
BuildMetadata(metaTable);
|
||||
if (!m_entryInitialized) {
|
||||
if (!m_entry) {
|
||||
m_entry = parentTable->GetEntry(GetTitle());
|
||||
m_entryInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user