From ba6180ee3fa07590f0de419ae7f41e20b4a7504e Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 13 Nov 2009 16:43:14 +1000 Subject: more Connection autotests --- .../qmlconnection/data/test-connection2.qml | 3 ++ .../qmlconnection/data/test-connection3.qml | 3 ++ .../qmlconnection/tst_qmlconnection.cpp | 33 ++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/auto/declarative/qmlconnection/data/test-connection2.qml create mode 100644 tests/auto/declarative/qmlconnection/data/test-connection3.qml 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 #include #include "../../../shared/util.h" +#include 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(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(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; -- cgit v0.12