From f9eb1d4ed610b6a96a247d9da7316ed8b83a077b Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 9 May 2012 11:50:01 +1000 Subject: ScriptAction without scriptName shouldn't match a StateChangeScript Change-Id: Idfce9b25fd2396771f45fc2487bc363edb56ddd6 Reviewed-by: Yunqiao Yin --- .../quick/qquickanimations/data/scriptActionBug.qml | 17 +++++++++++++++++ .../quick/qquickanimations/tst_qquickanimations.cpp | 13 +++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/auto/quick/qquickanimations/data/scriptActionBug.qml (limited to 'tests/auto/quick/qquickanimations') diff --git a/tests/auto/quick/qquickanimations/data/scriptActionBug.qml b/tests/auto/quick/qquickanimations/data/scriptActionBug.qml new file mode 100644 index 0000000000..48566db01d --- /dev/null +++ b/tests/auto/quick/qquickanimations/data/scriptActionBug.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 + +Item { + property bool actionTriggered: false + property bool stateChangeScriptTriggered: false + + states: State { + name: "state1" + StateChangeScript { script: stateChangeScriptTriggered = true } + } + + transitions: Transition { + ScriptAction { script: actionTriggered = true } + } + + Component.onCompleted: state = "state1" +} diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index 60b0465637..8cfdf74917 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -108,6 +108,7 @@ private slots: void loopingBug(); void anchorBug(); void pathAnimationInOutBackBug(); + void scriptActionBug(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -1377,6 +1378,18 @@ void tst_qquickanimations::anchorBug() QCOMPARE(static_cast(animation.qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::InOutBack)); } +//ScriptAction should not match a StateChangeScript if no scriptName has been specified +void tst_qquickanimations::scriptActionBug() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("scriptActionBug.qml")); + QObject *obj = c.create(); + + //Both the ScriptAction and StateChangeScript should be triggered + QCOMPARE(obj->property("actionTriggered").toBool(), true); + QCOMPARE(obj->property("actionTriggered").toBool(), true); +} + QTEST_MAIN(tst_qquickanimations) #include "tst_qquickanimations.moc" -- cgit v1.2.3