From cc688cc0cc4f5d4fc8f01411798872205df1d59c Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Thu, 19 Jul 2012 10:46:35 +1000 Subject: 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 --- .../auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp') diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp index af5e914290..a323db5d5f 100644 --- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp +++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp @@ -290,6 +290,7 @@ void tst_qqmlvaluetypes::sizef() void tst_qqmlvaluetypes::variant() { + { QQmlComponent component(&engine, testFileUrl("variant_read.qml")); MyTypeObject *object = qobject_cast(component.create()); QVERIFY(object != 0); @@ -299,6 +300,27 @@ void tst_qqmlvaluetypes::variant() QCOMPARE(object->property("copy"), QVariant(QSizeF(0.1, 100923.2))); delete object; + } + + { + QString w1 = testFileUrl("variant_write.1.qml").toString() + QLatin1String(":9: TypeError: Object QVector2D(8, 2) has no method 'plus'"); + QTest::ignoreMessage(QtWarningMsg, qPrintable(w1)); + QQmlComponent component(&engine, testFileUrl("variant_write.1.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QVERIFY(object->property("complete").toBool()); + QVERIFY(object->property("success").toBool()); + delete object; + } + + { + QQmlComponent component(&engine, testFileUrl("variant_write.2.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QVERIFY(object->property("complete").toBool()); + QVERIFY(object->property("success").toBool()); + delete object; + } } void tst_qqmlvaluetypes::sizereadonly() -- cgit v1.2.3