diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript')
39 files changed, 108 insertions, 98 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasBindingsAssignCorrectly.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasBindingsAssignCorrectly.qml index f0808c4c..75857650 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/aliasBindingsAssignCorrectly.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasBindingsAssignCorrectly.qml @@ -2,7 +2,7 @@ import QtQuick 1.0 Item { id: root - + property bool test: false property real testData: 9 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasBindingsOverrideTarget.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasBindingsOverrideTarget.3.qml index 937ae91c..bfd3c174 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/aliasBindingsOverrideTarget.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasBindingsOverrideTarget.3.qml @@ -11,7 +11,7 @@ Item { id: obj testProperty: root.value1 * 9 - aliasProperty: root.value2 * 10 + aliasProperty: root.value2 * 10 } Component.onCompleted: { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasPropertyAndBinding.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasPropertyAndBinding.qml index da6c795b..746d9dbf 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/aliasPropertyAndBinding.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasPropertyAndBinding.qml @@ -4,9 +4,9 @@ import Qt.test 1.0 MyQmlObject { property alias c1: myObject.c1 property int c2: 3 - property int c3: c2 - objectProperty: QtObject { - id: myObject + property int c3: c2 + objectProperty: QtObject { + id: myObject property int c1 } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml index 2c797296..081abd42 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml @@ -11,7 +11,7 @@ MyTypeObject { floatProperty: if(1) 8.5 colorProperty: if(1) "red" dateProperty: if(1) "1982-11-25" - timeProperty: if(1) "11:11:32" + timeProperty: if(1) "11:11:32" dateTimeProperty: if(1) "2009-05-12T13:22:01" pointProperty: if(1) "99,13" pointFProperty: if(1) "-10.1,12.3" diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml index 9443c01d..e2f7737a 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml @@ -13,7 +13,7 @@ MyTypeObject { floatProperty = 8.5 colorProperty = "red" dateProperty = "1982-11-25" - timeProperty = "11:11:32" + timeProperty = "11:11:32" dateTimeProperty = "2009-05-12T13:22:01" pointProperty = "99,13" pointFProperty = "-10.1,12.3" diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/bindingLoop.qml b/tests/auto/declarative/qdeclarativeecmascript/data/bindingLoop.qml index 80545cf7..e49a26d9 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/bindingLoop.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/bindingLoop.qml @@ -1,14 +1,14 @@ import Qt.test 1.0 -MyQmlContainer { - children : [ - MyQmlObject { - id: object1 - stringProperty: "hello" + object2.stringProperty +MyQmlContainer { + children : [ + MyQmlObject { + id: object1 + stringProperty: "hello" + object2.stringProperty }, - MyQmlObject { - id: object2 - stringProperty: "hello" + object1.stringProperty - } - ] + MyQmlObject { + id: object2 + stringProperty: "hello" + object1.stringProperty + } + ] } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.1.qml index 3147f639..054ecb98 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.1.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -MyQmlObject { - stringProperty: trueProperty?'pass':'fail' +MyQmlObject { + stringProperty: trueProperty?'pass':'fail' } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.2.qml index c89bb49b..37c747b3 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.2.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -MyQmlObject { - stringProperty: falseProperty?'fail':'pass' +MyQmlObject { + stringProperty: falseProperty?'fail':'pass' } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.2.qml index 207a06b7..7a0b0d6e 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.2.qml @@ -4,8 +4,8 @@ MyQmlObject { property alias c1: myConstants.c1 property alias c2: myConstants.c2 - objectProperty: ConstantsOverrideBindings { + objectProperty: ConstantsOverrideBindings { id: myConstants - c2: 10 + c2: 10 } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.4.qml index 5a2091f7..0c900d78 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.4.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.4.qml @@ -4,7 +4,7 @@ MyQmlObject { property alias c1: myConstants.c1 property alias c3: myConstants.c3 - objectProperty: ConstantsOverrideBindings { + objectProperty: ConstantsOverrideBindings { id: myConstants c3: 10 } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml index 4de405dc..e4c19d2f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml @@ -2,7 +2,7 @@ import QtQuick 1.0 QtObject { function calculate() { - return b * 13; + return b * 13; } property int a: calculate() diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/eval.qml b/tests/auto/declarative/qdeclarativeecmascript/data/eval.qml index 661cd5c4..5ac645d1 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/eval.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/eval.qml @@ -1,11 +1,11 @@ import QtQuick 1.0 QtObject { - property bool test1: false; - property bool test2: false; - property bool test3: false; - property bool test4: false; - property bool test5: false; + property bool test1: false; + property bool test2: false; + property bool test3: false; + property bool test4: false; + property bool test5: false; property int a: 7 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include.qml index 61b04618..4d9b2e84 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/include.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include.qml @@ -11,8 +11,8 @@ QtObject { property int testValue: 99 - Component.onCompleted: { - IncludeTest.go(); + Component.onCompleted: { + IncludeTest.go(); test0 = IncludeTest.value test1 = IncludeTest.test1 test2 = IncludeTest.test2 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml index 1633ebaa..b93ffec8 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml @@ -9,7 +9,7 @@ QtObject { property bool test5: false property bool test6: false - Component.onCompleted: { - IncludeTest.go(); + Component.onCompleted: { + IncludeTest.go(); } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.js index e6a46768..4331cb79 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.js +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.js @@ -2,8 +2,8 @@ var myvar = 10; function go() { - var a = Qt.include("http://127.0.0.1:8111/remote_file.js", - function(o) { + var a = Qt.include("http://127.0.0.1:8111/remote_file.js", + function(o) { test2 = o.status == o.OK test3 = a.status == a.OK test4 = myvar == 13 @@ -13,8 +13,8 @@ function go() test1 = a.status == a.LOADING - var b = Qt.include("http://127.0.0.1:8111/exception.js", - function(o) { + var b = Qt.include("http://127.0.0.1:8111/exception.js", + function(o) { test7 = o.status == o.EXCEPTION test8 = b.status == a.EXCEPTION test9 = b.exception.toString() == "Whoops!"; diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.js index cc90860c..27dd63ba 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.js +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.js @@ -1,7 +1,7 @@ function go() { - var a = Qt.include("http://127.0.0.1:8111/missing.js", - function(o) { + var a = Qt.include("http://127.0.0.1:8111/missing.js", + function(o) { test2 = o.status == o.NETWORK_ERROR test3 = a.status == a.NETWORK_ERROR diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml index e9f1c89b..fb200a84 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml @@ -9,8 +9,8 @@ QtObject { property bool test3: false property bool test3_1: false - Component.onCompleted: { - IncludeTest.go(); + Component.onCompleted: { + IncludeTest.go(); test0 = IncludeTest.value test1 = IncludeTest.test1 test2 = IncludeTest.test2 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/methods.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.1.qml index 0bbee16d..5c5b3412 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/methods.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.1.qml @@ -1,6 +1,6 @@ import Qt.test 1.0 -MyQmlObject { +MyQmlObject { id: myObject - onBasicSignal: myObject.methodNoArgs() + onBasicSignal: myObject.methodNoArgs() } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/methods.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.2.qml index 9f0c6b15..b2adaf65 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/methods.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.2.qml @@ -1,6 +1,6 @@ import Qt.test 1.0 -MyQmlObject { +MyQmlObject { id: myObject - onBasicSignal: myObject.method(163) + onBasicSignal: myObject.method(163) } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/outerBindingOverridesInnerBinding.qml b/tests/auto/declarative/qdeclarativeecmascript/data/outerBindingOverridesInnerBinding.qml index 090c948f..a57b09fe 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/outerBindingOverridesInnerBinding.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/outerBindingOverridesInnerBinding.qml @@ -6,8 +6,8 @@ MyQmlObject { property alias c2: myConstants.c2 property int c3: 0 - objectProperty: ConstantsOverrideBindings { - id: myConstants + objectProperty: ConstantsOverrideBindings { + id: myConstants c2: obj.c3 } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertySplicing.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertySplicing.qml index 7deb84a1..23071c0f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/propertySplicing.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertySplicing.qml @@ -3,7 +3,7 @@ import QtQuick 1.0 MyDerivedObject { property bool test: false - + Component.onCompleted: { test = intProperty() } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml index 9555b7f9..b60b2ed1 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml @@ -27,7 +27,7 @@ Item { // id takes precedence over local, and root properties - property int test1: a.value + property int test1: a.value property alias test2: nested.test // properties takes precedence over local, and root methods diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml index 65697d93..203b8aea 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml @@ -1,10 +1,10 @@ import Qt.test 1.0 import QtQuick 1.0 import "scriptConnect.1.js" as Script -MyQmlObject { +MyQmlObject { property bool test: false id: root - + Component.onCompleted: root.argumentSignal.connect(Script.testFunction); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml index 86ff7987..aac119d1 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml @@ -2,11 +2,11 @@ import Qt.test 1.0 import QtQuick 1.0 import "scriptConnect.2.js" as Script -MyQmlObject { +MyQmlObject { property bool test: false id: root - + Component.onCompleted: { var a = new Object; a.b = 12; diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.3.qml index db2f0057..ce715afb 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.3.qml @@ -1,11 +1,11 @@ import Qt.test 1.0 import QtQuick 1.0 -MyQmlObject { +MyQmlObject { property bool test: false id: root - + function testFunction() { test = true; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.4.qml index a2d90ff8..62f1f94d 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.4.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.4.qml @@ -1,7 +1,7 @@ import Qt.test 1.0 import QtQuick 1.0 -MyQmlObject { +MyQmlObject { property bool test: false id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.5.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.5.qml index 21fac15d..786e1519 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.5.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.5.qml @@ -1,7 +1,7 @@ import Qt.test 1.0 import QtQuick 1.0 -MyQmlObject { +MyQmlObject { property bool test: false id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml index 40530919..b1000ade 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml @@ -2,12 +2,12 @@ import Qt.test 1.0 import QtQuick 1.0 import "scriptConnect.6.js" as Script -MyQmlObject { +MyQmlObject { property int test: 0 id: root - Component.onCompleted: { + Component.onCompleted: { root.argumentSignal.connect(Script.testFunction); root.argumentSignal.connect(Script.testFunction); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml index bbe70249..ec00d0fa 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml @@ -2,11 +2,11 @@ import Qt.test 1.0 import QtQuick 1.0 import "scriptDisconnect.1.js" as Script -MyQmlObject { +MyQmlObject { property int test: 0 id: root - + Component.onCompleted: root.argumentSignal.connect(Script.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 8a166f41..5cb7e084 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml @@ -2,11 +2,11 @@ import Qt.test 1.0 import QtQuick 1.0 import "scriptDisconnect.1.js" as Script -MyQmlObject { +MyQmlObject { property int test: 0 id: root - + Component.onCompleted: root.argumentSignal.connect(root, Script.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 548f2a12..37abdb12 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml @@ -2,11 +2,11 @@ import Qt.test 1.0 import QtQuick 1.0 import "scriptDisconnect.1.js" as Script -MyQmlObject { +MyQmlObject { property int test: 0 id: root - + Component.onCompleted: root.argumentSignal.connect(root, Script.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 11b22d72..783d7a30 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml @@ -2,11 +2,11 @@ import Qt.test 1.0 import QtQuick 1.0 import "scriptDisconnect.1.js" as Script -MyQmlObject { +MyQmlObject { property int test: 0 id: root - + Component.onCompleted: root.argumentSignal.connect(Script.testFunction); 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 d22f623e..4f16ef4e 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js @@ -1,4 +1,4 @@ // Comment a = 10 -function getValue() { a = 10; return 0; } +function getValue() { a = 10; return 0; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/selfDeletingBinding.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/selfDeletingBinding.2.qml index 58cf8051..d1bddb43 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/selfDeletingBinding.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/selfDeletingBinding.2.qml @@ -11,7 +11,7 @@ MyQmlContainer { MyQmlObject { // Will trigger deletion on binding assignment, but after component creation - deleteOnSet: if (triggerDelete) 1; else 0; + deleteOnSet: if (triggerDelete) 1; else 0; } ] } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.1.qml index fbd09142..fbafd843 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.1.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -MyQmlObject { - onBasicSignal: setString('pass') +MyQmlObject { + onBasicSignal: setString('pass') } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.2.qml index 6467c42b..84065668 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.2.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -MyQmlObject { +MyQmlObject { onArgumentSignal: setString('pass ' + a + ' ' + b + ' ' + c + ' ' + d + ' ' + e) } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/signalTriggeredBindings.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalTriggeredBindings.qml index 8410d333..250b2d84 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/signalTriggeredBindings.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalTriggeredBindings.qml @@ -11,7 +11,7 @@ MyQmlObject { property real test1: base property real test2: Math.max(0, base) } - + // Signal with no args onBasicSignal: base = 200 // Signal with args diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 908035df..ba701576 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -114,7 +114,7 @@ public: } QObject *objectProperty() const { return m_object; } - void setObjectProperty(QObject *obj) { + void setObjectProperty(QObject *obj) { if (obj == m_object) return; m_object = obj; @@ -157,7 +157,7 @@ public: int value; }; QVariant variant() const { return m_variant; } - + signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c, MyEnum2 d, Qt::MouseButtons e); @@ -624,7 +624,7 @@ public: Q_INVOKABLE void method_QObject(QObject *a) { invoke(13); m_actuals << qVariantFromValue(a); } Q_INVOKABLE void method_QScriptValue(QScriptValue a) { invoke(14); m_actuals << qVariantFromValue(a); } Q_INVOKABLE void method_intQScriptValue(int a, QScriptValue b) { invoke(15); m_actuals << a << qVariantFromValue(b); } - + Q_INVOKABLE void method_overload(int a) { invoke(16); m_actuals << a; } Q_INVOKABLE void method_overload(int a, int b) { invoke(17); m_actuals << a << b; } Q_INVOKABLE void method_overload(QString a) { invoke(18); m_actuals << a; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index f30a61b1..c573bb4b 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -436,6 +436,16 @@ void tst_qdeclarativeecmascript::arrayExpressions() QCOMPARE(list.at(1), &obj2); QCOMPARE(list.at(2), &obj3); QCOMPARE(list.at(3), (QObject *)0); + + MyExpression expr2(&context, "[1, 2, \"foo\", \"bar\"]"); + result = expr2.evaluate(); + QCOMPARE(result.userType(), qMetaTypeId<QList<QVariant> >()); + QList<QVariant> list2 = qvariant_cast<QList<QVariant> >(result); + QCOMPARE(list2.count(), 4); + QCOMPARE(list2.at(0), QVariant(1)); + QCOMPARE(list2.at(1), QVariant(2)); + QCOMPARE(list2.at(2), QVariant(QString("foo"))); + QCOMPARE(list2.at(3), QVariant(QString("bar"))); } // Tests that modifying a context property will reevaluate expressions @@ -453,7 +463,7 @@ void tst_qdeclarativeecmascript::contextPropertiesTriggerReeval() context.setContextProperty("testObj", &object1); context.setContextProperty("testObj2", object3); - { + { MyExpression expr(&context, "testProp + 1"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant(2)); @@ -463,7 +473,7 @@ void tst_qdeclarativeecmascript::contextPropertiesTriggerReeval() QCOMPARE(expr.evaluate(), QVariant(3)); } - { + { MyExpression expr(&context, "testProp + testProp + testProp"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant(6)); @@ -473,7 +483,7 @@ void tst_qdeclarativeecmascript::contextPropertiesTriggerReeval() QCOMPARE(expr.evaluate(), QVariant(12)); } - { + { MyExpression expr(&context, "testObj.stringProperty"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant("Hello")); @@ -483,7 +493,7 @@ void tst_qdeclarativeecmascript::contextPropertiesTriggerReeval() QCOMPARE(expr.evaluate(), QVariant("World")); } - { + { MyExpression expr(&context, "testObj.stringProperty /**/"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant("World")); @@ -493,7 +503,7 @@ void tst_qdeclarativeecmascript::contextPropertiesTriggerReeval() QCOMPARE(expr.evaluate(), QVariant("Hello")); } - { + { MyExpression expr(&context, "testObj2"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant::fromValue((QObject *)object3)); @@ -513,7 +523,7 @@ void tst_qdeclarativeecmascript::objectPropertiesTriggerReeval() object2.setStringProperty(QLatin1String("Dog")); object3.setStringProperty(QLatin1String("Cat")); - { + { MyExpression expr(&context, "testObj.stringProperty"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant("Hello")); @@ -523,7 +533,7 @@ void tst_qdeclarativeecmascript::objectPropertiesTriggerReeval() QCOMPARE(expr.evaluate(), QVariant("World")); } - { + { MyExpression expr(&context, "testObj.objectProperty.stringProperty"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant()); @@ -558,7 +568,7 @@ void tst_qdeclarativeecmascript::objectPropertiesTriggerReeval() void tst_qdeclarativeecmascript::deferredProperties() { QDeclarativeComponent component(&engine, testFileUrl("deferredProperties.qml")); - MyDeferredObject *object = + MyDeferredObject *object = qobject_cast<MyDeferredObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->value(), 0); @@ -567,7 +577,7 @@ void tst_qdeclarativeecmascript::deferredProperties() qmlExecuteDeferred(object); QCOMPARE(object->value(), 10); QVERIFY(object->objectProperty() != 0); - MyQmlObject *qmlObject = + MyQmlObject *qmlObject = qobject_cast<MyQmlObject *>(object->objectProperty()); QVERIFY(qmlObject != 0); QCOMPARE(qmlObject->value(), 10); @@ -579,7 +589,7 @@ void tst_qdeclarativeecmascript::deferredProperties() void tst_qdeclarativeecmascript::deferredPropertiesErrors() { QDeclarativeComponent component(&engine, testFileUrl("deferredPropertiesErrors.qml")); - MyDeferredObject *object = + MyDeferredObject *object = qobject_cast<MyDeferredObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->value(), 0); @@ -597,7 +607,7 @@ void tst_qdeclarativeecmascript::deferredPropertiesErrors() void tst_qdeclarativeecmascript::extensionObjects() { QDeclarativeComponent component(&engine, testFileUrl("extensionObjects.qml")); - MyExtendedObject *object = + MyExtendedObject *object = qobject_cast<MyExtendedObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->baseProperty(), 13); @@ -709,7 +719,7 @@ void tst_qdeclarativeecmascript::valueTypeFunctions() QCOMPARE(obj->rectFProperty(), QRectF(0,0.5,100,99.5)); } -/* +/* Tests that writing a constant to a property with a binding on it disables the binding. */ @@ -784,7 +794,7 @@ the original binding to be disabled. */ void tst_qdeclarativeecmascript::outerBindingOverridesInnerBinding() { - QDeclarativeComponent component(&engine, + QDeclarativeComponent component(&engine, testFileUrl("outerBindingOverridesInnerBinding.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(object != 0); @@ -805,7 +815,7 @@ void tst_qdeclarativeecmascript::outerBindingOverridesInnerBinding() } /* -Access a non-existent attached object. +Access a non-existent attached object. Tests for a regression where this used to crash. */ @@ -1121,7 +1131,7 @@ void tst_qdeclarativeecmascript::propertyAssignmentErrors() delete object; } - + /* Test bindings still work when the reeval is triggered from within a signal script. @@ -1921,7 +1931,7 @@ void tst_qdeclarativeecmascript::attachedPropertyScope() QObject *object = component.create(); QVERIFY(object != 0); - MyQmlAttachedObject *attached = + MyQmlAttachedObject *attached = qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object)); QVERIFY(attached != 0); @@ -2166,7 +2176,7 @@ public: QPointer<QObject> value; }; -// QTBUG-15695. +// QTBUG-15695. // Test setObjectOwnership(CppOwnership) works even when there is no QDeclarativeData void tst_qdeclarativeecmascript::cppOwnershipReturnValue() { @@ -2376,7 +2386,7 @@ void tst_qdeclarativeecmascript::signalWithUnknownTypes() delete object; } -// Test that assigning a null object works +// Test that assigning a null object works // Regressed with: df1788b4dbbb2826ae63f26bdf166342595343f4 void tst_qdeclarativeecmascript::nullObjectBinding() { @@ -2460,7 +2470,7 @@ void tst_qdeclarativeecmascript::qtbug_9792() QtMessageHandler old = qInstallMessageHandler(transientErrorsMsgHandler); object->basicSignal(); - + qInstallMessageHandler(old); QCOMPARE(transientErrorsMsgCount, 0); @@ -2560,7 +2570,7 @@ void tst_qdeclarativeecmascript::functionAssignment_fromBinding() QString url = component.url().toString(); QString warning = url + ":4: Unable to assign a function to a property."; QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); - + MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(o != 0); @@ -2877,7 +2887,7 @@ void tst_qdeclarativeecmascript::aliasBindingsAssignCorrectly() // Test bindings assigned to alias properties override a binding on the target (QTBUG-13719) void tst_qdeclarativeecmascript::aliasBindingsOverrideTarget() { - { + { QDeclarativeComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.qml")); QObject *o = component.create(); QVERIFY(o != 0); |