diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-02-17 03:21:46 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-02-18 05:17:15 (GMT) |
commit | 05cbd2fe4b5d9cbdef3be52b6d14d2d20255641a (patch) | |
tree | decbeb2a21a1b022bf5f3d5773935a33691c9ca8 /tests/auto/declarative/qmlbehaviors | |
parent | 9fb06ea43e807f2bbb40de89e9af5f2cca02212f (diff) | |
download | Qt-05cbd2fe4b5d9cbdef3be52b6d14d2d20255641a.zip Qt-05cbd2fe4b5d9cbdef3be52b6d14d2d20255641a.tar.gz Qt-05cbd2fe4b5d9cbdef3be52b6d14d2d20255641a.tar.bz2 |
Fix bugs and add tests related to manual start/stop control of animations.
This better enforces the restriction on starting an animation that is
not top-level, or is part of a Transition or Behavior.
Diffstat (limited to 'tests/auto/declarative/qmlbehaviors')
-rw-r--r-- | tests/auto/declarative/qmlbehaviors/data/dontStart.qml | 18 | ||||
-rw-r--r-- | tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp | 15 |
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlbehaviors/data/dontStart.qml b/tests/auto/declarative/qmlbehaviors/data/dontStart.qml new file mode 100644 index 0000000..ba7cc9c --- /dev/null +++ b/tests/auto/declarative/qmlbehaviors/data/dontStart.qml @@ -0,0 +1,18 @@ +import Qt 4.6 + +Rectangle { + id: wrapper + width: 600 + height: 400 + + Rectangle { + id: redRect + width: 100; height: 100 + color: Qt.rgba(1,0,0) + x: Behavior { + NumberAnimation { objectName: "MyAnim"; running: true } + } + + } + +} diff --git a/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp b/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp index 47bd329..5f199ef 100644 --- a/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp +++ b/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp @@ -67,6 +67,7 @@ private slots: void nonSelectingBehavior(); void reassignedAnimation(); void disabled(); + void dontStart(); }; void tst_qmlbehaviors::simpleBehavior() @@ -278,7 +279,21 @@ void tst_qmlbehaviors::disabled() rect->setState("moved"); qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); QCOMPARE(x, qreal(200)); //should change immediately +} + +void tst_qmlbehaviors::dontStart() +{ + QmlEngine engine; + + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml")); + + QTest::ignoreMessage(QtWarningMsg, "QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); + QVERIFY(rect); + QmlAbstractAnimation *myAnim = rect->findChild<QmlAbstractAnimation*>("MyAnim"); + QVERIFY(myAnim && myAnim->qtAnimation()); + QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); } QTEST_MAIN(tst_qmlbehaviors) |