aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-07-19 10:46:35 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-24 04:04:33 +0200
commitcc688cc0cc4f5d4fc8f01411798872205df1d59c (patch)
tree7258f74e3769f598a0a22609c095a71d0d1c3fc5 /tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
parentec0ad9abc684604e7fbb9eb25899e95b58c0f7ad (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/tst_qqmlvaluetypes.cpp')
-rw-r--r--tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp22
1 files changed, 22 insertions, 0 deletions
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<MyTypeObject *>(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()