summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsequentialanimationgroup
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-08-05 09:01:12 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-08-05 09:01:12 (GMT)
commita3cb29b310f3d8b4de919bb19d98ae93edde7c85 (patch)
treeddd5678825f78ede0df70d9642cdd823313c9117 /tests/auto/qsequentialanimationgroup
parent83c76bb2d1eeca2003720d243ef656aa241a3d49 (diff)
downloadQt-a3cb29b310f3d8b4de919bb19d98ae93edde7c85.zip
Qt-a3cb29b310f3d8b4de919bb19d98ae93edde7c85.tar.gz
Qt-a3cb29b310f3d8b4de919bb19d98ae93edde7c85.tar.bz2
sequential animation group: add autotest for pause/resume
Diffstat (limited to 'tests/auto/qsequentialanimationgroup')
-rw-r--r--tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
index 97ff04b..744ba52 100644
--- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
+++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
@@ -88,6 +88,7 @@ private slots:
void currentAnimationWithZeroDuration();
void insertAnimation();
void clearAnimations();
+ void pauseResume();
};
tst_QSequentialAnimationGroup::tst_QSequentialAnimationGroup()
@@ -1644,5 +1645,40 @@ void tst_QSequentialAnimationGroup::clearAnimations()
QCOMPARE(group.state(), QAbstractAnimation::Running);
}
+void tst_QSequentialAnimationGroup::pauseResume()
+{
+ QObject dummy;
+ dummy.setProperty("foo", 0);
+ QParallelAnimationGroup group;
+ QPropertyAnimation *anim = new QPropertyAnimation(&dummy, "foo", &group);
+ anim->setDuration(250);
+ anim->setEndValue(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_QSequentialAnimationGroup)
#include "tst_qsequentialanimationgroup.moc"