diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2011-08-01 10:43:54 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-08-01 03:01:13 +0200 |
commit | 9bc7e70c00736678d1430190566d2575c2ec764a (patch) | |
tree | 0d0239a7054403682ab5311f78553c309f592587 /tests | |
parent | d410ad364ec0b8877797145c68a4d7c3c98ce1c0 (diff) |
Correctly pause animation when paused in starting ScriptAction.
Task-number: QTBUG-13598
Change-Id: Ibd54f4e014eff301b57451081b7f7b35d1bed740
Reviewed-on: http://codereview.qt.nokia.com/2408
Reviewed-by: Charles Yin <charles.yin@nokia.com>
Diffstat (limited to 'tests')
4 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/pauseBug.qml b/tests/auto/declarative/qdeclarativeanimations/data/pauseBug.qml new file mode 100644 index 0000000000..fa2c4be4ba --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimations/data/pauseBug.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +SequentialAnimation { + id: animation + running: true + ScriptAction { script: animation.paused = true } +} diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index 6461b69198..bd9c3e0d7a 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -90,6 +90,7 @@ private slots: void alwaysRunToEndRestartBug(); void transitionAssignmentBug(); void pauseBindingBug(); + void pauseBug(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -872,6 +873,21 @@ void tst_qdeclarativeanimations::pauseBindingBug() delete rect; } +//QTBUG-13598 +void tst_qdeclarativeanimations::pauseBug() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/pauseBug.qml"); + QDeclarativeAbstractAnimation *anim = qobject_cast<QDeclarativeAbstractAnimation*>(c.create()); + QVERIFY(anim != 0); + QCOMPARE(anim->qtAnimation()->state(), QAbstractAnimation::Paused); + QCOMPARE(anim->isPaused(), true); + QCOMPARE(anim->isRunning(), true); + + delete anim; +} + QTEST_MAIN(tst_qdeclarativeanimations) #include "tst_qdeclarativeanimations.moc" diff --git a/tests/auto/qtquick1/qdeclarativeanimations/data/pauseBug.qml b/tests/auto/qtquick1/qdeclarativeanimations/data/pauseBug.qml new file mode 100644 index 0000000000..d514cf7c43 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativeanimations/data/pauseBug.qml @@ -0,0 +1,7 @@ +import QtQuick 1.1 + +SequentialAnimation { + id: animation + running: true + ScriptAction { script: animation.paused = true } +} diff --git a/tests/auto/qtquick1/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/qtquick1/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index 228f4fdd58..53e5502c5f 100644 --- a/tests/auto/qtquick1/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/qtquick1/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -89,6 +89,7 @@ private slots: void doubleRegistrationBug(); void alwaysRunToEndRestartBug(); void transitionAssignmentBug(); + void pauseBug(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -863,6 +864,21 @@ void tst_qdeclarativeanimations::transitionAssignmentBug() QCOMPARE(rect->property("nullObject").toBool(), false); } +//QTBUG-13598 +void tst_qdeclarativeanimations::pauseBug() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/pauseBug.qml"); + QDeclarative1AbstractAnimation *anim = qobject_cast<QDeclarative1AbstractAnimation*>(c.create()); + QVERIFY(anim != 0); + QCOMPARE(anim->qtAnimation()->state(), QAbstractAnimation::Paused); + QCOMPARE(anim->isPaused(), true); + QCOMPARE(anim->isRunning(), true); + + delete anim; +} + QTEST_MAIN(tst_qdeclarativeanimations) #include "tst_qdeclarativeanimations.moc" |