diff options
Diffstat (limited to 'tests/auto/qml/animation/qparallelanimationgroupjob')
-rw-r--r-- | tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp index 3fed59ea20..149f034903 100644 --- a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp @@ -64,6 +64,7 @@ private slots: void startGroupWithRunningChild(); void zeroDurationAnimation(); void stopUncontrolledAnimations(); + void uncontrolledWithLoops(); void loopCount_data(); void loopCount(); void addAndRemoveDuration(); @@ -779,6 +780,9 @@ void tst_QParallelAnimationGroupJob::loopCount_data() } +#undef Stopped +#undef Running + void tst_QParallelAnimationGroupJob::loopCount() { QFETCH(bool, directionBackward); @@ -926,6 +930,46 @@ void tst_QParallelAnimationGroupJob::crashWhenRemovingUncontrolledAnimation() delete anim2; } +void tst_QParallelAnimationGroupJob::uncontrolledWithLoops() +{ + QParallelAnimationGroupJob 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); + QCOMPARE(plain->state(), QAbstractAnimationJob::Running); + QCOMPARE(loopsForever->state(), QAbstractAnimationJob::Running); + QCOMPARE(notTimeBased->state(), QAbstractAnimationJob::Running); + + loopsForever->stop(); + notTimeBased->stop(); + + QTRY_COMPARE(group.currentLoop(), 1); + QCOMPARE(group.state(), QAbstractAnimationJob::Running); + QCOMPARE(loopsForever->state(), QAbstractAnimationJob::Running); + QCOMPARE(notTimeBased->state(), QAbstractAnimationJob::Running); + + loopsForever->stop(); + notTimeBased->stop(); + + QTRY_COMPARE(group.state(), QAbstractAnimationJob::Stopped); +} + QTEST_MAIN(tst_QParallelAnimationGroupJob) #include "tst_qparallelanimationgroupjob.moc" |