aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript/data
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2011-11-29 13:06:47 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-30 12:28:27 +0100
commitdcf1e555d7d2ff435098fe910262cc77dcf835db (patch)
tree294a94c138e3cebe025bd7a3f4abc0be6776cd12 /tests/auto/declarative/qdeclarativeecmascript/data
parent92b2a05dcae983be6f108e010114c129809b9234 (diff)
Extend the grammar of QML binding declarations.
This allows the use of non-iterative statements on the right hand side of a binding declaration. Change-Id: I60fac880766ba99a410b3647e41b1252677a372f Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript/data')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/switchStatement.6.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.1.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.2.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.3.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.4.qml12
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/withStatement.1.qml14
6 files changed, 76 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/switchStatement.6.qml b/tests/auto/declarative/qdeclarativeecmascript/data/switchStatement.6.qml
new file mode 100644
index 0000000000..6fb71eb345
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/switchStatement.6.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ function one(kind) { return 123 }
+ function two(kind) { return 321 }
+
+ value: switch (stringProperty) {
+ case "A": case "S": one(stringProperty); break;
+ case "D": case "F": two(stringProperty); break;
+ default: 0
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.1.qml
new file mode 100644
index 0000000000..71cc67a941
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.1.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int defaultValue: 123
+
+ function go() {
+ undefinedObject.method() // this call will throw an exception
+ return 321
+ }
+
+ value: try { go() } catch(e) { defaultValue }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.2.qml
new file mode 100644
index 0000000000..e7fca0bff7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.2.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int defaultValue: 123
+
+ function go() {
+ return 321
+ }
+
+ value: try { go() } catch(e) { defaultValue }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.3.qml
new file mode 100644
index 0000000000..04b39f73d5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.3.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int defaultValue: 123
+
+ function go() {
+ undefinedObject.method() // this call will throw an exception
+ return 321
+ }
+
+ value: try { var p = go() } catch(e) { var p = defaultValue } finally { p == 123 }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.4.qml
new file mode 100644
index 0000000000..231aaf0683
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/tryStatement.4.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int defaultValue: 123
+
+ function go() {
+ return 321
+ }
+
+ value: try { var p = go() } catch(e) { var p = defaultValue } finally { p == 321 }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/withStatement.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/withStatement.1.qml
new file mode 100644
index 0000000000..28f0c08451
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/withStatement.1.qml
@@ -0,0 +1,14 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property var other: MyQmlObject {
+ intProperty: 123
+
+ function go() {
+ return intProperty;
+ }
+ }
+
+ value: with(other) go()
+}
+