diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2009-11-13 06:43:14 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2009-11-13 06:43:14 (GMT) |
commit | ba6180ee3fa07590f0de419ae7f41e20b4a7504e (patch) | |
tree | 41291c0b0a8d1f19bb7dce17bbd71beca3826be1 /tests/auto | |
parent | 7a05add9235a76f5a3fb721b574c3f41af32ea1f (diff) | |
download | Qt-ba6180ee3fa07590f0de419ae7f41e20b4a7504e.zip Qt-ba6180ee3fa07590f0de419ae7f41e20b4a7504e.tar.gz Qt-ba6180ee3fa07590f0de419ae7f41e20b4a7504e.tar.bz2 |
more Connection autotests
Diffstat (limited to 'tests/auto')
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; |