Remove reset test from QTimeLine.

QTimeLine::reset() never made it into the public API. Instead
QTimeLine::start() always starts from the beginning.

Remove the commented-out test for reset() and related remnants in other
tests.  Restarting a timeline using QTimeLine::start() is already tested
by the restart() test function.

Change-Id: Ia5c767ddae0781d645a407fbea76e80672895aab
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Jason McDonald 2011-11-21 18:07:13 +10:00 committed by Qt by Nokia
parent 36ee00c9f5
commit bd3477eebc

View File

@ -61,7 +61,6 @@ private slots:
void reverse_data(); void reverse_data();
void reverse(); void reverse();
void toggleDirection(); void toggleDirection();
//void reset(); ### todo
void frameChanged(); void frameChanged();
void stopped(); void stopped();
void finished(); void finished();
@ -354,8 +353,8 @@ void tst_QTimeLine::interpolation()
int firstValue = timeLine.currentFrame(); int firstValue = timeLine.currentFrame();
QTest::qWait(200); QTest::qWait(200);
int endValue = timeLine.currentFrame(); int endValue = timeLine.currentFrame();
timeLine.stop(); // ### todo reset? timeLine.stop();
timeLine.setCurrentTime(0); // ### todo reset? timeLine.setCurrentTime(0);
// linear // linear
timeLine.setCurveShape(QTimeLine::LinearCurve); timeLine.setCurveShape(QTimeLine::LinearCurve);
@ -449,37 +448,6 @@ void tst_QTimeLine::toggleDirection()
QCOMPARE(int(timeLine.direction()), int(QTimeLine::Forward)); QCOMPARE(int(timeLine.direction()), int(QTimeLine::Forward));
} }
/*
void tst_QTimeLine::reset()
{
QTimeLine timeLine;
timeLine.setFrameRange(10,100);
timeLine.setLoopCount(-1);
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
timeLine.start();
QCOMPARE(timeLine.state(), QTimeLine::Running);
int wait = timeLine.duration()*5/3;
QTest::qWait(wait);
QVERIFY(spy.count() >= 1 );
QCOMPARE(timeLine.state(), QTimeLine::Running);
timeLine.setDirection(QTimeLine::Backward);
QVERIFY(timeLine.currentFrame() != 10);
QVERIFY(timeLine.currentTime() != 0);
QVERIFY(timeLine.state() != QTimeLine::Forward);
QVERIFY(timeLine.loopCount() != 0);
timeLine.reset();
QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
QCOMPARE(timeLine.currentFrame(), timeLine.startFrame());
QCOMPARE(timeLine.currentTime(), 0);
timeLine.setDirection(QTimeLine::Backward);
QCOMPARE(timeLine.loopCount(), 1);
QCOMPARE(timeLine.startFrame(), 10);
QCOMPARE(timeLine.endFrame(), 100);
}
*/
void tst_QTimeLine::frameChanged() void tst_QTimeLine::frameChanged()
{ {
QTimeLine timeLine; QTimeLine timeLine;
@ -492,7 +460,6 @@ void tst_QTimeLine::frameChanged()
// Probably 10 // Probably 10
QVERIFY(spy.count() <= 10 && spy.count() > 0); QVERIFY(spy.count() <= 10 && spy.count() > 0);
//timeLine.reset(); ### todo
timeLine.setUpdateInterval(5); timeLine.setUpdateInterval(5);
spy.clear(); spy.clear();
timeLine.setCurrentTime(0); timeLine.setCurrentTime(0);
@ -513,15 +480,10 @@ void tst_QTimeLine::stopped()
QTest::qWait(timeLine.duration()*2); QTest::qWait(timeLine.duration()*2);
QCOMPARE(timeLine.state(), QTimeLine::NotRunning); QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
QCOMPARE(spy.count(), 2); QCOMPARE(spy.count(), 2);
// timeLine.reset(); ### todo
spy.clear(); spy.clear();
//int currentFrame = timeLine.currentFrame();
//int currentCurrentTime = timeLine.currentTime();
timeLine.start(); timeLine.start();
timeLine.stop(); timeLine.stop();
QCOMPARE(spy.count(), 2); QCOMPARE(spy.count(), 2);
//QCOMPARE(timeLine.currentFrame(), currentFrame); ### Behavioral change
//QCOMPARE(timeLine.currentTime(), currentCurrentTime);
timeLine.setDirection(QTimeLine::Backward); timeLine.setDirection(QTimeLine::Backward);
QCOMPARE(timeLine.loopCount(), 1); QCOMPARE(timeLine.loopCount(), 1);
} }