summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp')
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
index e76c8ef..5af6f39 100644
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
+** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -102,6 +102,7 @@ private slots:
void easingcurve_data();
void easingcurve();
void startWithoutStartValue();
+ void startBackwardWithoutEndValue();
void playForwardBackward();
void interpolated();
void setStartEndValues_data();
@@ -582,6 +583,47 @@ void tst_QPropertyAnimation::startWithoutStartValue()
QVERIFY(current <= 110);
}
+void tst_QPropertyAnimation::startBackwardWithoutEndValue()
+{
+ QObject o;
+ o.setProperty("ole", 42);
+ QCOMPARE(o.property("ole").toInt(), 42);
+
+ QPropertyAnimation anim(&o, "ole");
+ anim.setStartValue(100);
+ anim.setDirection(QAbstractAnimation::Backward);
+
+ //we start without an end value
+ anim.start();
+ QCOMPARE(anim.state(), QAbstractAnimation::Running);
+ QCOMPARE(o.property("ole").toInt(), 42); //the initial value
+
+ QTest::qWait(100);
+ int current = anim.currentValue().toInt();
+ //it is somewhere in the animation
+ QVERIFY(current > 42);
+ QVERIFY(current < 100);
+
+ QTest::qWait(200);
+ QCOMPARE(anim.state(), QVariantAnimation::Stopped);
+ current = anim.currentValue().toInt();
+ QCOMPARE(current, 100);
+ QCOMPARE(o.property("ole").toInt(), current);
+
+ anim.setStartValue(110);
+ anim.start();
+ current = anim.currentValue().toInt();
+ // the default start value will reevaluate the current property
+ // and set it to the end value of the last iteration
+ QCOMPARE(current, 100);
+ QTest::qWait(100);
+ current = anim.currentValue().toInt();
+ //it is somewhere in the animation
+ QVERIFY(current >= 100);
+ QVERIFY(current <= 110);
+}
+
+
void tst_QPropertyAnimation::playForwardBackward()
{
QObject o;