summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-08 06:13:31 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-08 06:18:43 (GMT)
commitdf1788b4dbbb2826ae63f26bdf166342595343f4 (patch)
treeb021f683c6da72f9c46d0decbf0f8aa97dd2a9d4 /tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml
parent942a605a52dbbd6dfa824e3b76e37576c7d79f6e (diff)
downloadQt-df1788b4dbbb2826ae63f26bdf166342595343f4.zip
Qt-df1788b4dbbb2826ae63f26bdf166342595343f4.tar.gz
Qt-df1788b4dbbb2826ae63f26bdf166342595343f4.tar.bz2
Cleanup handling of errors in bindings and scripts
QML used to silently ignore a log of errors - such as a failed assignment to a QObject property. These errors are now all reported as exceptions in JavaScript. Other questionable activities, like assigning a JavaScript array to a "property var" property which appeared to work, thanks to QtScript's transparent conversion of arrays to a QVariantList, are now blocked entirely. QTBUG-9152 QTBUG-9382 QTBUG-9341 QTBUG-6886
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml
new file mode 100644
index 0000000..483179a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml
@@ -0,0 +1,28 @@
+import Qt 4.6
+
+QtObject {
+ id: root
+
+ property int a
+ property var b
+
+ Component.onCompleted: {
+ try {
+ root.a = undefined;
+ } catch(e) {
+ console.log (e.fileName + ":" + e.lineNumber + ":" + e);
+ }
+
+ try {
+ root.b = [ 10, root ]
+ } catch(e) {
+ console.log (e.fileName + ":" + e.lineNumber + ":" + e);
+ }
+
+ try {
+ root.a = "Hello";
+ } catch(e) {
+ console.log (e.fileName + ":" + e.lineNumber + ":" + e);
+ }
+ }
+}