diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript/data')
27 files changed, 50 insertions, 196 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml index b7bec63..12ac754 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml @@ -5,10 +5,8 @@ Item { property int binding: myFunction(); property int binding2: myCompFunction(); - Script { - function myCompFunction() { - return a; - } + function myCompFunction() { + return a; } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.1.qml deleted file mode 100644 index 2ac7b6e..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.1.qml +++ /dev/null @@ -1,11 +0,0 @@ -import Qt 4.6 - -QtObject { - property int test: external_script_func(); - - Script { - // Single source as non-array literal - source: "externalScript.js" - } -} - diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.js b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.js deleted file mode 100644 index 78c3a86..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.js +++ /dev/null @@ -1,8 +0,0 @@ -function external_script_func2() { - return a; -} - -function is_a_undefined() { - return a == undefined; -} - diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.qml deleted file mode 100644 index dec657c..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.qml +++ /dev/null @@ -1,11 +0,0 @@ -import Qt 4.6 - -QtObject { - property int test: external_script_func(); - - Script { - // Single source as array - source: [ "externalScript.js" ] - } -} - diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.3.qml deleted file mode 100644 index d7acf38..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.3.qml +++ /dev/null @@ -1,13 +0,0 @@ -import Qt 4.6 - -QtObject { - property int test: external_script_func(); - property int test2: external_script_func2(); - property bool test3: is_a_undefined(); - - Script { - // Multiple script - source: [ "externalScript.js", "externalScript.2.js" ] - } -} - diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.4.qml deleted file mode 100644 index 16211aa..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.4.qml +++ /dev/null @@ -1,15 +0,0 @@ -import Qt 4.6 - -QtObject { - property int test: external_script_func(); - property bool test2: is_a_undefined(); - - // Disconnected scripts - Script { - source: "externalScript.js" - } - - Script { - source: "externalScript.2.js" - } -} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.js b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.js deleted file mode 100644 index 8928652..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.js +++ /dev/null @@ -1,6 +0,0 @@ -var a = 92; - -function external_script_func() { - return a; -} - diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml index 8e5aa0b..9beda6a 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml @@ -4,10 +4,8 @@ Item { property int a: 0 property int b: 0 - Script { - function b() { return 11; } - function c() { return 33; } - } + function b() { return 11; } + function c() { return 33; } QtObject { id: a diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml index cccd3d3..1c0be98 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml @@ -7,21 +7,17 @@ Item { property int binding: a property string binding2: a + "Test" property int binding3: myFunction() - property int binding4: myNestedFunction() + property int binding4: nestedObject.myNestedFunction() - Script { - function myFunction() { - return a; - } + function myFunction() { + return a; } Item { id: nestedObject - Script { - function myNestedFunction() { - return a; - } + function myNestedFunction() { + return a; } property int a: 2 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.js deleted file mode 100644 index c00d285..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.js +++ /dev/null @@ -1,7 +0,0 @@ -var extVariable = 19; - -function extMethod() -{ - return extVariable; -} - diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.qml deleted file mode 100644 index feb6d16..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.qml +++ /dev/null @@ -1,17 +0,0 @@ -import Qt 4.6 - -Item { - Script { - function method() { - return 10; - } - } - - Script { - source: "scriptAccess.js" - } - - property int test1: method() - property int test2: extMethod() - property int test3: extVariable -} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.js new file mode 100644 index 0000000..54284fe --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.js @@ -0,0 +1,4 @@ +function testFunction() { + test = true; +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml index 2bdd706..d6e4207 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml @@ -1,16 +1,10 @@ import Qt.test 1.0 import Qt 4.6 - +import "scriptConnect.1.js" as Script MyQmlObject { property bool test: false id: root - Script { - function testFunction() { - test = true; - } - } - - Component.onCompleted: root.argumentSignal.connect(testFunction); + Component.onCompleted: root.argumentSignal.connect(Script.testFunction); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.js new file mode 100644 index 0000000..595c778 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.js @@ -0,0 +1,5 @@ +function testFunction() { + if (this.b == 12) + test = true; +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml index fa90918..7992ba5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml @@ -1,22 +1,16 @@ import Qt.test 1.0 import Qt 4.6 +import "scriptConnect.2.js" as Script MyQmlObject { property bool test: false id: root - Script { - function testFunction() { - if (this.b == 12) - test = true; - } - } - Component.onCompleted: { var a = new Object; a.b = 12; - root.argumentSignal.connect(a, testFunction); + root.argumentSignal.connect(a, Script.testFunction); } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.js new file mode 100644 index 0000000..71bdd08 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.js @@ -0,0 +1,3 @@ +function testFunction() { + test++; +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml index 8c35db1..d546495 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml @@ -1,20 +1,15 @@ import Qt.test 1.0 import Qt 4.6 +import "scriptConnect.6.js" as Script MyQmlObject { property int test: 0 id: root - - Script { - function testFunction() { - test++; - } - } Component.onCompleted: { - root.argumentSignal.connect(testFunction); - root.argumentSignal.connect(testFunction); + root.argumentSignal.connect(Script.testFunction); + root.argumentSignal.connect(Script.testFunction); } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.js new file mode 100644 index 0000000..407426f --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.js @@ -0,0 +1,6 @@ +function testFunction() { + test++; +} + +function otherFunction() { +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml index 45c4f73..0d262c6 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml @@ -1,18 +1,13 @@ import Qt.test 1.0 import Qt 4.6 +import "scriptDisconnect.1.js" as Script MyQmlObject { property int test: 0 id: root - Script { - function testFunction() { - test++; - } - } + Component.onCompleted: root.argumentSignal.connect(Script.testFunction); - Component.onCompleted: root.argumentSignal.connect(testFunction); - - onBasicSignal: root.argumentSignal.disconnect(testFunction); + onBasicSignal: root.argumentSignal.disconnect(Script.testFunction); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml index a47fe74..6d379e6 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml @@ -1,19 +1,14 @@ import Qt.test 1.0 import Qt 4.6 +import "scriptDisconnect.1.js" as Script MyQmlObject { property int test: 0 id: root - Script { - function testFunction() { - test++; - } - } + Component.onCompleted: root.argumentSignal.connect(root, Script.testFunction); - Component.onCompleted: root.argumentSignal.connect(root, testFunction); - - onBasicSignal: root.argumentSignal.disconnect(root, testFunction); + onBasicSignal: root.argumentSignal.disconnect(root, Script.testFunction); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml index c95ffbf..526580a 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml @@ -1,19 +1,14 @@ import Qt.test 1.0 import Qt 4.6 +import "scriptDisconnect.1.js" as Script MyQmlObject { property int test: 0 id: root - Script { - function testFunction() { - test++; - } - } + Component.onCompleted: root.argumentSignal.connect(root, Script.testFunction); - Component.onCompleted: root.argumentSignal.connect(root, testFunction); - - onBasicSignal: root.argumentSignal.disconnect(testFunction); + onBasicSignal: root.argumentSignal.disconnect(Script.testFunction); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml index 342f24a..18b05ad 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml @@ -1,20 +1,13 @@ import Qt.test 1.0 import Qt 4.6 +import "scriptDisconnect.1.js" as Script MyQmlObject { property int test: 0 id: root - Script { - function testFunction() { - test++; - } - function otherFunction() { - } - } + Component.onCompleted: root.argumentSignal.connect(Script.testFunction); - Component.onCompleted: root.argumentSignal.connect(testFunction); - - onBasicSignal: root.argumentSignal.disconnect(otherFunction); + onBasicSignal: root.argumentSignal.disconnect(Script.otherFunction); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js index 1d7b357..d22f623 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js @@ -1,2 +1,4 @@ // Comment a = 10 + +function getValue() { a = 10; return 0; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml index c2edb41..e8f7b62 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml @@ -1,11 +1,9 @@ import Qt.test 1.0 +import "scriptErrors.js" as Script MyQmlObject { - Script { source: "scriptErrors.js" } - Script { function getValue() { a = 10; return 0; } } - property int t: a.value - property int w: getValue(); + property int w: Script.getValue(); property int x: undefinedObject property int y: (a.value, undefinedObject) diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml deleted file mode 100644 index 9b11fa9..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml +++ /dev/null @@ -1,13 +0,0 @@ -import Qt.test 1.0 - -MyQmlObject { - property string result - - Script{ - function f() { - result = b - } - - } - onArgumentSignal: f() -} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml deleted file mode 100644 index ec727e2..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml +++ /dev/null @@ -1,11 +0,0 @@ -import Qt.test 1.0 - -MyQmlObject { - property string result - property string aProp: "hello" - - Script{ - source: "scriptScope.js" - } - onBasicSignal: f() -} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js deleted file mode 100644 index 5689930..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js +++ /dev/null @@ -1,5 +0,0 @@ -var aProp = "world"; - -function f() { - result = aProp; -} |