diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-04 13:03:15 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-04 13:07:06 (GMT) |
commit | 30e3a39ca2e5e1204cc123dce2f2921d8fda620d (patch) | |
tree | 4a44071a338bd52747d4367093f49e2caf15c555 /tests/auto/qparallelanimationgroup | |
parent | b6275b9dd1a852c86b22b354bfae3c98c8191fda (diff) | |
download | Qt-30e3a39ca2e5e1204cc123dce2f2921d8fda620d.zip Qt-30e3a39ca2e5e1204cc123dce2f2921d8fda620d.tar.gz Qt-30e3a39ca2e5e1204cc123dce2f2921d8fda620d.tar.bz2 |
QParallelAnimationGroup pause resume fixed
If you resumed a parallel animation group, it would always restart
(ie. stop and start) the animation which would reset its current time
to 0 and trigger flickering.
autotest included.
Task-Number: 259102
Diffstat (limited to 'tests/auto/qparallelanimationgroup')
-rw-r--r-- | tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index d7d6b88..16c58b0 100644 --- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -74,6 +74,7 @@ private slots: void loopCount_data(); void loopCount(); void autoAdd(); + void pauseResume(); }; tst_QParallelAnimationGroup::tst_QParallelAnimationGroup() @@ -828,5 +829,37 @@ void tst_QParallelAnimationGroup::autoAdd() QCOMPARE(group.duration(), 0); } +void tst_QParallelAnimationGroup::pauseResume() +{ + QParallelAnimationGroup group; + TestAnimation2 *anim = new TestAnimation2(250, &group); // 0, duration = 250; + QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QCOMPARE(group.duration(), 250); + group.start(); + QTest::qWait(100); + QCOMPARE(group.state(), QAnimationGroup::Running); + QCOMPARE(anim->state(), QAnimationGroup::Running); + QCOMPARE(spy.count(), 1); + spy.clear(); + const int currentTime = group.currentTime(); + QCOMPARE(anim->currentTime(), currentTime); + + group.pause(); + QCOMPARE(group.state(), QAnimationGroup::Paused); + QCOMPARE(group.currentTime(), currentTime); + QCOMPARE(anim->state(), QAnimationGroup::Paused); + QCOMPARE(anim->currentTime(), currentTime); + QCOMPARE(spy.count(), 1); + spy.clear(); + + group.resume(); + QCOMPARE(group.state(), QAnimationGroup::Running); + QCOMPARE(group.currentTime(), currentTime); + QCOMPARE(anim->state(), QAnimationGroup::Running); + QCOMPARE(anim->currentTime(), currentTime); + QCOMPARE(spy.count(), 1); +} + + QTEST_MAIN(tst_QParallelAnimationGroup) #include "tst_qparallelanimationgroup.moc" |