aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-10-26 15:04:58 +0100
committerQt by Nokia <qt-info@nokia.com>2011-10-26 18:38:40 +0200
commitb79ceabb43427ba73fb0d64bd24f46c44e6a9d8d (patch)
treec15e0907029d996cbee83735c3e5bd382ee2a6f9 /tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
parenta927dc97844fd23e295387f8174367f3f4be2977 (diff)
Readonly QML property support
Task-number: QTBUG-15257 Change-Id: I539b6e6a9e0e0172b68e8002aaa3f7c7e6648769 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 538ebbb1a3..64ab5d8d39 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -156,6 +156,7 @@ private slots:
void inlineAssignmentsOverrideBindings();
void nestedComponentRoots();
void registrationOrder();
+ void readonly();
void basicRemote_data();
void basicRemote();
@@ -364,7 +365,6 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("property.2") << "property.2.qml" << "property.2.errors.txt" << false;
QTest::newRow("property.3") << "property.3.qml" << "property.3.errors.txt" << false;
QTest::newRow("property.4") << "property.4.qml" << "property.4.errors.txt" << false;
- QTest::newRow("property.5") << "property.5.qml" << "property.5.errors.txt" << false;
QTest::newRow("property.6") << "property.6.qml" << "property.6.errors.txt" << false;
QTest::newRow("property.7") << "property.7.qml" << "property.7.errors.txt" << false;
@@ -2142,6 +2142,40 @@ void tst_qdeclarativelanguage::registrationOrder()
delete o;
}
+void tst_qdeclarativelanguage::readonly()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("readonly.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toInt(), 10);
+ QCOMPARE(o->property("test2").toInt(), 18);
+ QCOMPARE(o->property("test3").toInt(), 13);
+
+ o->setProperty("testData", 13);
+
+ QCOMPARE(o->property("test1").toInt(), 10);
+ QCOMPARE(o->property("test2").toInt(), 22);
+ QCOMPARE(o->property("test3").toInt(), 13);
+
+ o->setProperty("testData2", 2);
+
+ QCOMPARE(o->property("test1").toInt(), 10);
+ QCOMPARE(o->property("test2").toInt(), 22);
+ QCOMPARE(o->property("test3").toInt(), 2);
+
+ o->setProperty("test1", 11);
+ o->setProperty("test2", 11);
+ o->setProperty("test3", 11);
+
+ QCOMPARE(o->property("test1").toInt(), 10);
+ QCOMPARE(o->property("test2").toInt(), 22);
+ QCOMPARE(o->property("test3").toInt(), 2);
+
+ delete o;
+}
+
// QTBUG-18268
void tst_qdeclarativelanguage::remoteLoadCrash()
{