diff options
Diffstat (limited to 'tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp')
-rw-r--r-- | tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp index 615de0885a..b3ac1ce958 100644 --- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp +++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp @@ -52,6 +52,7 @@ private slots: void rewriteErrors(); void singletonTypeTarget(); void enableDisable_QTBUG_36350(); + void clearImplicitTarget(); private: QQmlEngine engine; @@ -352,6 +353,32 @@ void tst_qqmlconnections::enableDisable_QTBUG_36350() delete item; } +//QTBUG-56499 +void tst_qqmlconnections::clearImplicitTarget() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("test-connection-implicit.qml")); + QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); + + QVERIFY(item != 0); + + // normal case: fire Connections + item->setWidth(100.); + QCOMPARE(item->property("tested").toBool(), true); + + item->setProperty("tested", false); + // clear the implicit target + QQmlConnections *connections = item->findChild<QQmlConnections*>(); + QVERIFY(connections); + connections->setTarget(0); + + // target cleared: no longer fire Connections + item->setWidth(150.); + QCOMPARE(item->property("tested").toBool(), false); + + delete item; +} + QTEST_MAIN(tst_qqmlconnections) #include "tst_qqmlconnections.moc" |