tests/auto/qtimeline/tst_qtimeline.cpp
changeset 33 3e2da88830cd
parent 18 2f34d5167611
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
   245     QVERIFY(slowCount < spy.count());
   245     QVERIFY(slowCount < spy.count());
   246 }
   246 }
   247 
   247 
   248 void tst_QTimeLine::value()
   248 void tst_QTimeLine::value()
   249 {
   249 {
   250 #ifdef Q_OS_WINCE //On WinCE timer resolution is bad - use longer times
       
   251     QTimeLine timeLine(2000);
   250     QTimeLine timeLine(2000);
   252 #else
       
   253     QTimeLine timeLine(200);
       
   254 #endif
       
   255     QVERIFY(timeLine.currentValue() == 0.0);
   251     QVERIFY(timeLine.currentValue() == 0.0);
   256 
   252 
   257     // Default speed
   253     // Default speed
   258     qRegisterMetaType<qreal>("qreal");
   254     qRegisterMetaType<qreal>("qreal");
   259     QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
   255     QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
   268 
   264 
   269     // Reverse should decrease the value
   265     // Reverse should decrease the value
   270     timeLine.setCurrentTime(100);
   266     timeLine.setCurrentTime(100);
   271     timeLine.start();
   267     timeLine.start();
   272     // Let it update on its own
   268     // Let it update on its own
   273 #ifdef Q_OS_WINCE
       
   274     QTest::qWait(500);
   269     QTest::qWait(500);
   275 #else
       
   276     QTest::qWait(50);
       
   277 #endif
       
   278     QCOMPARE(timeLine.state(), QTimeLine::Running);
   270     QCOMPARE(timeLine.state(), QTimeLine::Running);
   279     qreal value = timeLine.currentValue();
   271     qreal value = timeLine.currentValue();
   280     timeLine.setDirection(QTimeLine::Backward);
   272     timeLine.setDirection(QTimeLine::Backward);
   281 #ifdef Q_OS_WINCE
       
   282     QTest::qWait(1000);
   273     QTest::qWait(1000);
   283 #else
       
   284     QTest::qWait(100);
       
   285 #endif
       
   286     QVERIFY(timeLine.currentValue() < value);
   274     QVERIFY(timeLine.currentValue() < value);
   287     timeLine.stop();
   275     timeLine.stop();
   288 }
   276 }
   289 
   277 
   290 void tst_QTimeLine::currentFrame()
   278 void tst_QTimeLine::currentFrame()