diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-08-15 18:40:58 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-08-15 18:44:54 +0200 |
commit | 2be575b4b1e6f6e11a8dbd0b1c05c003828d2598 (patch) | |
tree | 55d2bfaff9583b3e1e9f3291f4b91f34adae1d92 /tests/auto/qml/qqmlproperty | |
parent | 4a5939d26d1e36efdb2b30cdee1f3672587c3fa5 (diff) | |
parent | 9e32b23a1514f367921b4a9ee25bc864a008463c (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I6f2152aeecaeb8e63fdbc1cdf1444132a054b6f5
Diffstat (limited to 'tests/auto/qml/qqmlproperty')
-rw-r--r-- | tests/auto/qml/qqmlproperty/data/nullPropertyBinding.qml | 22 | ||||
-rw-r--r-- | tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 17 |
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlproperty/data/nullPropertyBinding.qml b/tests/auto/qml/qqmlproperty/data/nullPropertyBinding.qml new file mode 100644 index 0000000000..4fffc7aead --- /dev/null +++ b/tests/auto/qml/qqmlproperty/data/nullPropertyBinding.qml @@ -0,0 +1,22 @@ +import QtQuick 2.12 + +Item { + id: root + + width: 640 + height: 480 + + property bool toggle: false + property Item bound + property string message: "defined" + + readonly property Item item: root.toggle ? root : null + + Binding { target: root; property: "bound"; value: item} + + function tog() { + console.info(root.bound ? root.bound.message: "undefined") + root.toggle = !root.toggle + return 42; + } +} diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 04c61ec11b..67da768f73 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -144,6 +144,7 @@ private slots: void deeplyNestedObject(); void readOnlyDynamicProperties(); void aliasToIdWithMatchingQmlFileNameOnCaseInsensitiveFileSystem(); + void nullPropertyBinding(); void floatToStringPrecision_data(); void floatToStringPrecision(); @@ -2059,6 +2060,22 @@ void tst_qqmlproperty::aliasToIdWithMatchingQmlFileNameOnCaseInsensitiveFileSyst QVERIFY(property.isValid()); } +// QTBUG-77027 +void tst_qqmlproperty::nullPropertyBinding() +{ + const QUrl url = testFileUrl("nullPropertyBinding.qml"); + QQmlEngine engine; + QQmlComponent component(&engine, url); + QScopedPointer<QObject> root(component.create()); + QVERIFY(root); + QTest::ignoreMessage(QtMsgType::QtInfoMsg, "undefined"); + QMetaObject::invokeMethod(root.get(), "tog"); + QTest::ignoreMessage(QtMsgType::QtInfoMsg, "defined"); + QMetaObject::invokeMethod(root.get(), "tog"); + QTest::ignoreMessage(QtMsgType::QtInfoMsg, "undefined"); + QMetaObject::invokeMethod(root.get(), "tog"); +} + void tst_qqmlproperty::floatToStringPrecision_data() { QTest::addColumn<QString>("propertyName"); |