aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeWriting.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeWriting.qml')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeWriting.qml30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeWriting.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeWriting.qml
new file mode 100644
index 0000000000..6870027d72
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeWriting.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+import Qt.test 1.0 as QtTest // qobject singleton Type installed into existing uri
+
+QtObject {
+ property int firstProperty: 1
+ property int secondProperty: 2
+ property int readOnlyProperty: QtTest.QObject.qobjectTestProperty
+ property int writableProperty: QtTest.QObject.qobjectTestWritableProperty
+ property int writableFinalProperty: QtTest.QObject.qobjectTestWritableFinalProperty
+
+ onFirstPropertyChanged: {
+ // In this case, we want to attempt to set the singleton Type property.
+ // This should fail, as the singleton Type property is read only.
+ if (firstProperty != QtTest.QObject.qobjectTestProperty) {
+ QtTest.QObject.qobjectTestProperty = firstProperty; // should silently fail.
+ }
+ }
+
+ onSecondPropertyChanged: {
+ // In this case, we want to attempt to set the singleton Type properties.
+ // This should succeed, as the singleton Type properties are writable.
+ if (secondProperty != QtTest.QObject.qobjectTestWritableProperty) {
+ QtTest.QObject.qobjectTestWritableProperty = secondProperty; // should succeed.
+ }
+ if (secondProperty != QtTest.QObject.qobjectTestWritableFinalProperty) {
+ QtTest.QObject.qobjectTestWritableFinalProperty = secondProperty; // should succeed.
+ }
+ }
+}
+