diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-07-12 23:45:30 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-07-13 00:01:09 (GMT) |
commit | 5efd577b1aea64f422e08ca8d54e041fa4b20783 (patch) | |
tree | 1de54549136dd2047a9678d77368d4b30e783788 /tests/auto/declarative/qdeclarativebehaviors | |
parent | bfa139ff61d1e5b495fe92be6073ccbdcdc91c77 (diff) | |
download | Qt-5efd577b1aea64f422e08ca8d54e041fa4b20783.zip Qt-5efd577b1aea64f422e08ca8d54e041fa4b20783.tar.gz Qt-5efd577b1aea64f422e08ca8d54e041fa4b20783.tar.bz2 |
Autotest for QTBUG-5491 (Animation in a Behavior doesn't update running)
Diffstat (limited to 'tests/auto/declarative/qdeclarativebehaviors')
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml | 20 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp | 18 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml b/tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml new file mode 100644 index 0000000..d439875 --- /dev/null +++ b/tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml @@ -0,0 +1,20 @@ +import Qt 4.7 + +Rectangle { + id: root + width:200; height:200 + + property real myValue: 0 + + Rectangle { + anchors.centerIn: parent + width: 100 + height: 100 + color: "green" + smooth: true + rotation: myValue + Behavior on rotation { + RotationAnimation { id: rotAnim; objectName: "rotAnim"; direction: RotationAnimation.Shortest } + } + } +} diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 70739fb..5c2c145 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include <qtest.h> +#include <qsignalspy.h> #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/qdeclarativeview.h> @@ -78,6 +79,7 @@ private slots: void dontStart(); void startup(); void groupedPropertyCrash(); + void runningTrue(); }; void tst_qdeclarativebehaviors::simpleBehavior() @@ -366,6 +368,22 @@ void tst_qdeclarativebehaviors::groupedPropertyCrash() QVERIFY(rect); //don't crash } +//QTBUG-5491 +void tst_qdeclarativebehaviors::runningTrue() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/runningTrue.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeAbstractAnimation *animation = rect->findChild<QDeclarativeAbstractAnimation*>("rotAnim"); + QVERIFY(animation); + + QSignalSpy runningSpy(animation, SIGNAL(runningChanged(bool))); + rect->setProperty("myValue", 180); + QTRY_VERIFY(runningSpy.count() > 0); +} + QTEST_MAIN(tst_qdeclarativebehaviors) #include "tst_qdeclarativebehaviors.moc" |