diff options
author | Janne Koskinen <janne.p.koskinen@digia.com> | 2009-08-18 14:44:21 (GMT) |
---|---|---|
committer | Janne Koskinen <janne.p.koskinen@digia.com> | 2009-08-18 14:44:21 (GMT) |
commit | 3d6056dfe01116e34a2b47a70fb95e73753ef766 (patch) | |
tree | ee4e1430dc9f0b06ab89091682d5a60525eac560 /tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp | |
parent | 52e469a629d32b7f7e52518874dab13fcd4bb814 (diff) | |
parent | 69689f3527f373618a1f4adad543b60afea46c17 (diff) | |
download | Qt-3d6056dfe01116e34a2b47a70fb95e73753ef766.zip Qt-3d6056dfe01116e34a2b47a70fb95e73753ef766.tar.gz Qt-3d6056dfe01116e34a2b47a70fb95e73753ef766.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-s60-public
Diffstat (limited to 'tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp')
-rw-r--r-- | tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index 5af6f39..3ff177a 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" |