32 #include <gtest/gtest.h> 48 EXPECT_EQ(
"chub", p.
getName().toStdString());
62 EXPECT_EQ(199, p.
getValue().toInt());
71 p.connect(&p, SIGNAL(aboutToChange()), &r, SLOT(aboutToChange()));
72 p.connect(&p, SIGNAL(changed()), &r, SLOT(changed()));
75 EXPECT_EQ(
" aboutToChange, v=0 changed, v=17", r.
result().toStdString());
81 new Property(
"Alpha", 0.5,
"The amount of transparency to apply to the grid lines.", display);
83 new Property(
"Beta Band", 10,
"The number of betas to apply to the grid lines.", display);
84 new Property(
"Gamma Topic",
"chubby",
"The topic on which to listen for Gamma messages.", display);
85 Property* position =
new Property(
"Position", QVariant(),
"Position of the chub.", display);
86 new Property(
"X", 1.1
f,
"X component of the position of the chub.", position);
87 new Property(
"Y", 0.717
f,
"Y component of the position of the chub.", position);
102 printf(
"Next line should say 'ERROR' but not crash.\n");
118 Ogre::Vector3 vec(1, 2, 3);
122 EXPECT_EQ(1, vec2.x);
123 EXPECT_EQ(2, vec2.y);
124 EXPECT_EQ(3, vec2.z);
153 EXPECT_EQ(0.9
f, vec.x);
154 EXPECT_EQ(1.1
f, vec.y);
155 EXPECT_EQ(1.3
f, vec.z);
171 p.connect(&p, SIGNAL(aboutToChange()), &r, SLOT(aboutToChange()));
172 p.connect(&p, SIGNAL(changed()), &r, SLOT(changed()));
174 p.
setVector(Ogre::Vector3(.1, .0001, 1000));
175 EXPECT_EQ(
" aboutToChange, v=0; 0; 0 changed, v=0.1; 0.0001; 1000", r.
result().toStdString());
179 EXPECT_EQ(
" aboutToChange, v=0.1; 0.0001; 1000 changed, v=0.1; 0.0001; 2.1", r.
result().toStdString());
186 EXPECT_EQ(0, quat.x);
187 EXPECT_EQ(0, quat.y);
188 EXPECT_EQ(0, quat.z);
189 EXPECT_EQ(1, quat.w);
195 Ogre::Quaternion quat(4, 1, 2, 3);
199 EXPECT_EQ(1, quat2.x);
200 EXPECT_EQ(2, quat2.y);
201 EXPECT_EQ(3, quat2.z);
202 EXPECT_EQ(4, quat2.w);
211 EXPECT_EQ(1, quat.x);
212 EXPECT_EQ(2, quat.y);
213 EXPECT_EQ(3, quat.z);
214 EXPECT_EQ(4, quat.w);
219 EXPECT_EQ(1, quat.x);
220 EXPECT_EQ(2, quat.y);
221 EXPECT_EQ(3, quat.z);
222 EXPECT_EQ(4, quat.w);
234 EXPECT_EQ(0.9
f, quat.x);
235 EXPECT_EQ(1.1
f, quat.y);
236 EXPECT_EQ(1.3
f, quat.z);
237 EXPECT_EQ(1.5
f, quat.w);
254 p.connect(&p, SIGNAL(aboutToChange()), &r, SLOT(aboutToChange()));
255 p.connect(&p, SIGNAL(changed()), &r, SLOT(changed()));
258 EXPECT_EQ(
" aboutToChange, v=0; 0; 0; 1 changed, v=0.1; 0.0001; 1000; 1", r.
result().toStdString());
262 EXPECT_EQ(
" aboutToChange, v=0.1; 0.0001; 1000; 1 changed, v=0.1; 0.0001; 2.1; 1",
263 r.
result().toStdString());
270 EXPECT_EQ(0, color.red());
271 EXPECT_EQ(0, color.green());
272 EXPECT_EQ(0, color.blue());
278 QColor color(1, 2, 3);
282 EXPECT_EQ(1, color2.red());
283 EXPECT_EQ(2, color2.green());
284 EXPECT_EQ(3, color2.blue());
293 EXPECT_EQ(1, color.red());
294 EXPECT_EQ(2, color.green());
295 EXPECT_EQ(3, color.blue());
300 EXPECT_EQ(1, color.red());
301 EXPECT_EQ(2, color.green());
302 EXPECT_EQ(3, color.blue());
311 EXPECT_EQ(0, color.red());
312 EXPECT_EQ(255, color.green());
313 EXPECT_EQ(3, color.blue());
321 p.connect(&p, SIGNAL(aboutToChange()), &r, SLOT(aboutToChange()));
322 p.connect(&p, SIGNAL(changed()), &r, SLOT(changed()));
325 EXPECT_EQ(
" aboutToChange, v=0; 0; 0 changed, v=1; 2; 3", r.
result().toStdString());
347 int main(
int argc,
char** argv)
349 testing::InitGoogleTest(&argc, argv);
350 return RUN_ALL_TESTS();
virtual bool setVector(const Ogre::Vector3 &vector)
bool setValue(const QVariant &new_value) override
Set the new value for this property. Returns true if the new value is different from the old value...
virtual QColor getColor() const
virtual bool setValue(const QVariant &new_value)
Set the new value for this property. Returns true if the new value is different from the old value...
A single element of a property tree, with a name, value, description, and possibly children...
virtual void clearOptions()
Clear the list of options.
virtual void setName(const QString &name)
Set the name.
virtual Ogre::Vector3 getVector() const
virtual void setDescription(const QString &description)
Set the description.
virtual QString getDescription() const
Return the description.
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 void addOption(const QString &option, int value=0)
int main(int argc, char **argv)
virtual QString getName() const
Return the name of this Property as a QString.
virtual bool setQuaternion(const Ogre::Quaternion &quaternion)
virtual bool setColor(const QColor &color)
bool setValue(const QVariant &new_value) override
Set the new value for this property. Returns true if the new value is different from the old value...
bool setValue(const QVariant &new_value) override
Set the new value for this property. Returns true if the new value is different from the old value...
virtual QVariant getValue() const
Return the value of this Property as a QVariant. If the value has never been set, an invalid QVariant...
virtual int getOptionInt()
Return the int value of the currently-chosen option, or 0 if the current option string does not have ...
virtual Ogre::Quaternion getQuaternion() const