aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index ec3e38dd14..12d2f53596 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -151,6 +151,7 @@ private slots:
void nestedComponentRoots();
void registrationOrder();
void readonly();
+ void readonlyObjectProperties();
void receivers();
void registeredCompositeType();
void implicitImportsLast();
@@ -3274,6 +3275,24 @@ void tst_qqmllanguage::readonly()
delete o;
}
+void tst_qqmllanguage::readonlyObjectProperties()
+{
+ QQmlComponent component(&engine, testFileUrl("readonlyObjectProperty.qml"));
+
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(!o.isNull());
+
+ QQmlProperty prop(o.data(), QStringLiteral("subObject"), &engine);
+ QVERIFY(!prop.isWritable());
+ QVERIFY(!prop.write(QVariant::fromValue(o.data())));
+
+ QObject *subObject = qvariant_cast<QObject*>(prop.read());
+ QVERIFY(subObject);
+ QCOMPARE(subObject->property("readWrite").toInt(), int(42));
+ subObject->setProperty("readWrite", QVariant::fromValue(int(100)));
+ QCOMPARE(subObject->property("readWrite").toInt(), int(100));
+}
+
void tst_qqmllanguage::receivers()
{
QQmlComponent component(&engine, testFileUrl("receivers.qml"));