From: Aaron Kennedy Date: Mon, 25 Jul 2011 03:14:24 +0000 (+1000) Subject: Check objects can be passed as signal parameters X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=55aeb36ab13833de4b2a86922017006fe15ad77e;p=konrad%2Fqtdeclarative.git Check objects can be passed as signal parameters Task-number: QTBUG-12457 Change-Id: I2d78c8885e488e51364fe4f2a30bde36fa78636a Reviewed-on: http://codereview.qt.nokia.com/2057 Reviewed-by: Qt Sanity Bot Reviewed-by: Aaron Kennedy --- diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/objectsPassThroughSignals.qml b/tests/auto/declarative/qdeclarativeecmascript/data/objectsPassThroughSignals.qml new file mode 100644 index 0000000..0c99f12 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/objectsPassThroughSignals.qml @@ -0,0 +1,18 @@ +import QtQuick 1.0 + +QtObject { + id: root + + property bool test: false + + signal mysignal(variant object); + function myslot(object) + { + test = (object == root); + } + + Component.onCompleted: { + mysignal.connect(this, myslot); + mysignal(root); + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 1f6427b..aafae1e 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -149,6 +149,7 @@ private slots: void scarceResources(); void propertyChangeSlots(); void elementAssign(); + void objectPassThroughSignals(); void bug1(); void bug2(); @@ -2924,6 +2925,19 @@ void tst_qdeclarativeecmascript::elementAssign() delete object; } +// QTBUG-12457 +void tst_qdeclarativeecmascript::objectPassThroughSignals() +{ + QDeclarativeComponent component(&engine, TEST_FILE("objectsPassThroughSignals.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toBool(), true); + + delete object; +} + // Test that assigning a null object works // Regressed with: df1788b4dbbb2826ae63f26bdf166342595343f4 void tst_qdeclarativeecmascript::nullObjectBinding()