summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-02-17 03:21:46 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-02-18 05:17:15 (GMT)
commit05cbd2fe4b5d9cbdef3be52b6d14d2d20255641a (patch)
treedecbeb2a21a1b022bf5f3d5773935a33691c9ca8 /tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
parent9fb06ea43e807f2bbb40de89e9af5f2cca02212f (diff)
downloadQt-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/qmlanimations/tst_qmlanimations.cpp')
-rw-r--r--tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
index b4759d4..54e6e27 100644
--- a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
+++ b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
@@ -71,6 +71,7 @@ private slots:
void invalidDuration();
void attached();
void propertyValueSourceDefaultStart();
+ void dontStart();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -634,6 +635,38 @@ void tst_qmlanimations::propertyValueSourceDefaultStart()
}
}
+
+void tst_qmlanimations::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);
+ }
+
+ {
+ QmlEngine engine;
+
+ QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart2.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_qmlanimations)
#include "tst_qmlanimations.moc"