aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/animation/qsequentialanimationgroupjob
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-09-20 15:26:03 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-26 17:32:40 +0200
commit57ae961bcf09efd98968b918332f8ff30562cd92 (patch)
tree84692bed8063ba3f520d0117ed11345d6eeb8dc9 /tests/auto/qml/animation/qsequentialanimationgroupjob
parent6d425ebab34030ff12572f9588eac589930f2659 (diff)
Support looping for "uncontrolled animations".
The render thread animations rely heavily on uncontrolled animations, meaning animations with duration=-1. We support this by adding a m_currentLoopStartTime and incrementally counting the finish time of each uncontrolled animation. Change-Id: I1f2ccea09aff4c51b1a7f98a2ddb58636af50557 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'tests/auto/qml/animation/qsequentialanimationgroupjob')
-rw-r--r--tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
index bb626293aa..591e8f2665 100644
--- a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
+++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
@@ -73,6 +73,7 @@ private slots:
void startGroupWithRunningChild();
void zeroDurationAnimation();
void stopUncontrolledAnimations();
+ void uncontrolledWithLoops();
void finishWithUncontrolledAnimation();
void addRemoveAnimation();
void currentAnimation();
@@ -1613,5 +1614,49 @@ void tst_QSequentialAnimationGroupJob::pauseResume()
anim->removeAnimationChangeListener(&spy, QAbstractAnimationJob::StateChange);
}
+
+void tst_QSequentialAnimationGroupJob::uncontrolledWithLoops()
+{
+ QSequentialAnimationGroupJob group;
+
+ TestAnimation *plain = new TestAnimation(100);
+ TestAnimation *loopsForever = new TestAnimation();
+ UncontrolledAnimation *notTimeBased = new UncontrolledAnimation();
+
+ loopsForever->setLoopCount(-1);
+
+ group.appendAnimation(plain);
+ group.appendAnimation(loopsForever);
+ group.appendAnimation(notTimeBased);
+
+ StateChangeListener listener;
+ group.addAnimationChangeListener(&listener, QAbstractAnimationJob::CurrentLoop);
+ group.setLoopCount(2);
+
+ group.start();
+
+ QCOMPARE(group.currentLoop(), 0);
+ QCOMPARE(group.state(), QAbstractAnimationJob::Running);
+ QTRY_COMPARE(plain->state(), QAbstractAnimationJob::Running);
+
+ QTRY_COMPARE(loopsForever->state(), QAbstractAnimationJob::Running);
+ loopsForever->stop();
+ QTRY_COMPARE(notTimeBased->state(), QAbstractAnimationJob::Running);
+ QTRY_COMPARE(notTimeBased->state(), QAbstractAnimationJob::Stopped); // Stops on its own after 250ms
+
+ QTRY_COMPARE(group.currentLoop(), 1);
+
+ QCOMPARE(group.state(), QAbstractAnimationJob::Running);
+ QTRY_COMPARE(plain->state(), QAbstractAnimationJob::Running);
+ QTRY_COMPARE(plain->state(), QAbstractAnimationJob::Stopped);
+ QTRY_COMPARE(loopsForever->state(), QAbstractAnimationJob::Running);
+ loopsForever->stop();
+ QTRY_COMPARE(notTimeBased->state(), QAbstractAnimationJob::Running);
+ QTRY_COMPARE(notTimeBased->state(), QAbstractAnimationJob::Stopped);
+
+ QTRY_COMPARE(group.state(), QAbstractAnimationJob::Stopped);
+}
+
+
QTEST_MAIN(tst_QSequentialAnimationGroupJob)
#include "tst_qsequentialanimationgroupjob.moc"