summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtimeline
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-10 11:47:28 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-10 11:47:28 (GMT)
commit0df5d5e4367a8052082897d02b4f00429d5cc4c1 (patch)
treecc8a59f0e37dbd618270bbca5b644fc3b775d60a /tests/auto/qtimeline
parentf61ec84fc296c6f70011e30788ee511d6b6a18c6 (diff)
parent17bffacda99055831bb4c8c6e7da39ec15415519 (diff)
downloadQt-0df5d5e4367a8052082897d02b4f00429d5cc4c1.zip
Qt-0df5d5e4367a8052082897d02b4f00429d5cc4c1.tar.gz
Qt-0df5d5e4367a8052082897d02b4f00429d5cc4c1.tar.bz2
Merge commit 'qt/master'
Diffstat (limited to 'tests/auto/qtimeline')
-rw-r--r--tests/auto/qtimeline/tst_qtimeline.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/tests/auto/qtimeline/tst_qtimeline.cpp b/tests/auto/qtimeline/tst_qtimeline.cpp
index e6e75ff..4ce1f4b 100644
--- a/tests/auto/qtimeline/tst_qtimeline.cpp
+++ b/tests/auto/qtimeline/tst_qtimeline.cpp
@@ -81,6 +81,7 @@ private slots:
void outOfRange();
void stateInFinishedSignal();
void resume();
+ void restart();
protected slots:
void finishedSlot();
@@ -177,7 +178,7 @@ void tst_QTimeLine::currentTime()
QCOMPARE(spy.count(), 1);
spy.clear();
QCOMPARE(timeLine.currentTime(), timeLine.duration()/2);
- timeLine.start();
+ timeLine.resume();
// Let it update on its own
QTest::qWait(timeLine.duration()/4);
QCOMPARE(timeLine.state(), QTimeLine::Running);
@@ -699,5 +700,43 @@ void tst_QTimeLine::resume()
}
}
+void tst_QTimeLine::restart()
+{
+ QTimeLine timeLine(100);
+ timeLine.setFrameRange(0,9);
+
+ timeLine.start();
+ QTest::qWait(timeLine.duration()*2);
+ QCOMPARE(timeLine.currentFrame(), timeLine.endFrame());
+ QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
+
+ // A restart with the same duration
+ timeLine.start();
+ QCOMPARE(timeLine.state(), QTimeLine::Running);
+ QCOMPARE(timeLine.currentFrame(), timeLine.startFrame());
+ QCOMPARE(timeLine.currentTime(), 0);
+ QTest::qWait(250);
+ QCOMPARE(timeLine.currentFrame(), timeLine.endFrame());
+ QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
+
+ // Set a smaller duration and restart
+ timeLine.setDuration(50);
+ timeLine.start();
+ QCOMPARE(timeLine.state(), QTimeLine::Running);
+ QCOMPARE(timeLine.currentFrame(), timeLine.startFrame());
+ QCOMPARE(timeLine.currentTime(), 0);
+ QTest::qWait(250);
+ QCOMPARE(timeLine.currentFrame(), timeLine.endFrame());
+ QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
+
+ // Set a longer duration and restart
+ timeLine.setDuration(150);
+ timeLine.start();
+ QCOMPARE(timeLine.state(), QTimeLine::Running);
+ QCOMPARE(timeLine.currentFrame(), timeLine.startFrame());
+ QCOMPARE(timeLine.currentTime(), 0);
+}
+
QTEST_MAIN(tst_QTimeLine)
+
#include "tst_qtimeline.moc"