diff options
3 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlconnection/data/test-connection2.qml b/tests/auto/declarative/qmlconnection/data/test-connection2.qml new file mode 100644 index 0000000..65fe23a --- /dev/null +++ b/tests/auto/declarative/qmlconnection/data/test-connection2.qml @@ -0,0 +1,3 @@ +import Qt 4.6 + +Connection { id: connection; sender: connection; signal: "widthChanged()"; script: 1 == 1 } diff --git a/tests/auto/declarative/qmlconnection/data/test-connection3.qml b/tests/auto/declarative/qmlconnection/data/test-connection3.qml new file mode 100644 index 0000000..32133f9 --- /dev/null +++ b/tests/auto/declarative/qmlconnection/data/test-connection3.qml @@ -0,0 +1,3 @@ +import Qt 4.6 + +Connection {} diff --git a/tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp b/tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp index c6d2cc4..b21da48 100644 --- a/tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp +++ b/tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp @@ -44,6 +44,7 @@ #include <private/qmlconnection_p.h> #include <private/qmlgraphicsitem_p.h> #include "../../../shared/util.h" +#include <QtDeclarative/qmlscriptstring.h> class tst_qmlconnection : public QObject @@ -53,6 +54,8 @@ public: tst_qmlconnection(); private slots: + void defaultValues(); + void properties(); void connection(); private: @@ -63,6 +66,36 @@ tst_qmlconnection::tst_qmlconnection() { } +void tst_qmlconnection::defaultValues() +{ + QmlEngine engine; + QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/test-connection3.qml")); + QmlConnection *item = qobject_cast<QmlConnection*>(c.create()); + + QVERIFY(item != 0); + QVERIFY(item->signalSender() == 0); + QCOMPARE(item->script().script(), QString()); + QCOMPARE(item->signal(), QString()); + + delete item; +} + +void tst_qmlconnection::properties() +{ + QmlEngine engine; + QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/test-connection2.qml")); + QmlConnection *item = qobject_cast<QmlConnection*>(c.create()); + + QVERIFY(item != 0); + + QVERIFY(item != 0); + QVERIFY(item->signalSender() == item); + QCOMPARE(item->script().script(), QString("1 == 1")); + QCOMPARE(item->signal(), QString("widthChanged()")); + + delete item; +} + void tst_qmlconnection::connection() { QmlEngine engine; |