summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2011-09-30 03:33:56 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2011-10-17 03:28:15 (GMT)
commit93c64e1be3a2d68eb504d7c4f7c60f66ce1ff650 (patch)
treebafc428413d2391c217c0fc1cebbc16e6ebf5e7b /tests
parent61f165239c4e87a8f6bcd594553b8fcea1a7f8d0 (diff)
downloadQt-93c64e1be3a2d68eb504d7c4f7c60f66ce1ff650.zip
Qt-93c64e1be3a2d68eb504d7c4f7c60f66ce1ff650.tar.gz
Qt-93c64e1be3a2d68eb504d7c4f7c60f66ce1ff650.tar.bz2
Fix crash on exit when overriding signal handlers in states.
Change-Id: I0e73948f18aa1b78c7e92677167673b84a90a450 Task-number: QTBUG-21617 Reviewed-by: Martin Jones
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash3.qml27
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp17
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash3.qml b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash3.qml
new file mode 100644
index 0000000..ed1f22f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash3.qml
@@ -0,0 +1,27 @@
+import QtQuick 1.0
+
+Rectangle {
+ id: myRect
+ width: 400
+ height: 400
+
+ onHeightChanged: console.log("base state")
+
+ states: [
+ State {
+ name: "state1"
+ PropertyChanges {
+ target: myRect
+ onHeightChanged: console.log("state1")
+ color: "green"
+ }
+ },
+ State {
+ name: "state2";
+ PropertyChanges {
+ target: myRect
+ onHeightChanged: console.log("state2")
+ color: "red"
+ }
+ }]
+}
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index 9fafa7d..e90e6fb 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -113,6 +113,7 @@ private slots:
void signalOverride();
void signalOverrideCrash();
void signalOverrideCrash2();
+ void signalOverrideCrash3();
void parentChange();
void parentChangeErrors();
void anchorChanges();
@@ -520,6 +521,22 @@ void tst_qdeclarativestates::signalOverrideCrash2()
delete rect;
}
+void tst_qdeclarativestates::signalOverrideCrash3()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash3.qml");
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QDeclarativeItemPrivate::get(rect)->setState("state1");
+ QDeclarativeItemPrivate::get(rect)->setState("");
+ QDeclarativeItemPrivate::get(rect)->setState("state2");
+ QDeclarativeItemPrivate::get(rect)->setState("");
+
+ delete rect;
+}
+
void tst_qdeclarativestates::parentChange()
{
QDeclarativeEngine engine;