diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-11-05 22:49:00 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-11-05 22:49:00 (GMT) |
commit | ec543f79c7d036961eb6cdcd956b3e8ca28b8e54 (patch) | |
tree | 8af5b0ddb2176ea68085fb12614149e4f884797c /tests/auto/declarative | |
parent | 656870157932a0b44de69927faa003c71eeb2a47 (diff) | |
download | Qt-ec543f79c7d036961eb6cdcd956b3e8ca28b8e54.zip Qt-ec543f79c7d036961eb6cdcd956b3e8ca28b8e54.tar.gz Qt-ec543f79c7d036961eb6cdcd956b3e8ca28b8e54.tar.bz2 |
Fix possible crash when overriding a signal handler.
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r-- | tests/auto/declarative/states/data/signalOverrideCrash.qml | 15 | ||||
-rw-r--r-- | tests/auto/declarative/states/tst_states.cpp | 18 |
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/declarative/states/data/signalOverrideCrash.qml b/tests/auto/declarative/states/data/signalOverrideCrash.qml new file mode 100644 index 0000000..702fa86 --- /dev/null +++ b/tests/auto/declarative/states/data/signalOverrideCrash.qml @@ -0,0 +1,15 @@ +import Qt 4.6 +import Qt.test 1.0 + +MyRectangle { + id: rect + + width: 100; height: 100 + states: State { + name: "overridden" + PropertyChanges { + target: rect + onDidSomething: rect.state = "" + } + } +} diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp index f67c737..d6df37e 100644 --- a/tests/auto/declarative/states/tst_states.cpp +++ b/tests/auto/declarative/states/tst_states.cpp @@ -54,6 +54,7 @@ private slots: void basicExtension(); void basicBinding(); void signalOverride(); + void signalOverrideCrash(); void parentChange(); void anchorChanges(); void script(); @@ -356,6 +357,23 @@ void tst_states::signalOverride() } } +void tst_states::signalOverrideCrash() +{ + QmlEngine engine; + + QmlComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash.qml"); + MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); + QVERIFY(rect != 0); + + //QCOMPARE(rect->color(),QColor("red")); + //rect->doSomething(); + //QCOMPARE(rect->color(),QColor("blue")); + + rect->setState("overridden"); + rect->doSomething(); + //QCOMPARE(rect->color(),QColor("green")); +} + void tst_states::parentChange() { QmlEngine engine; |