diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2013-03-12 10:24:37 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-20 08:16:57 (GMT) |
commit | 1d2234498cde6821014fcec7f2b321ad76724cce (patch) | |
tree | dbd0ae6561786146d26e5cec45a89493bd38fc24 /tests/auto/qtimeline | |
parent | 32a66514c6a907604c1efced5ba0c885ea7c7355 (diff) | |
download | Qt-1d2234498cde6821014fcec7f2b321ad76724cce.zip Qt-1d2234498cde6821014fcec7f2b321ad76724cce.tar.gz Qt-1d2234498cde6821014fcec7f2b321ad76724cce.tar.bz2 |
Fixed bug in QTimeLine::setPaused(false)
The problem was that the elapsed timer was not restarted,
causing the currentTime() not being adjusted for the time
it was paused.
(cherry-picked from Qt 5: 75614792fa2370b6b0402117bf)
Task-number: QTBUG-30108
Change-Id: I9718aa408075623514717328321c34e7ab3af436
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'tests/auto/qtimeline')
-rw-r--r-- | tests/auto/qtimeline/tst_qtimeline.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qtimeline/tst_qtimeline.cpp b/tests/auto/qtimeline/tst_qtimeline.cpp index ab83e9d..21c548e 100644 --- a/tests/auto/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/qtimeline/tst_qtimeline.cpp @@ -82,6 +82,7 @@ private slots: void stateInFinishedSignal(); void resume(); void restart(); + void setPaused(); protected slots: void finishedSlot(); @@ -725,6 +726,28 @@ void tst_QTimeLine::restart() QCOMPARE(timeLine.currentTime(), 0); } +void tst_QTimeLine::setPaused() +{ + QTimeLine timeLine(1000); + { + QCOMPARE(timeLine.currentTime(), 0); + timeLine.start(); + QTest::qWait(250); + timeLine.setPaused(true); + int oldCurrentTime = timeLine.currentTime(); + QVERIFY(oldCurrentTime > 0); + QVERIFY(oldCurrentTime < 1000); + QTest::qWait(1000); + timeLine.setPaused(false); + QTest::qWait(250); + int currentTime = timeLine.currentTime(); + QVERIFY(currentTime > 0); + QVERIFY(currentTime > oldCurrentTime); + QVERIFY(currentTime < 1000); + timeLine.stop(); + } +} + QTEST_MAIN(tst_QTimeLine) #include "tst_qtimeline.moc" |