diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlbinding/data/multiValueTypeBinding.qml | 16 | ||||
-rw-r--r-- | tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp | 18 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlbinding/data/multiValueTypeBinding.qml b/tests/auto/qml/qqmlbinding/data/multiValueTypeBinding.qml new file mode 100644 index 0000000000..7f1ba9b886 --- /dev/null +++ b/tests/auto/qml/qqmlbinding/data/multiValueTypeBinding.qml @@ -0,0 +1,16 @@ +import QtQml + +QtObject { + property alias labelY: label.rect.y + property alias labelWidth: label.rect.width + + labelY: { return 24 } + labelWidth: 9 + + property QtObject label: QtObject { + id: label + + property rect rect + rect.x: { return 12 } + } +} diff --git a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp index e4c1013cb9..11905c8210 100644 --- a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp +++ b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp @@ -55,6 +55,7 @@ private slots: void qQmlPropertyToPropertyBindingReverse(); void delayedBindingDestruction(); void deleteStashedObject(); + void multiValueTypeBinding(); private: QQmlEngine engine; @@ -910,6 +911,23 @@ void tst_qqmlbinding::deleteStashedObject() QTRY_VERIFY(object->property("page").value<QObject *>() == nullptr); } +void tst_qqmlbinding::multiValueTypeBinding() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("multiValueTypeBinding.qml")); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer<QObject> object(component.create()); + QVERIFY(object); + + QObject *label = object->property("label").value<QObject *>(); + QVERIFY(label); + + QRectF rect = label->property("rect").toRectF(); + QCOMPARE(rect.x(), 12); + QCOMPARE(rect.y(), 24); + QCOMPARE(rect.width(), 9); +} + QTEST_MAIN(tst_qqmlbinding) #include "tst_qqmlbinding.moc" |