diff options
author | Chris Adams <christopher.adams@nokia.com> | 2012-07-19 10:46:35 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-24 04:04:33 +0200 |
commit | cc688cc0cc4f5d4fc8f01411798872205df1d59c (patch) | |
tree | 7258f74e3769f598a0a22609c095a71d0d1c3fc5 /tests/auto/qml/qqmlvaluetypes/data/variant_write.1.qml | |
parent | ec0ad9abc684604e7fbb9eb25899e95b58c0f7ad (diff) |
Fix value-type semantics in variant properties
Previously, variant properties storing value-type values would be
treated as value-type-copy values rather than value-type-reference
values. This caused inconsistency in behaviour with value-type
subproperty assignment.
Task-number: QTBUG-26562
Change-Id: I524ee06ab8e02bf9582c1a88f3317278199225e0
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlvaluetypes/data/variant_write.1.qml')
-rw-r--r-- | tests/auto/qml/qqmlvaluetypes/data/variant_write.1.qml | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlvaluetypes/data/variant_write.1.qml b/tests/auto/qml/qqmlvaluetypes/data/variant_write.1.qml new file mode 100644 index 0000000000..6063917dd4 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/variant_write.1.qml @@ -0,0 +1,25 @@ +import QtQuick 2.0 + +Item { + property bool complete: false + property bool success: false + + property variant v1: Qt.vector3d(1,2,3) + property variant v2: Qt.vector3d(4,5,6) + property variant v3: v1.plus(v2) // set up doomed binding + + Component.onCompleted: { + complete = false; + success = true; + + v1 = Qt.vector2d(1,2) // changing the type of the property shouldn't cause crash + + v1.x = 8; + v2.x = 9; + + if (v1 != Qt.vector2d(8,2)) success = false; + if (v2 != Qt.vector3d(9,5,6)) success = false; + + complete = true; + } +} |