diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2011-02-18 03:52:10 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2011-02-21 05:00:35 (GMT) |
commit | 8e9c28eaa4d7a3372b9a9a21a984701b62f96456 (patch) | |
tree | e14036cce00381d65ccf655b4d6fef2a10accd1e /tests/auto | |
parent | fd198736e1da02f535bc81d9934cb4e8412a87bc (diff) | |
download | Qt-8e9c28eaa4d7a3372b9a9a21a984701b62f96456.zip Qt-8e9c28eaa4d7a3372b9a9a21a984701b62f96456.tar.gz Qt-8e9c28eaa4d7a3372b9a9a21a984701b62f96456.tar.bz2 |
Ensure animations start correctly when running is bound to a value.
Animations register to be started when the component is finalized,
but in the case of a binding, the registration doesn't happen until
we are already working with a copy of the finalization list. With this
patch, we no longer work with a copy, but with the actual list.
Change-Id: If460c250d2403590907e9ac854d277db68ba8b2a
Task-number: QTBUG-14042
Reviewed-by: Aaron Kennedy
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/registrationBug.qml | 18 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp | 12 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/registrationBug.qml b/tests/auto/declarative/qdeclarativeanimations/data/registrationBug.qml new file mode 100644 index 0000000..7dc29f9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimations/data/registrationBug.qml @@ -0,0 +1,18 @@ +import QtQuick 1.0 + +Rectangle { + id: rect + width: 200 + height: 200 + + property bool animating: true + property int value: 0 + + NumberAnimation { + target: rect + property: "value" + running: rect.animating + to: 100 + duration: 50 + } +} diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index 6f71dec..d1b7c1b 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -85,6 +85,7 @@ private slots: void rotation(); void runningTrueBug(); void nonTransitionBug(); + void registrationBug(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -793,6 +794,17 @@ void tst_qdeclarativeanimations::nonTransitionBug() QCOMPARE(mover->x(), qreal(100)); } +//QTBUG-14042 +void tst_qdeclarativeanimations::registrationBug() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/registrationBug.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect != 0); + QTRY_COMPARE(rect->property("value"), QVariant(int(100))); +} + QTEST_MAIN(tst_qdeclarativeanimations) #include "tst_qdeclarativeanimations.moc" |