diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp index f4914e172f..0efae3b9d2 100644 --- a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp +++ b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp @@ -58,6 +58,7 @@ private slots: void properties(); void connection(); void trimming(); + void targetChanged(); private: QDeclarativeEngine engine; @@ -130,6 +131,31 @@ void tst_qdeclarativeconnection::trimming() delete item; } +// Confirm that target can be changed by one of our signal handlers +void tst_qdeclarativeconnection::targetChanged() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/connection-targetchange.qml")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(c.create()); + QVERIFY(item != 0); + + QDeclarativeConnections *connections = item->findChild<QDeclarativeConnections*>("connections"); + QVERIFY(connections); + + QDeclarativeItem *item1 = item->findChild<QDeclarativeItem*>("item1"); + QVERIFY(item1); + + item1->setWidth(200); + + QDeclarativeItem *item2 = item->findChild<QDeclarativeItem*>("item2"); + QVERIFY(item2); + QVERIFY(connections->target() == item2); + + // If we don't crash then we're OK + + delete item; +} + QTEST_MAIN(tst_qdeclarativeconnection) #include "tst_qdeclarativeconnection.moc" |