diff options
Diffstat (limited to 'tests')
3 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/data/recursiveWriteBack.qml b/tests/auto/qml/qqmlvaluetypeproviders/data/recursiveWriteBack.qml index d6707e37cd..e2c39d2d72 100644 --- a/tests/auto/qml/qqmlvaluetypeproviders/data/recursiveWriteBack.qml +++ b/tests/auto/qml/qqmlvaluetypeproviders/data/recursiveWriteBack.qml @@ -3,11 +3,16 @@ import Test MyTypeObject { property list<structured> l: [{i : 21}, {c: 22}, {p: {x: 199, y: 222}}] + property int aa: 5 Component.onCompleted: { l[2].i = 4 l[1].p.x = 88 l[0].sizes[1].width = 19 structured.p.x = 76 + + var sizesDetached = l[0].sizesDetached(); + sizesDetached[1].width = 12; + aa = sizesDetached[1].width; } } diff --git a/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h b/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h index 096212822d..0267345281 100644 --- a/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h +++ b/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h @@ -98,6 +98,8 @@ public: const QList<QSizeF> &sizes() const { return m_sizes; } void setSizes(const QList<QSizeF> &sizes) { m_sizes = sizes; } + Q_INVOKABLE QList<QSizeF> sizesDetached() const { return m_sizes; } + private: friend bool operator==(const StructuredValueType &a, const StructuredValueType &b) diff --git a/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp b/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp index 5f4d7c1042..930ac11fbe 100644 --- a/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp +++ b/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp @@ -476,6 +476,9 @@ void tst_qqmlvaluetypeproviders::recursive() MyTypeObject *m = qobject_cast<MyTypeObject *>(o.data()); QCOMPARE(m->structured().p().x(), 76); + + // Recursive write back into a list detached from the property. + QCOMPARE(m->property("aa").toInt(), 12); } void tst_qqmlvaluetypeproviders::date() |