aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire@kdab.com>2017-05-16 22:04:05 +0200
committerThomas McGuire <thomas.mcguire@kdab.com>2017-05-17 09:58:51 +0000
commitaccaf69fc4f1d1197adae3deb2196897aa85aa43 (patch)
treeb5f85a35b919dc4b6fb93804e0d275b515677dc4 /tests
parent025bdeb66284c1016fb79c8ec230890542408320 (diff)
Fix QML Connections element ignoring the enabled property
The enabled property was ignored if it was set before componentComplete() was called. [ChangeLog][QtQml] Fixed the QML Connections element ignoring the initial state of the enabled property Change-Id: I40c92fcb30f0bb8ca406f248b3bde2fced5ab58f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlconnections/data/disabled-at-start.qml14
-rw-r--r--tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp18
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()
{