Go to the documentation of this file.
30 #include <gtest/gtest.h>
32 #include <QApplication>
52 std::stringstream input(
"Name: sample\n"
56 "Offset: {X: -1, Y: 1.1, Z: 1.1e3}\n"
58 "Style: loosey goosey\n");
67 EXPECT_EQ(7,
d.count_->getValue().toInt());
68 EXPECT_EQ(
"loosey goosey",
d.style_->getValue().toString().toStdString());
69 EXPECT_EQ(3.2
f,
d.pi_->getValue().toFloat());
70 Ogre::Vector3 offset =
d.offset_->getVector();
71 EXPECT_EQ(-1.
f, offset.x);
72 EXPECT_EQ(1.1
f, offset.y);
73 EXPECT_EQ(1100.
f, offset.z);
74 EXPECT_EQ(
"255; 255; 255",
d.color_->getValue().toString().toStdString());
75 EXPECT_EQ(
true,
d.getValue().toBool());
80 std::stringstream input(
"Name: root\n"
84 " Class: MockDisplay\n"
90 " Class: DisplayGroup\n"
94 " Class: MockDisplay\n"
99 " Class: BrokenDisplay\n"
111 EXPECT_EQ(
true, g.
getValue().toBool());
115 EXPECT_EQ(
"The class required for this display, 'BrokenDisplay', could not be loaded.",
123 d.subProp(
"Count")->setValue(37);
132 EXPECT_EQ(std::string(
"Class: \"\"\n"
138 "Offset: {X: 1, Y: 2, Z: 3}\n"
139 "Color: 10; 20; 30"),
140 out.toStdString().c_str());
149 d->setName(
"Steven");
150 d->subProp(
"Count")->setValue(101);
154 d->setName(
"Katherine");
155 d->subProp(
"Pi")->setValue(1.1);
165 EXPECT_EQ(std::string(
"Class: \"\"\n"
175 " Offset: {X: 1, Y: 2, Z: 3}\n"
176 " Color: 10; 20; 30\n"
183 " Offset: {X: 1, Y: 2, Z: 3}\n"
184 " Color: 10; 20; 30"),
185 out.toStdString().c_str());
190 std::stringstream input(
"Displays:\n"
192 " Class: MockDisplay\n");
207 std::stringstream input(
"Displays:\n"
208 " - Class: MissingDisplay\n"
211 " LemurStyle: chunky\n"
234 EXPECT_EQ(std::string(
"Class: \"\"\n"
238 " - Class: MissingDisplay\n"
239 " LemurStyle: chunky\n"
246 out.toStdString().c_str());
249 int main(
int argc,
char** argv)
252 QApplication
app(argc, argv);
253 testing::InitGoogleTest(&argc, argv);
254 return RUN_ALL_TESTS();
void save(Config config) const override
Save subproperties and the list of displays in this group to the given Config node.
virtual QString getClassId() const
Return the class identifier which was used to create this instance. This version just returns whateve...
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
virtual Display * getDisplayAt(int index) const
Return the index-th Display in this group, or NULL if the index is invalid.
virtual Property * subProp(const QString &sub_name)
Return the first child Property with the given name, or the FailureProperty if no child has the name.
virtual int numChildren() const
Return the number of child objects (Property or otherwise).
virtual QVariant getValue() const
Return the value of this Property as a QVariant. If the value has never been set, an invalid QVariant...
void addChild(Property *child, int index=-1) override
Add a child Property or Display.
void readStream(Config &config, std::istream &in, const QString &filename="data stream")
Read config data from a std::istream. This potentially changes the return value sof error(),...
int main(int argc, char **argv)
void load(const Config &config) override
Load subproperties and the list of displays in this group from the given Config node,...
void setName(const QString &name) override
Overridden from Property to set associated widget title to the new name.
virtual QString getDescription() const
Return the description.
QString writeString(const Config &config, const QString &filename="data string")
Write config data to a string, and return it. This potentially changes the return values of error() a...
Configuration data storage class.
A Display object which stores other Displays as children.
TEST(Display, load_properties)
int numChildren() const override
Return the number of child objects (Property and Display).
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Aug 2 2024 08:43:09