Fix bug in tst_QTimeLine::duration().

QTimeLine::currentTime() is an integer in the range [0..duration], not a
float in the range [0.0..1.0].  The aim of the test appears to be to
verify that currentTime() is at least 90% of the way to duration() when
the timeline is almost due to finish, so verify that and give the
corresponding 10% tolerance on reaching the end state.

Change-Id: I38646947c3b9189a4e8e91a450c6071430ddc66a
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Jason McDonald 2012-04-16 23:11:41 +10:00 committed by Qt by Nokia
parent 4e282e3ea2
commit 5192b06ccb

View File

@ -184,9 +184,10 @@ void tst_QTimeLine::duration()
timeLine.start();
QTest::qWait(999);
QCOMPARE(timeLine.state(), QTimeLine::Running);
QVERIFY(timeLine.currentTime() > 0.9);
QTest::qWait(50);
QVERIFY(timeLine.currentTime() > 900);
QTest::qWait(100);
QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
QCOMPARE(timeLine.currentTime(), 1000);
// The duration shouldn't change
QCOMPARE(timeLine.duration(), 1000);
}