aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp
diff options
context:
space:
mode:
authorThomas Kristensen <thkriste@cisco.com>2013-03-11 12:54:56 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-13 07:06:20 +0100
commit18f7c187697db224ca412e969663c5e4470cf104 (patch)
tree87f603db90441523bb5609091627c55316de9bd8 /tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp
parentc284672e5d51def2dfa63343ca84ebc9ce02aa2d (diff)
Makes QSmoothedAnimation respect zero duration.
In automated GUI test scenarios it often desired not to wait for animations before verifying a result, so setting the duration to zero should accomplish this, before this patch; if duration was set to zero QSmoothedAnimation would treat it as if duration was not set, and used velocity to calculate animation speed. Change-Id: Ia57f1c9ffdd2056ac7c85d1cb94dbd3835fcbb7a Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Diffstat (limited to 'tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp')
-rw-r--r--tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp
index 935543cc34..705ee5cf46 100644
--- a/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp
+++ b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp
@@ -60,6 +60,7 @@ private slots:
void valueSource();
void behavior();
void deleteOnUpdate();
+ void zeroDuration();
private:
QQmlEngine engine;
@@ -237,6 +238,28 @@ void tst_qquicksmoothedanimation::deleteOnUpdate()
delete rect;
}
+void tst_qquicksmoothedanimation::zeroDuration()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("smoothedanimationZeroDuration.qml"));
+
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *theRect = rect->findChild<QQuickRectangle*>("theRect");
+ QVERIFY(theRect);
+
+ QQuickSmoothedAnimation *easeX = rect->findChild<QQuickSmoothedAnimation*>("easeX");
+ QVERIFY(easeX);
+ QVERIFY(easeX->isRunning());
+
+ QTRY_VERIFY(!easeX->isRunning());
+ QTRY_COMPARE(theRect->x(), qreal(200));
+
+ delete rect;
+}
+
QTEST_MAIN(tst_qquicksmoothedanimation)
#include "tst_qquicksmoothedanimation.moc"