diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2013-03-12 11:24:37 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-13 14:51:05 +0100 |
commit | 75614792fa2370b6b0402117bfef8efc364b7b67 (patch) | |
tree | 6a2fc3ad45dfc1d747685e4d9368769956978eed /tests/auto | |
parent | f75b7e78a3c14d8d66e398a94634cc9c98789c33 (diff) |
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.
Task-number: QTBUG-30108
Change-Id: Ib9b2c5a0dea52762109e0b25f1068dd7c88e15ba
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp index 4d05f45252..e6629301f9 100644 --- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp @@ -69,6 +69,7 @@ private slots: void stateInFinishedSignal(); void resume(); void restart(); + void setPaused(); protected slots: void finishedSlot(); @@ -681,6 +682,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" |