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 );
82 Property* beta =
new Property(
"Beta Band", 10,
"The number of betas to apply to the grid lines.", display );
83 new Property(
"Gamma Topic",
"chubby",
"The topic on which to listen for Gamma messages.", display );
84 Property* position =
new Property(
"Position", QVariant(),
"Position of the chub.", display );
85 new Property(
"X", 1.1
f,
"X component of the position of the chub.", position );
86 new Property(
"Y", 0.717
f,
"Y component of the position of the chub.", position );
98 EXPECT_EQ( 0.717
f, y );
101 printf(
"Next line should say 'ERROR' but not crash.\n" );
109 EXPECT_EQ( 0, vec.x );
110 EXPECT_EQ( 0, vec.y );
111 EXPECT_EQ( 0, vec.z );
117 Ogre::Vector3 vec( 1, 2, 3 );
121 EXPECT_EQ( 1, vec2.x );
122 EXPECT_EQ( 2, vec2.y );
123 EXPECT_EQ( 3, vec2.z );
132 EXPECT_EQ( 1, vec.x );
133 EXPECT_EQ( 2, vec.y );
134 EXPECT_EQ( 3, vec.z );
136 vp->
setValue( QString(
"chubby!" ));
139 EXPECT_EQ( 1, vec.x );
140 EXPECT_EQ( 2, vec.y );
141 EXPECT_EQ( 3, vec.z );
152 EXPECT_EQ( 0.9
f, vec.x );
153 EXPECT_EQ( 1.1
f, vec.y );
154 EXPECT_EQ( 1.3
f, vec.z );
170 p.connect( &p, SIGNAL( aboutToChange() ), &r, SLOT( aboutToChange() ));
171 p.connect( &p, SIGNAL( changed() ), &r, SLOT( changed() ));
173 p.
setVector( Ogre::Vector3( .1, .0001, 1000 ));
174 EXPECT_EQ(
" aboutToChange, v=0; 0; 0 changed, v=0.1; 0.0001; 1000", r.
result().toStdString() );
178 EXPECT_EQ(
" aboutToChange, v=0.1; 0.0001; 1000 changed, v=0.1; 0.0001; 2.1", r.
result().toStdString() );
185 EXPECT_EQ( 0, quat.x );
186 EXPECT_EQ( 0, quat.y );
187 EXPECT_EQ( 0, quat.z );
188 EXPECT_EQ( 1, quat.w );
194 Ogre::Quaternion quat( 4, 1, 2, 3 );
198 EXPECT_EQ( 1, quat2.x );
199 EXPECT_EQ( 2, quat2.y );
200 EXPECT_EQ( 3, quat2.z );
201 EXPECT_EQ( 4, quat2.w );
207 qp->
setValue( QString(
"1;2;3;4" ));
210 EXPECT_EQ( 1, quat.x );
211 EXPECT_EQ( 2, quat.y );
212 EXPECT_EQ( 3, quat.z );
213 EXPECT_EQ( 4, quat.w );
215 qp->
setValue( QString(
"chubby!" ));
218 EXPECT_EQ( 1, quat.x );
219 EXPECT_EQ( 2, quat.y );
220 EXPECT_EQ( 3, quat.z );
221 EXPECT_EQ( 4, quat.w );
233 EXPECT_EQ( 0.9
f, quat.x );
234 EXPECT_EQ( 1.1
f, quat.y );
235 EXPECT_EQ( 1.3
f, quat.z );
236 EXPECT_EQ( 1.5
f, quat.w );
253 p.connect( &p, SIGNAL( aboutToChange() ), &r, SLOT( aboutToChange() ));
254 p.connect( &p, SIGNAL( changed() ), &r, SLOT( changed() ));
257 EXPECT_EQ(
" aboutToChange, v=0; 0; 0; 1 changed, v=0.1; 0.0001; 1000; 1", r.
result().toStdString() );
261 EXPECT_EQ(
" aboutToChange, v=0.1; 0.0001; 1000; 1 changed, v=0.1; 0.0001; 2.1; 1", r.
result().toStdString() );
268 EXPECT_EQ( 0, color.red() );
269 EXPECT_EQ( 0, color.green() );
270 EXPECT_EQ( 0, color.blue() );
276 QColor color( 1, 2, 3 );
280 EXPECT_EQ( 1, color2.red() );
281 EXPECT_EQ( 2, color2.green() );
282 EXPECT_EQ( 3, color2.blue() );
291 EXPECT_EQ( 1, color.red() );
292 EXPECT_EQ( 2, color.green() );
293 EXPECT_EQ( 3, color.blue() );
295 qp->
setValue( QString(
"chubby!" ));
298 EXPECT_EQ( 1, color.red() );
299 EXPECT_EQ( 2, color.green() );
300 EXPECT_EQ( 3, color.blue() );
306 qp->
setValue( QString(
"-1;2000;3" ));
309 EXPECT_EQ( 0, color.red() );
310 EXPECT_EQ( 255, color.green() );
311 EXPECT_EQ( 3, color.blue() );
319 p.connect( &p, SIGNAL( aboutToChange() ), &r, SLOT( aboutToChange() ));
320 p.connect( &p, SIGNAL( changed() ), &r, SLOT( changed() ));
323 EXPECT_EQ(
" aboutToChange, v=0; 0; 0 changed, v=1; 2; 3", r.
result().toStdString() );
345 int main(
int argc,
char **argv ) {
346 testing::InitGoogleTest( &argc, argv );
347 return RUN_ALL_TESTS();
virtual Ogre::Quaternion getQuaternion() const
virtual QColor getColor() const
virtual bool setVector(const Ogre::Vector3 &vector)
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.
TFSIMD_FORCE_INLINE const tfScalar & y() const
virtual void setDescription(const QString &description)
Set the description.
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...
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 bool setQuaternion(const Ogre::Quaternion &quaternion)
virtual bool setColor(const QColor &color)
virtual Ogre::Vector3 getVector() 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...
virtual QVariant getValue() const
Return the value of this Property as a QVariant. If the value has never been set, an invalid QVariant...
virtual QString getDescription() const
Return the description.
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...
virtual int getOptionInt()
Return the int value of the currently-chosen option, or 0 if the current option string does not have ...
virtual QString getName() const
Return the name of this Property as a QString.