diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlconnections/data/disabled-at-start.qml | 14 | ||||
-rw-r--r-- | tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp | 18 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlconnections/data/disabled-at-start.qml b/tests/auto/qml/qqmlconnections/data/disabled-at-start.qml new file mode 100644 index 0000000000..1a823f87f6 --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/disabled-at-start.qml @@ -0,0 +1,14 @@ +import QtQuick 2.9 + +Item { + id: root + + property bool tested: false + signal testMe() + + Connections { + target: root + enabled: false + onTestMe: root.tested = true; + } +} diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp index b3ac1ce958..fe45495f74 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 disabledAtStart(); void clearImplicitTarget(); private: @@ -353,6 +354,23 @@ void tst_qqmlconnections::enableDisable_QTBUG_36350() delete item; } +void tst_qqmlconnections::disabledAtStart() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("disabled-at-start.qml")); + QObject * const object = c.create(); + + QVERIFY(object != 0); + + QCOMPARE(object->property("tested").toBool(), false); + const int index = object->metaObject()->indexOfSignal("testMe()"); + const QMetaMethod method = object->metaObject()->method(index); + method.invoke(object, Qt::DirectConnection); + QCOMPARE(object->property("tested").toBool(), false); + + delete object; +} + //QTBUG-56499 void tst_qqmlconnections::clearImplicitTarget() { |