summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpropertyanimation
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-08-17 17:13:56 +0200
committerThierry Bastian <thierry.bastian@nokia.com>2009-08-17 17:15:47 +0200
commit285d4b12cb937a5672d6eb15781f03d249f8cfc1 (patch)
treee6e93b23792a92285984c12e5943c60790ce1523 /tests/auto/qpropertyanimation
parenta520a3ac6cd684203ee4e9a93116e19fd82c216c (diff)
Add autotest to make sure we receive the QVariantAnimation::valueChanged
Reviewed-by: ogoffart
Diffstat (limited to 'tests/auto/qpropertyanimation')
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
index 5af6f39cdf..3ff177aec0 100644
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -113,6 +113,7 @@ private slots:
void oneKeyValue();
void updateOnSetKeyValues();
void restart();
+ void valueChanged();
};
tst_QPropertyAnimation::tst_QPropertyAnimation()
@@ -1052,6 +1053,33 @@ void tst_QPropertyAnimation::restart()
anim.start();
}
+void tst_QPropertyAnimation::valueChanged()
+{
+ qRegisterMetaType<QVariant>("QVariant");
+
+ //we check that we receive the valueChanged signal
+ MyErrorObject o;
+ o.setOle(0);
+ QCOMPARE(o.property("ole").toInt(), 0);
+ QPropertyAnimation anim(&o, "ole");
+ anim.setEndValue(5);
+ anim.setDuration(1000);
+ QSignalSpy spy(&anim, SIGNAL(valueChanged(QVariant)));
+ anim.start();
+
+ QTest::qWait(anim.duration() + 50);
+
+ QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
+ QCOMPARE(anim.currentTime(), anim.duration());
+
+ //let's check that the values go forward
+ QCOMPARE(spy.count(), 6); //we should have got everything from 0 to 5
+ for (int i = 0; i < spy.count(); ++i) {
+ QCOMPARE(qvariant_cast<QVariant>(spy.at(i).first()).toInt(), i);
+ }
+}
+
+
QTEST_MAIN(tst_QPropertyAnimation)
#include "tst_qpropertyanimation.moc"