tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -225,7 +225,7 @@
     animation.setLoopCount(loopCount);
     animation.setCurrentTime(currentTime);
 
-    QCOMPARE(animation.currentTime(), testCurrentTime);
+    QCOMPARE(animation.currentLoopTime(), testCurrentTime);
     QCOMPARE(animation.currentLoop(), testCurrentLoop);
 }
 
@@ -280,7 +280,7 @@
     QCOMPARE(anim->state(), QAnimationGroup::Stopped);
     QCOMPARE(runningSpy.count(), 1); //anim must have stopped
     QCOMPARE(finishedSpy.count(), 0);
-    QCOMPARE(anim->currentTime(), 0);
+    QCOMPARE(anim->currentLoopTime(), 0);
     QCOMPARE(anim->currentLoop(), 0);
     QCOMPARE(currentLoopSpy.count(), 2);
     runningSpy.clear();
@@ -291,7 +291,7 @@
     QCOMPARE(runningSpy.count(), 2); //started and stopped again
     runningSpy.clear();
     QCOMPARE(finishedSpy.count(), 1);
-    QCOMPARE(anim->currentTime(), 100);
+    QCOMPARE(anim->currentLoopTime(), 100);
     QCOMPARE(anim->currentLoop(), 2);
     QCOMPARE(currentLoopSpy.count(), 4);
 
@@ -312,7 +312,7 @@
     QCOMPARE(anim->currentLoop(), 2);
     QCOMPARE(runningSpy.count(), 1); // anim has stopped
     QCOMPARE(finishedSpy.count(), 2);
-    QCOMPARE(anim->currentTime(), 100);
+    QCOMPARE(anim->currentLoopTime(), 100);
 
     delete anim;
 }
@@ -495,7 +495,7 @@
         anim->setEndValue(100);
         QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
         anim->start(QVariantAnimation::DeleteWhenStopped);
-        QTest::qWait(anim->duration() + 50);
+        QTest::qWait(anim->duration() + 100);
         QCOMPARE(runningSpy.count(), 2); //started and then stopped
         QVERIFY(!anim);
     }
@@ -659,7 +659,7 @@
     anim.setStartValue(0);
     anim.setEndValue(100);
     anim.start();
-    QTest::qWait(anim.duration() + 50);
+    QTest::qWait(anim.duration() + 100);
     QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
     QCOMPARE(anim.currentTime(), anim.duration());
 
@@ -667,7 +667,7 @@
     anim.setDirection(QVariantAnimation::Backward);
     anim.start();
     QCOMPARE(anim.state(), QAbstractAnimation::Running);
-    QTest::qWait(anim.duration() + 50);
+    QTest::qWait(anim.duration() + 100);
     QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
     QCOMPARE(anim.currentTime(), 0);
 
@@ -676,7 +676,7 @@
     anim.start();
     QCOMPARE(anim.state(), QAbstractAnimation::Running);
     QCOMPARE(anim.currentTime(), anim.duration());
-    QTest::qWait(anim.duration() + 50);
+    QTest::qWait(anim.duration() + 100);
     QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
     QCOMPARE(anim.currentTime(), 0);
 }
@@ -864,16 +864,16 @@
     //let's check the first state change
     const QVariantList firstChange = spy.first();
     //old state
-    QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.first()), QAbstractAnimation::Stopped);
+    QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.last()), QAbstractAnimation::Stopped);
     //new state
-    QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.last()), QAbstractAnimation::Running);
+    QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.first()), QAbstractAnimation::Running);
 
     //let's check the first state change
     const QVariantList secondChange = spy.last();
     //old state
-    QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.first()), QAbstractAnimation::Running);
+    QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.last()), QAbstractAnimation::Running);
     //new state
-    QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.last()), QAbstractAnimation::Stopped);
+    QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.first()), QAbstractAnimation::Stopped);
 }
 
 #define Pause 1
@@ -1093,7 +1093,7 @@
     QSignalSpy spy(&anim, SIGNAL(valueChanged(QVariant)));
     anim.start();
 
-    QTest::qWait(anim.duration() + 50);
+    QTest::qWait(anim.duration() + 100);
 
     QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
     QCOMPARE(anim.currentTime(), anim.duration());
@@ -1144,7 +1144,7 @@
     o1.anim.start();
     o2.anim.start();
 
-    QTest::qWait(o1.anim.duration() + 50);
+    QTest::qWait(o1.anim.duration() + 100);
     QCOMPARE(o1.anim.state(), QAbstractAnimation::Stopped);
     QCOMPARE(o2.anim.state(), QAbstractAnimation::Stopped);
 
@@ -1171,9 +1171,9 @@
         innerAnim->start();
     }
 
-    void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState)
+    void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
     {
-        QPropertyAnimation::updateState(oldState, newState);
+        QPropertyAnimation::updateState(newState, oldState);
         if (newState == QAbstractAnimation::Stopped)
             delete innerAnim;
     }
@@ -1194,7 +1194,7 @@
     MyComposedAnimation composedAnimation(&o, "value", "realValue");
     composedAnimation.start();
     QCOMPARE(composedAnimation.state(), QAbstractAnimation::Running);
-    QTest::qWait(composedAnimation.duration() + 50);
+    QTest::qWait(composedAnimation.duration() + 100);
 
     QCOMPARE(composedAnimation.state(), QAbstractAnimation::Stopped);
     QCOMPARE(o.value(), 1000);