summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpropertyanimation
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-05-12 11:51:56 +1000
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-05-13 11:00:33 +1000
commit2555221bbcb33e0d12e786eb0b3d08bd9260eeb7 (patch)
treeb66311640c0353602160d082e9be6fc12a28ee6e /tests/auto/qpropertyanimation
parent476414a53a02d99c0887acdb18c96dd65ad9ffa4 (diff)
Avoid running animation when loopCount == 0
Task-number: QTBUG-10654 Reviewed-by: Thierry Bastian
Diffstat (limited to 'tests/auto/qpropertyanimation')
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
index 849b8b2b2e..ea527ded08 100644
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -133,6 +133,7 @@ private slots:
void twoAnimations();
void deletedInUpdateCurrentTime();
void totalDuration();
+ void zeroLoopCount();
};
tst_QPropertyAnimation::tst_QPropertyAnimation()
@@ -1214,6 +1215,29 @@ void tst_QPropertyAnimation::totalDuration()
QCOMPARE(anim.totalDuration(), 0);
}
+void tst_QPropertyAnimation::zeroLoopCount()
+{
+ DummyPropertyAnimation* anim;
+ anim = new DummyPropertyAnimation;
+ anim->setStartValue(0);
+ anim->setDuration(20);
+ anim->setLoopCount(0);
+
+ QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QSignalSpy finishedSpy(anim, SIGNAL(finished()));
+
+ QCOMPARE(anim->state(), QAnimationGroup::Stopped);
+ QCOMPARE(anim->currentValue().toInt(), 0);
+ QCOMPARE(runningSpy.count(), 0);
+ QCOMPARE(finishedSpy.count(), 0);
+
+ anim->start();
+
+ QCOMPARE(anim->state(), QAnimationGroup::Stopped);
+ QCOMPARE(anim->currentValue().toInt(), 0);
+ QCOMPARE(runningSpy.count(), 0);
+ QCOMPARE(finishedSpy.count(), 0);
+}
QTEST_MAIN(tst_QPropertyAnimation)
#include "tst_qpropertyanimation.moc"