diff options
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
496 files changed, 5449 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/Alias.qml b/tests/auto/qml/qqmllanguage/data/Alias.qml new file mode 100644 index 0000000000..2cb7cbe2e0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/Alias.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + id: root + property int value: 1892 + property alias aliasValue: root.value +} + diff --git a/tests/auto/qml/qqmllanguage/data/Alias2.qml b/tests/auto/qml/qqmllanguage/data/Alias2.qml new file mode 100644 index 0000000000..134e1440b5 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/Alias2.qml @@ -0,0 +1,9 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + property variant other + other: MyTypeObject { id: obj } + property alias enumAlias: obj.enumProperty; +} + diff --git a/tests/auto/qml/qqmllanguage/data/Alias3.qml b/tests/auto/qml/qqmllanguage/data/Alias3.qml new file mode 100644 index 0000000000..54b548e049 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/Alias3.qml @@ -0,0 +1,12 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + property alias obj : otherObj + property variant child + child: QtObject { + id: otherObj + property int myValue: 10 + } +} + diff --git a/tests/auto/qml/qqmllanguage/data/Alias4.qml b/tests/auto/qml/qqmllanguage/data/Alias4.qml new file mode 100644 index 0000000000..e09eca2ff3 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/Alias4.qml @@ -0,0 +1,5 @@ +import Test 1.0 +import QtQuick 2.0 + +Alias3 {} + diff --git a/tests/auto/qml/qqmllanguage/data/AliasPropertyChangeSignalsType.qml b/tests/auto/qml/qqmllanguage/data/AliasPropertyChangeSignalsType.qml new file mode 100644 index 0000000000..9265ffb1df --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/AliasPropertyChangeSignalsType.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +QtObject { + id: root + + signal sig1 + signal sig2 + signal sig3 + signal sig4 + + property alias aliasProperty: root.realProperty + + property int realProperty: 0 + + property bool test: false + + Component.onCompleted: { + root.realProperty = 10; + } +} diff --git a/tests/auto/qml/qqmllanguage/data/ComponentComposite.qml b/tests/auto/qml/qqmllanguage/data/ComponentComposite.qml new file mode 100644 index 0000000000..889450b565 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/ComponentComposite.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +Component { + QtObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType.qml b/tests/auto/qml/qqmllanguage/data/CompositeType.qml new file mode 100644 index 0000000000..addc4265a9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/CompositeType.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 + +QtObject { +} diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType2.qml b/tests/auto/qml/qqmllanguage/data/CompositeType2.qml new file mode 100644 index 0000000000..86210e9072 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/CompositeType2.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyQmlObject { +} + diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType3.qml b/tests/auto/qml/qqmllanguage/data/CompositeType3.qml new file mode 100644 index 0000000000..f48a77598c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/CompositeType3.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property int a +} diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType4.qml b/tests/auto/qml/qqmllanguage/data/CompositeType4.qml new file mode 100644 index 0000000000..a6a8168d8f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/CompositeType4.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyQmlObject { + property int a +} + diff --git a/tests/auto/qml/qqmllanguage/data/DontDoubleCallClassBeginItem.qml b/tests/auto/qml/qqmllanguage/data/DontDoubleCallClassBeginItem.qml new file mode 100644 index 0000000000..1f8eac8a3b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/DontDoubleCallClassBeginItem.qml @@ -0,0 +1,4 @@ +import Test 1.0 + +MyParserStatus { +} diff --git a/tests/auto/qml/qqmllanguage/data/DynamicPropertiesNestedType.qml b/tests/auto/qml/qqmllanguage/data/DynamicPropertiesNestedType.qml new file mode 100644 index 0000000000..4667adda14 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/DynamicPropertiesNestedType.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + property int super_a: 10 + property int super_c: 14 +} diff --git a/tests/auto/qml/qqmllanguage/data/HelperAlias.qml b/tests/auto/qml/qqmllanguage/data/HelperAlias.qml new file mode 100644 index 0000000000..c2ab70ffd6 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/HelperAlias.qml @@ -0,0 +1,9 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + property variant child + child: QtObject { id: obj } + property alias objAlias: obj; +} + diff --git a/tests/auto/qml/qqmllanguage/data/I18n.qml b/tests/auto/qml/qqmllanguage/data/I18n.qml new file mode 100644 index 0000000000..558c836e52 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/I18n.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + property int áâãäå: 10 + stringProperty: "Test áâãäå: " + áâãäå +} diff --git a/tests/auto/qml/qqmllanguage/data/I18nType30.qml b/tests/auto/qml/qqmllanguage/data/I18nType30.qml new file mode 100644 index 0000000000..42dbc69044 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/I18nType30.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + stringProperty: "Test áâãäå: 30" +} diff --git a/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType.qml b/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType.qml new file mode 100644 index 0000000000..42513e463f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +QtObject { + property InlineAssignmentsOverrideBindingsType2 nested: InlineAssignmentsOverrideBindingsType2 { + value: 19 * 33 + } +} diff --git a/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType2.qml b/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType2.qml new file mode 100644 index 0000000000..4a45535a50 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType2.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property int value +} diff --git a/tests/auto/qml/qqmllanguage/data/LocalLast.qml b/tests/auto/qml/qqmllanguage/data/LocalLast.qml new file mode 100644 index 0000000000..59df88216e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/LocalLast.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 +Text {} diff --git a/tests/auto/qml/qqmllanguage/data/MyComponent.qml b/tests/auto/qml/qqmllanguage/data/MyComponent.qml new file mode 100644 index 0000000000..1a23277ff8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/MyComponent.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyQmlObject { + property real x; + property real y; +} diff --git a/tests/auto/qml/qqmllanguage/data/MyCompositeValueSource.qml b/tests/auto/qml/qqmllanguage/data/MyCompositeValueSource.qml new file mode 100644 index 0000000000..e620e26490 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/MyCompositeValueSource.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyPropertyValueSource { + property int x +} + diff --git a/tests/auto/qml/qqmllanguage/data/MyContainerComponent.qml b/tests/auto/qml/qqmllanguage/data/MyContainerComponent.qml new file mode 100644 index 0000000000..61f54c5eb8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/MyContainerComponent.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyContainer { + property int x +} diff --git a/tests/auto/qml/qqmllanguage/data/NestedAlias.qml b/tests/auto/qml/qqmllanguage/data/NestedAlias.qml new file mode 100644 index 0000000000..7d49b0ac98 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/NestedAlias.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +QtObject { + property QtObject o1 + property QtObject o2 + + property alias a: object2.a + + o1: QtObject { id: object1 } + o2: QtObject { + id: object2 + property int a: 1923 + } +} diff --git a/tests/auto/qml/qqmllanguage/data/NestedComponentRoot.qml b/tests/auto/qml/qqmllanguage/data/NestedComponentRoot.qml new file mode 100644 index 0000000000..887d7fae50 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/NestedComponentRoot.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +Component { + Item { + } +} diff --git a/tests/auto/qml/qqmllanguage/data/NestedErrorsType.qml b/tests/auto/qml/qqmllanguage/data/NestedErrorsType.qml new file mode 100644 index 0000000000..06a3212916 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/NestedErrorsType.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +Item { + x: "You can't assign a string to a real!" +} diff --git a/tests/auto/qml/qqmllanguage/data/OnCompletedType.qml b/tests/auto/qml/qqmllanguage/data/OnCompletedType.qml new file mode 100644 index 0000000000..947f14811f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/OnCompletedType.qml @@ -0,0 +1,8 @@ +import Test 1.0 +import QtQuick 2.0 + +MyQmlObject { + property int a: Math.max(10, 9) + property int b: 11 + Component.onCompleted: console.log("Completed " + a + " " + b); +} diff --git a/tests/auto/qml/qqmllanguage/data/OnDestructionType.qml b/tests/auto/qml/qqmllanguage/data/OnDestructionType.qml new file mode 100644 index 0000000000..11fb9d9578 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/OnDestructionType.qml @@ -0,0 +1,8 @@ +import Test 1.0 +import QtQuick 2.0 + +MyQmlObject { + property int a: Math.max(10, 9) + property int b: 11 + Component.onDestruction: console.log("Destruction " + a + " " + b); +} diff --git a/tests/auto/qml/qqmllanguage/data/ReadOnlyType.qml b/tests/auto/qml/qqmllanguage/data/ReadOnlyType.qml new file mode 100644 index 0000000000..456ac762fc --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/ReadOnlyType.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + readonly property int readOnlyProperty: 19 +} diff --git a/tests/auto/qml/qqmllanguage/data/alias.1.qml b/tests/auto/qml/qqmllanguage/data/alias.1.qml new file mode 100644 index 0000000000..dbb3f06d32 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.1.qml @@ -0,0 +1,8 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + id: root + property int value: 10 + property alias valueAlias: root.value +} diff --git a/tests/auto/qml/qqmllanguage/data/alias.10.qml b/tests/auto/qml/qqmllanguage/data/alias.10.qml new file mode 100644 index 0000000000..bf6352e82b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.10.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias valueAlias: root.rectProperty + + rectProperty: "10,11,9x8" +} diff --git a/tests/auto/qml/qqmllanguage/data/alias.11.qml b/tests/auto/qml/qqmllanguage/data/alias.11.qml new file mode 100644 index 0000000000..fbd50d9dc9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.11.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + id: root + + property alias aliasProperty: root.rectProperty.x + rectProperty: "19,13,100x120" +} diff --git a/tests/auto/qml/qqmllanguage/data/alias.2.qml b/tests/auto/qml/qqmllanguage/data/alias.2.qml new file mode 100644 index 0000000000..5c922709fe --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.2.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyQmlObject { + id: root + property alias aliasObject: root.qmlobjectProperty + + qmlobjectProperty: MyQmlObject { value : 10 } +} diff --git a/tests/auto/qml/qqmllanguage/data/alias.3.qml b/tests/auto/qml/qqmllanguage/data/alias.3.qml new file mode 100644 index 0000000000..16a6d9d903 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.3.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 + +QtObject { + property variant other + other: Alias { id: myAliasObject } + + property alias value: myAliasObject.aliasValue + property alias value2: myAliasObject.value +} + diff --git a/tests/auto/qml/qqmllanguage/data/alias.4.qml b/tests/auto/qml/qqmllanguage/data/alias.4.qml new file mode 100644 index 0000000000..bd6a769367 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.4.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +Alias2 { + enumAlias: MyTypeObject.EnumVal2 +} + diff --git a/tests/auto/qml/qqmllanguage/data/alias.5.qml b/tests/auto/qml/qqmllanguage/data/alias.5.qml new file mode 100644 index 0000000000..cee2a88cf7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.5.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 +import Test 1.0 + +QtObject { + property alias otherAlias: otherObject + + property variant other + other: MyQmlObject { + id: otherObject + value: 10 + } +} + diff --git a/tests/auto/qml/qqmllanguage/data/alias.6.qml b/tests/auto/qml/qqmllanguage/data/alias.6.qml new file mode 100644 index 0000000000..54d3c320e0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.6.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + property QtObject o; + property alias a: object.a + o: NestedAlias { id: object } +} + diff --git a/tests/auto/qml/qqmllanguage/data/alias.7.qml b/tests/auto/qml/qqmllanguage/data/alias.7.qml new file mode 100644 index 0000000000..0dc54d6787 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.7.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +QtObject { + property QtObject object + property alias aliasedObject: target.object + + object: QtObject { + id: target + + property QtObject object + object: QtObject {} + } +} + diff --git a/tests/auto/qml/qqmllanguage/data/alias.8.qml b/tests/auto/qml/qqmllanguage/data/alias.8.qml new file mode 100644 index 0000000000..3cb280ef47 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.8.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +QtObject { + property variant other + other: Alias3 { id: myAliasObject } + + property int value: myAliasObject.obj.myValue +} + diff --git a/tests/auto/qml/qqmllanguage/data/alias.9.qml b/tests/auto/qml/qqmllanguage/data/alias.9.qml new file mode 100644 index 0000000000..01cf9142b2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.9.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +QtObject { + property variant other + other: Alias4 { id: myAliasObject } + + property int value: myAliasObject.obj.myValue +} + diff --git a/tests/auto/qml/qqmllanguage/data/aliasPropertiesAndSignals.qml b/tests/auto/qml/qqmllanguage/data/aliasPropertiesAndSignals.qml new file mode 100644 index 0000000000..60e66921d2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/aliasPropertiesAndSignals.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +QtObject { + id: root + + property bool test: false + property alias myalias: root.objectName + signal go + onGo: test = true + + Component.onCompleted: { + root.go(); + } +} diff --git a/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.2.qml b/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.2.qml new file mode 100644 index 0000000000..089130d14c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.2.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 + +AliasPropertyChangeSignalsType { + id: root + onAliasPropertyChanged: root.test = true + + function blah() {} + property int a +} + diff --git a/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.qml b/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.qml new file mode 100644 index 0000000000..4e11b9174a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.qml @@ -0,0 +1,16 @@ +import QtQuick 2.0 + +QtObject { + id: root + + property alias aliasProperty: root.realProperty + onAliasPropertyChanged: root.test = true + + property int realProperty: 0 + + property bool test: false + + Component.onCompleted: { + root.realProperty = 10; + } +} diff --git a/tests/auto/qml/qqmllanguage/data/allowedRevisionOverloads.qml b/tests/auto/qml/qqmllanguage/data/allowedRevisionOverloads.qml new file mode 100644 index 0000000000..64acbd1576 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/allowedRevisionOverloads.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyRevisionedLegalOverload +{ +} + diff --git a/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml b/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml new file mode 100644 index 0000000000..28a340128d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml @@ -0,0 +1,28 @@ +import Test 1.0 +MyTypeObject { + flagProperty: "FlagVal1 | FlagVal3" + enumProperty: "EnumVal2" + stringProperty: "Hello World!" + uintProperty: 10 + intProperty: -19 + realProperty: 23.2 + doubleProperty: -19.7 + floatProperty: 8.5 + colorProperty: "red" + dateProperty: "1982-11-25" + timeProperty: "11:11:32" + dateTimeProperty: "2009-05-12T13:22:01" + pointProperty: "99,13" + pointFProperty: "-10.1,12.3" + sizeProperty: "99x13" + sizeFProperty: "0.1x0.2" + rectProperty: "9,7,100x200" + rectFProperty: "1000.1,-10.9,400x90.99" + boolProperty: true + variantProperty: "Hello World!" + vectorProperty: "10,1,2.2" + vector4Property: "10,1,2.2,2.3" + urlProperty: "main.qml?with%3cencoded%3edata" + + objectProperty: MyTypeObject { intProperty: 8 } +} diff --git a/tests/auto/qml/qqmllanguage/data/assignCompositeToType.qml b/tests/auto/qml/qqmllanguage/data/assignCompositeToType.qml new file mode 100644 index 0000000000..717cd84536 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignCompositeToType.qml @@ -0,0 +1,18 @@ +import QtQuick 2.0 +import Test 1.0 + +QtObject { + property QtObject myProperty + property QtObject myProperty2 + property QtObject myProperty3 + property QtObject myProperty4 + property MyQmlObject myProperty5 + property MyQmlObject myProperty6 + + myProperty: CompositeType {} + myProperty2: CompositeType2 {} + myProperty3: CompositeType3 {} + myProperty4: CompositeType4 {} + myProperty5: CompositeType2 {} + myProperty6: CompositeType4 {} +} diff --git a/tests/auto/qml/qqmllanguage/data/assignLiteralSignalProperty.qml b/tests/auto/qml/qqmllanguage/data/assignLiteralSignalProperty.qml new file mode 100644 index 0000000000..399fcea04d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignLiteralSignalProperty.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + onLiteralSignal: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/assignLiteralToVar.qml b/tests/auto/qml/qqmllanguage/data/assignLiteralToVar.qml new file mode 100644 index 0000000000..89e66c6172 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignLiteralToVar.qml @@ -0,0 +1,32 @@ +// This tests assigning literals to "var" properties. +// These properties store JavaScript object references. + +import QtQuick 2.0 + +QtObject { + property var test1: 1 + property var test2: 1.7 + property var test3: "Hello world!" + property var test4: "#FF008800" + property var test5: "10,10,10x10" + property var test6: "10,10" + property var test7: "10x10" + property var test8: "100,100,100" + property var test9: String("#FF008800") + property var test10: true + property var test11: false + + property variant variantTest1Bound: test1 + 4 // 1 + 4 + 4 = 9 + + property var test12: Qt.rgba(0.2, 0.3, 0.4, 0.5) + property var test13: Qt.rect(10, 10, 10, 10) + property var test14: Qt.point(10, 10) + property var test15: Qt.size(10, 10) + property var test16: Qt.vector3d(100, 100, 100) + + property var test1Bound: test1 + 6 // 1 + 4 + 6 = 11 + + Component.onCompleted: { + test1 = test1 + 4; + } +} diff --git a/tests/auto/qml/qqmllanguage/data/assignLiteralToVariant.qml b/tests/auto/qml/qqmllanguage/data/assignLiteralToVariant.qml new file mode 100644 index 0000000000..f6f9a139dc --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignLiteralToVariant.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: 1 + property variant test2: 1.7 + property variant test3: "Hello world!" + property variant test4: "#FF008800" + property variant test5: "10,10,10x10" + property variant test6: "10,10" + property variant test7: "10x10" + property variant test8: "100,100,100" + property variant test9: String("#FF008800") + property variant test10: true + property variant test11: false + property variant test12: "100,100,100,100" +} + diff --git a/tests/auto/qml/qqmllanguage/data/assignObjectToSignal.qml b/tests/auto/qml/qqmllanguage/data/assignObjectToSignal.qml new file mode 100644 index 0000000000..789cc66215 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignObjectToSignal.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + onBasicSignal: MyQmlObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/assignObjectToVariant.qml b/tests/auto/qml/qqmllanguage/data/assignObjectToVariant.qml new file mode 100644 index 0000000000..1f731c539c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignObjectToVariant.qml @@ -0,0 +1,7 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + property variant a; + a: MyQmlObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/assignQmlComponent.qml b/tests/auto/qml/qqmllanguage/data/assignQmlComponent.qml new file mode 100644 index 0000000000..20bdc559c1 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignQmlComponent.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyContainer { + MyComponent { x: 10; y: 11; } +} diff --git a/tests/auto/qml/qqmllanguage/data/assignSignal.qml b/tests/auto/qml/qqmllanguage/data/assignSignal.qml new file mode 100644 index 0000000000..2a48df8fcf --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignSignal.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyQmlObject { + onBasicSignal: basicSlot() + onBasicParameterizedSignal: basicSlotWithArgs(parameter) +} diff --git a/tests/auto/qml/qqmllanguage/data/assignToNamespace.errors.txt b/tests/auto/qml/qqmllanguage/data/assignToNamespace.errors.txt new file mode 100644 index 0000000000..78aa4713fb --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignToNamespace.errors.txt @@ -0,0 +1 @@ +4:5:Invalid use of namespace diff --git a/tests/auto/qml/qqmllanguage/data/assignToNamespace.qml b/tests/auto/qml/qqmllanguage/data/assignToNamespace.qml new file mode 100644 index 0000000000..54fef61ef0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignToNamespace.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 as Qt47 + +Qt47.QtObject { + Qt47: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/assignTypeExtremes.qml b/tests/auto/qml/qqmllanguage/data/assignTypeExtremes.qml new file mode 100644 index 0000000000..60ede525e4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignTypeExtremes.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + uintProperty: 4000000000 + intProperty: -2000000000 +} diff --git a/tests/auto/qml/qqmllanguage/data/assignValueToSignal.errors.txt b/tests/auto/qml/qqmllanguage/data/assignValueToSignal.errors.txt new file mode 100644 index 0000000000..eb1430a715 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignValueToSignal.errors.txt @@ -0,0 +1 @@ +4:5:Cannot assign a value to a signal (expecting a script to be run) diff --git a/tests/auto/qml/qqmllanguage/data/assignValueToSignal.qml b/tests/auto/qml/qqmllanguage/data/assignValueToSignal.qml new file mode 100644 index 0000000000..6fa1259f39 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/assignValueToSignal.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyQmlObject { + onBasicSignal: "hello world" +} + diff --git a/tests/auto/qml/qqmllanguage/data/attachedProperties.qml b/tests/auto/qml/qqmllanguage/data/attachedProperties.qml new file mode 100644 index 0000000000..3637ded26f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/attachedProperties.qml @@ -0,0 +1,8 @@ +import Test 1.0 +import Test 1.0 as Namespace +import QtQuick 2.0 + +QtObject { + MyQmlObject.value: 10 + Namespace.MyQmlObject.value2: 13 +} diff --git a/tests/auto/qml/qqmllanguage/data/autoComponentCreation.qml b/tests/auto/qml/qqmllanguage/data/autoComponentCreation.qml new file mode 100644 index 0000000000..5d00144eaf --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/autoComponentCreation.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyTypeObject { + componentProperty : MyTypeObject { realProperty: 9 } +} diff --git a/tests/auto/qml/qqmllanguage/data/autoNotifyConnection.qml b/tests/auto/qml/qqmllanguage/data/autoNotifyConnection.qml new file mode 100644 index 0000000000..640fb54f99 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/autoNotifyConnection.qml @@ -0,0 +1,6 @@ +import Test 1.0 +MyQmlObject { + property bool receivedNotify : false + onPropertyWithNotifyChanged: { receivedNotify = true; } +} + diff --git a/tests/auto/qml/qqmllanguage/data/component.1.errors.txt b/tests/auto/qml/qqmllanguage/data/component.1.errors.txt new file mode 100644 index 0000000000..091aad61fa --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.1.errors.txt @@ -0,0 +1 @@ +3:1:Cannot create empty component specification diff --git a/tests/auto/qml/qqmllanguage/data/component.1.qml b/tests/auto/qml/qqmllanguage/data/component.1.qml new file mode 100644 index 0000000000..a22772bd89 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.1.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 + +Component { +} diff --git a/tests/auto/qml/qqmllanguage/data/component.2.errors.txt b/tests/auto/qml/qqmllanguage/data/component.2.errors.txt new file mode 100644 index 0000000000..76e7656a62 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.2.errors.txt @@ -0,0 +1 @@ +6:9:id is not unique diff --git a/tests/auto/qml/qqmllanguage/data/component.2.qml b/tests/auto/qml/qqmllanguage/data/component.2.qml new file mode 100644 index 0000000000..fbe315f771 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.2.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +Item { + id: myId + Component { + id: myId + QtObject {} + } +} diff --git a/tests/auto/qml/qqmllanguage/data/component.3.errors.txt b/tests/auto/qml/qqmllanguage/data/component.3.errors.txt new file mode 100644 index 0000000000..450fc163bd --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.3.errors.txt @@ -0,0 +1 @@ +6:9:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/component.3.qml b/tests/auto/qml/qqmllanguage/data/component.3.qml new file mode 100644 index 0000000000..bac23ef903 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.3.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +Item { + Component { + id: myId + id: myId2 + QtObject {} + } +} diff --git a/tests/auto/qml/qqmllanguage/data/component.4.errors.txt b/tests/auto/qml/qqmllanguage/data/component.4.errors.txt new file mode 100644 index 0000000000..2ab18685c8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.4.errors.txt @@ -0,0 +1 @@ +3:1:Invalid component body specification diff --git a/tests/auto/qml/qqmllanguage/data/component.4.qml b/tests/auto/qml/qqmllanguage/data/component.4.qml new file mode 100644 index 0000000000..d07695477d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.4.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +Component { + QtObject {} + QtObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/component.5.errors.txt b/tests/auto/qml/qqmllanguage/data/component.5.errors.txt new file mode 100644 index 0000000000..e3c2df755f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.5.errors.txt @@ -0,0 +1 @@ +4:5:Component elements may not contain properties other than id diff --git a/tests/auto/qml/qqmllanguage/data/component.5.qml b/tests/auto/qml/qqmllanguage/data/component.5.qml new file mode 100644 index 0000000000..9867377bb9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.5.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +Component { + x: 10 + QtObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/component.6.errors.txt b/tests/auto/qml/qqmllanguage/data/component.6.errors.txt new file mode 100644 index 0000000000..2b1c6ca606 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.6.errors.txt @@ -0,0 +1 @@ +4:5:Invalid component id specification diff --git a/tests/auto/qml/qqmllanguage/data/component.6.qml b/tests/auto/qml/qqmllanguage/data/component.6.qml new file mode 100644 index 0000000000..010949a35f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.6.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +Component { + id: QtObject {} + QtObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/component.7.errors.txt b/tests/auto/qml/qqmllanguage/data/component.7.errors.txt new file mode 100644 index 0000000000..b144814a70 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.7.errors.txt @@ -0,0 +1 @@ +3:1:Component objects cannot declare new properties. diff --git a/tests/auto/qml/qqmllanguage/data/component.7.qml b/tests/auto/qml/qqmllanguage/data/component.7.qml new file mode 100644 index 0000000000..b1a31195eb --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.7.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +Component { + property int a + QtObject {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/component.8.errors.txt b/tests/auto/qml/qqmllanguage/data/component.8.errors.txt new file mode 100644 index 0000000000..6f2d0d201d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.8.errors.txt @@ -0,0 +1 @@ +3:1:Component objects cannot declare new signals. diff --git a/tests/auto/qml/qqmllanguage/data/component.8.qml b/tests/auto/qml/qqmllanguage/data/component.8.qml new file mode 100644 index 0000000000..fb7a079d39 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.8.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +Component { + signal a + QtObject {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/component.9.errors.txt b/tests/auto/qml/qqmllanguage/data/component.9.errors.txt new file mode 100644 index 0000000000..92f1456895 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.9.errors.txt @@ -0,0 +1 @@ +3:1:Component objects cannot declare new functions. diff --git a/tests/auto/qml/qqmllanguage/data/component.9.qml b/tests/auto/qml/qqmllanguage/data/component.9.qml new file mode 100644 index 0000000000..17824b4ede --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/component.9.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +Component { + function a() {} + QtObject {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/componentCompositeType.qml b/tests/auto/qml/qqmllanguage/data/componentCompositeType.qml new file mode 100644 index 0000000000..232b320fb0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/componentCompositeType.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + property variant test + + test: ComponentComposite {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/cppnamespace.2.qml b/tests/auto/qml/qqmllanguage/data/cppnamespace.2.qml new file mode 100644 index 0000000000..e3b32ca5d8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/cppnamespace.2.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MySecondNamespacedType { + list: [ MyNamespacedType {} ] +} diff --git a/tests/auto/qml/qqmllanguage/data/cppnamespace.qml b/tests/auto/qml/qqmllanguage/data/cppnamespace.qml new file mode 100644 index 0000000000..e1daf3b78f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/cppnamespace.qml @@ -0,0 +1,4 @@ +import Test 1.0 + +MyNamespacedType { +} diff --git a/tests/auto/qml/qqmllanguage/data/crash2.qml b/tests/auto/qml/qqmllanguage/data/crash2.qml new file mode 100644 index 0000000000..2b8d285348 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/crash2.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + objectName: "Hello" + "World" +} diff --git a/tests/auto/qml/qqmllanguage/data/customOnProperty.qml b/tests/auto/qml/qqmllanguage/data/customOnProperty.qml new file mode 100644 index 0000000000..57241ffc28 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/customOnProperty.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +QtObject { + property int on + + Component.onCompleted: on = 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.errors.txt b/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.errors.txt new file mode 100644 index 0000000000..43a8bb28b3 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.errors.txt @@ -0,0 +1 @@ +4:19:ListElement: cannot use reserved "id" property diff --git a/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.qml b/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.qml new file mode 100644 index 0000000000..c42173ddfb --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 +ListModel { + ListElement { a: 10 } + ListElement { id: foo; a: 12 } +} diff --git a/tests/auto/qml/qqmllanguage/data/customParserTypes.qml b/tests/auto/qml/qqmllanguage/data/customParserTypes.qml new file mode 100644 index 0000000000..76a8a4773f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/customParserTypes.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 +ListModel { + ListElement { a: 10 } + ListElement { a: 12 } +} diff --git a/tests/auto/qml/qqmllanguage/data/customVariantTypes.qml b/tests/auto/qml/qqmllanguage/data/customVariantTypes.qml new file mode 100644 index 0000000000..0263ed20f2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/customVariantTypes.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + customType: "10" +} diff --git a/tests/auto/qml/qqmllanguage/data/declaredPropertyValues.qml b/tests/auto/qml/qqmllanguage/data/declaredPropertyValues.qml new file mode 100644 index 0000000000..03f5c1ff7e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/declaredPropertyValues.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + property int a: 10 + property int b: 10 + a + property QtObject c: QtObject {} + property list<QtObject> d: [ QtObject {}, QtObject {} ] +} diff --git a/tests/auto/qml/qqmllanguage/data/defaultGrouped.errors.txt b/tests/auto/qml/qqmllanguage/data/defaultGrouped.errors.txt new file mode 100644 index 0000000000..32055f6608 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/defaultGrouped.errors.txt @@ -0,0 +1 @@ +7:9:Cannot assign a value directly to a grouped property diff --git a/tests/auto/qml/qqmllanguage/data/defaultGrouped.qml b/tests/auto/qml/qqmllanguage/data/defaultGrouped.qml new file mode 100644 index 0000000000..66a78eb67f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/defaultGrouped.qml @@ -0,0 +1,10 @@ +import Test 1.0 +import QtQuick 2.0 + +MyTypeObject { + grouped { + script: console.log(1921) + QtObject {} + } +} + diff --git a/tests/auto/qml/qqmllanguage/data/defaultPropertyListOrder.qml b/tests/auto/qml/qqmllanguage/data/defaultPropertyListOrder.qml new file mode 100644 index 0000000000..31d17fd55f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/defaultPropertyListOrder.qml @@ -0,0 +1,29 @@ +import Test 1.0 +import QtQuick 2.0 + +MyContainer { + QtObject { + property int index: 0 + } + + QtObject { + property int index: 1 + } + + children: [ + QtObject { + property int index: 2 + }, + QtObject { + property int index: 3 + } + ] + + QtObject { + property int index: 4 + } + + QtObject { + property int index: 5 + } +} diff --git a/tests/auto/qml/qqmllanguage/data/destroyedSignal.errors.txt b/tests/auto/qml/qqmllanguage/data/destroyedSignal.errors.txt new file mode 100644 index 0000000000..3348494a8f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/destroyedSignal.errors.txt @@ -0,0 +1 @@ +4:5:Cannot assign to non-existent property "onDestroyed" diff --git a/tests/auto/qml/qqmllanguage/data/destroyedSignal.qml b/tests/auto/qml/qqmllanguage/data/destroyedSignal.qml new file mode 100644 index 0000000000..b5b29148a2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/destroyedSignal.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + onDestroyed: print("Hello World!") +} diff --git a/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.errors.txt b/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.errors.txt new file mode 100644 index 0000000000..e9b449d8d9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.errors.txt @@ -0,0 +1 @@ +3:1:Type Test/MyRevisionedIllegalOverload 1.0 contains an illegal property "propA". This is an error in the type's implementation. diff --git a/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.qml b/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.qml new file mode 100644 index 0000000000..612bcfe0ea --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyRevisionedIllegalOverload +{ +} + + diff --git a/tests/auto/qml/qqmllanguage/data/dontDoubleCallClassBegin.qml b/tests/auto/qml/qqmllanguage/data/dontDoubleCallClassBegin.qml new file mode 100644 index 0000000000..905ee48e0b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dontDoubleCallClassBegin.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +Item { + property QtObject object: DontDoubleCallClassBeginItem {} +} diff --git a/tests/auto/qml/qqmllanguage/data/doubleSignal.errors.txt b/tests/auto/qml/qqmllanguage/data/doubleSignal.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/doubleSignal.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/doubleSignal.qml b/tests/auto/qml/qqmllanguage/data/doubleSignal.qml new file mode 100644 index 0000000000..fb07b9f659 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/doubleSignal.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyQmlObject { + onBasicSignal: console.log(1921) + onBasicSignal: console.log(1921) +} + diff --git a/tests/auto/qml/qqmllanguage/data/duplicateIDs.errors.txt b/tests/auto/qml/qqmllanguage/data/duplicateIDs.errors.txt new file mode 100644 index 0000000000..66241cf1f2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/duplicateIDs.errors.txt @@ -0,0 +1 @@ +4:19:id is not unique diff --git a/tests/auto/qml/qqmllanguage/data/duplicateIDs.qml b/tests/auto/qml/qqmllanguage/data/duplicateIDs.qml new file mode 100644 index 0000000000..a993abdd37 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/duplicateIDs.qml @@ -0,0 +1,6 @@ +import Test 1.0 +MyContainer { + MyQmlObject { id: myID } + MyQmlObject { id: myID } +} + diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.errors.txt b/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.errors.txt new file mode 100644 index 0000000000..1f9f9169e9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.errors.txt @@ -0,0 +1 @@ +5:5:Duplicate default property diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.qml b/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.qml new file mode 100644 index 0000000000..3dbd5b0b2e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + default property QtObject a + default property QtObject b +} diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.errors.txt b/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.errors.txt new file mode 100644 index 0000000000..713d5f6272 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.errors.txt @@ -0,0 +1 @@ +5:19:Duplicate property name diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.qml b/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.qml new file mode 100644 index 0000000000..5d4efeebb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + property int a + property bool a +} diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.errors.txt b/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.errors.txt new file mode 100644 index 0000000000..8226c16a1e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.errors.txt @@ -0,0 +1 @@ +5:12:Duplicate signal name diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.qml b/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.qml new file mode 100644 index 0000000000..f084947eaf --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + signal a + signal a +} diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.errors.txt b/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.errors.txt new file mode 100644 index 0000000000..028e25c37f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.errors.txt @@ -0,0 +1 @@ +5:14:Duplicate method name diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.qml b/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.qml new file mode 100644 index 0000000000..3691529aa9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + function a() {} + function a() {} +} diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.errors.txt b/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.errors.txt new file mode 100644 index 0000000000..015d55b03b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.errors.txt @@ -0,0 +1 @@ +3:1:UnknownType is not a type diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.qml b/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.qml new file mode 100644 index 0000000000..64ba907415 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property UnknownType a +} diff --git a/tests/auto/qml/qqmllanguage/data/dynamicObject.1.qml b/tests/auto/qml/qqmllanguage/data/dynamicObject.1.qml new file mode 100644 index 0000000000..2214bacda0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicObject.1.qml @@ -0,0 +1,8 @@ +import Test 1.0 +import QtQuick 2.0 +MyCustomParserType { + propa: a + 10 + propb: Math.min(a, 10) + propc: MyPropertyValueSource {} + onPropA: a +} diff --git a/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml new file mode 100644 index 0000000000..6f822ba157 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick 2.0 as Qt47 + +Qt.QtObject { + property Qt47.QtObject objectProperty + property list<Qt47.QtObject> objectPropertyList + + objectProperty: QtObject {} + objectPropertyList: QtObject {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.qml b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.qml new file mode 100644 index 0000000000..5d072b160a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.qml @@ -0,0 +1,13 @@ +import Test 1.0 +import QtQuick 2.0 +import QtQuick 2.0 as Qt47 + +QtObject { + property QtObject objectProperty + property QtObject objectProperty2 + objectProperty2: QtObject {} + + property MyComponent myComponentProperty + property MyComponent myComponentProperty2 + myComponentProperty2: MyComponent {} +} diff --git a/tests/auto/qml/qqmllanguage/data/dynamicProperties.qml b/tests/auto/qml/qqmllanguage/data/dynamicProperties.qml new file mode 100644 index 0000000000..cd403b3d46 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicProperties.qml @@ -0,0 +1,13 @@ +import Test 1.0 +import QtQuick 2.0 +QtObject { + default property int intProperty : 10 + property bool boolProperty: false + property double doubleProperty: -10.1 + property real realProperty: -19.9 + property string stringProperty: "Hello World!" + property color colorProperty: "red" + property url urlProperty: "main.qml" + property date dateProperty: "1945-09-02" + property variant varProperty: "Hello World!" +} diff --git a/tests/auto/qml/qqmllanguage/data/dynamicPropertiesNested.qml b/tests/auto/qml/qqmllanguage/data/dynamicPropertiesNested.qml new file mode 100644 index 0000000000..b86e89b5e7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicPropertiesNested.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +DynamicPropertiesNestedType { + property int a: 13 + property int b: 12 + + super_a: 11 +} + diff --git a/tests/auto/qml/qqmllanguage/data/dynamicSignalsAndSlots.qml b/tests/auto/qml/qqmllanguage/data/dynamicSignalsAndSlots.qml new file mode 100644 index 0000000000..d80d94be09 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/dynamicSignalsAndSlots.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +QtObject { + signal signal1 + function slot1() {} + signal signal2 + function slot2() {} + + property int test: 0 + function slot3(a) { console.log(1921); test = a; } +} diff --git a/tests/auto/qml/qqmllanguage/data/empty.errors.txt b/tests/auto/qml/qqmllanguage/data/empty.errors.txt new file mode 100644 index 0000000000..620db2bbba --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/empty.errors.txt @@ -0,0 +1,2 @@ +1:1:Expected token `numeric literal' +1:1:Expected a qualified name id diff --git a/tests/auto/qml/qqmllanguage/data/empty.qml b/tests/auto/qml/qqmllanguage/data/empty.qml new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/empty.qml diff --git a/tests/auto/qml/qqmllanguage/data/emptySignal.errors.txt b/tests/auto/qml/qqmllanguage/data/emptySignal.errors.txt new file mode 100644 index 0000000000..8b20434973 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/emptySignal.errors.txt @@ -0,0 +1 @@ +4:5:Incorrectly specified signal assignment diff --git a/tests/auto/qml/qqmllanguage/data/emptySignal.qml b/tests/auto/qml/qqmllanguage/data/emptySignal.qml new file mode 100644 index 0000000000..c84fea3fe6 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/emptySignal.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyQmlObject { + onBasicSignal { + } +} + diff --git a/tests/auto/qml/qqmllanguage/data/enumTypes.errors.txt b/tests/auto/qml/qqmllanguage/data/enumTypes.errors.txt new file mode 100644 index 0000000000..d4e0cc0bc4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/enumTypes.errors.txt @@ -0,0 +1 @@ +3:1:Element is not creatable. diff --git a/tests/auto/qml/qqmllanguage/data/enumTypes.qml b/tests/auto/qml/qqmllanguage/data/enumTypes.qml new file mode 100644 index 0000000000..ff083250f0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/enumTypes.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 + +Font { +} diff --git a/tests/auto/qml/qqmllanguage/data/failingComponent.errors.txt b/tests/auto/qml/qqmllanguage/data/failingComponent.errors.txt new file mode 100644 index 0000000000..364ca6747f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/failingComponent.errors.txt @@ -0,0 +1 @@ +3:5:FailingComponent is not a type diff --git a/tests/auto/qml/qqmllanguage/data/failingComponentTest.qml b/tests/auto/qml/qqmllanguage/data/failingComponentTest.qml new file mode 100644 index 0000000000..74a6acfc49 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/failingComponentTest.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyContainer { + FailingComponent {} +} diff --git a/tests/auto/qml/qqmllanguage/data/fakeDotProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/fakeDotProperty.errors.txt new file mode 100644 index 0000000000..30748234bc --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/fakeDotProperty.errors.txt @@ -0,0 +1 @@ +3:5:Invalid grouped property access diff --git a/tests/auto/qml/qqmllanguage/data/fakeDotProperty.qml b/tests/auto/qml/qqmllanguage/data/fakeDotProperty.qml new file mode 100644 index 0000000000..d971eee4d0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/fakeDotProperty.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + value.something: "hello" +} diff --git a/tests/auto/qml/qqmllanguage/data/finalOverride.errors.txt b/tests/auto/qml/qqmllanguage/data/finalOverride.errors.txt new file mode 100644 index 0000000000..49e06cbdf5 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/finalOverride.errors.txt @@ -0,0 +1 @@ +3:5:Cannot override FINAL property diff --git a/tests/auto/qml/qqmllanguage/data/finalOverride.qml b/tests/auto/qml/qqmllanguage/data/finalOverride.qml new file mode 100644 index 0000000000..a84393af94 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/finalOverride.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + property int value: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyNames.qml b/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyNames.qml new file mode 100644 index 0000000000..558c836e52 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyNames.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + property int áâãäå: 10 + stringProperty: "Test áâãäå: " + áâãäå +} diff --git a/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyUse.qml b/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyUse.qml new file mode 100644 index 0000000000..74918e2764 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyUse.qml @@ -0,0 +1,3 @@ +I18n { + áâãäå: 15 +} diff --git a/tests/auto/qml/qqmllanguage/data/i18nNameSpace.qml b/tests/auto/qml/qqmllanguage/data/i18nNameSpace.qml new file mode 100644 index 0000000000..c0b2f94857 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/i18nNameSpace.qml @@ -0,0 +1,5 @@ +import Test 1.0 as Áâãäå + +Áâãäå.MyTypeObject { + stringProperty: "Test áâãäå: 40" +} diff --git a/tests/auto/qml/qqmllanguage/data/i18nScript.qml b/tests/auto/qml/qqmllanguage/data/i18nScript.qml new file mode 100644 index 0000000000..e77cb52074 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/i18nScript.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + function val() { + var áâãäå = 20 + return "Test áâãäå: " + áâãäå + } + stringProperty: val() +} diff --git a/tests/auto/qml/qqmllanguage/data/i18nStrings.qml b/tests/auto/qml/qqmllanguage/data/i18nStrings.qml new file mode 100644 index 0000000000..764c92639a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/i18nStrings.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + stringProperty: "Test áâãäå (5 accented 'a' letters)" +} diff --git a/tests/auto/qml/qqmllanguage/data/i18nType.qml b/tests/auto/qml/qqmllanguage/data/i18nType.qml new file mode 100644 index 0000000000..d7954ef718 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/i18nType.qml @@ -0,0 +1 @@ +I18nTypeÁâãäå { } diff --git a/tests/auto/qml/qqmllanguage/data/idProperty.qml b/tests/auto/qml/qqmllanguage/data/idProperty.qml new file mode 100644 index 0000000000..bf048ea60a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/idProperty.qml @@ -0,0 +1,8 @@ +import Test 1.0 +MyContainer { + property variant object : myObjectId + + MyTypeObject { + id: "myObjectId" + } +} diff --git a/tests/auto/qml/qqmllanguage/data/importFile.errors.txt b/tests/auto/qml/qqmllanguage/data/importFile.errors.txt new file mode 100644 index 0000000000..3fdac0921e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importFile.errors.txt @@ -0,0 +1 @@ +1:1:"MyComponent.qml": no such directory diff --git a/tests/auto/qml/qqmllanguage/data/importFile.qml b/tests/auto/qml/qqmllanguage/data/importFile.qml new file mode 100644 index 0000000000..a0d8410ca3 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importFile.qml @@ -0,0 +1,3 @@ +import "MyComponent.qml" 1.0 + +MyComponent { text: "Hello" } diff --git a/tests/auto/qml/qqmllanguage/data/importIncorrectCase.qml b/tests/auto/qml/qqmllanguage/data/importIncorrectCase.qml new file mode 100644 index 0000000000..804e76b932 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importIncorrectCase.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 +import com.Nokia.installedtest 1.0 + +QtObject { +} diff --git a/tests/auto/qml/qqmllanguage/data/importJs.1.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.1.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.1.errors.txt diff --git a/tests/auto/qml/qqmllanguage/data/importJs.1.qml b/tests/auto/qml/qqmllanguage/data/importJs.1.qml new file mode 100644 index 0000000000..eaba98ecd2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.1.qml @@ -0,0 +1,12 @@ +import com.nokia.PureJsModule 1.0 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((FirstAPI.greeting() == "Hello") && + (FirstAPI.major == 1) && + (FirstAPI.minor == 0)) + } +} diff --git a/tests/auto/qml/qqmllanguage/data/importJs.10.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.10.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.10.errors.txt diff --git a/tests/auto/qml/qqmllanguage/data/importJs.10.qml b/tests/auto/qml/qqmllanguage/data/importJs.10.qml new file mode 100644 index 0000000000..578ca47ea5 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.10.qml @@ -0,0 +1,16 @@ +import com.nokia.PureJsModule 1.0 as PJM +import com.nokia.PureJsModule 1.0 as AnotherName +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((PJM.FirstAPI.greeting() == "Hello") && + (PJM.FirstAPI.major == 1) && + (PJM.FirstAPI.minor == 0) && + (AnotherName.FirstAPI.greeting() == "Hello") && + (AnotherName.FirstAPI.major == 1) && + (AnotherName.FirstAPI.minor == 0)) + } +} diff --git a/tests/auto/qml/qqmllanguage/data/importJs.2.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.2.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.2.errors.txt diff --git a/tests/auto/qml/qqmllanguage/data/importJs.2.qml b/tests/auto/qml/qqmllanguage/data/importJs.2.qml new file mode 100644 index 0000000000..dd3d65c5dd --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.2.qml @@ -0,0 +1,12 @@ +import com.nokia.VersionedOnlyJsModule 9.0 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((SomeAPI.greeting() == "Hey hey hey") && + (SomeAPI.major == 9) && + (SomeAPI.minor == 0)) + } +} diff --git a/tests/auto/qml/qqmllanguage/data/importJs.3.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.3.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.3.errors.txt diff --git a/tests/auto/qml/qqmllanguage/data/importJs.3.qml b/tests/auto/qml/qqmllanguage/data/importJs.3.qml new file mode 100644 index 0000000000..f59d445a56 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.3.qml @@ -0,0 +1,16 @@ +import com.nokia.PureJsModule 1.0 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((FirstAPI.greeting() == "Hello") && + (FirstAPI.major == 1) && + (FirstAPI.minor == 0) && + (SecondAPI.greeting() == "Howdy") && + (SecondAPI.major == 1) && + (SecondAPI.minor == 5)) + + } +} diff --git a/tests/auto/qml/qqmllanguage/data/importJs.4.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.4.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.4.errors.txt diff --git a/tests/auto/qml/qqmllanguage/data/importJs.4.qml b/tests/auto/qml/qqmllanguage/data/importJs.4.qml new file mode 100644 index 0000000000..e7b74bac0a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.4.qml @@ -0,0 +1,15 @@ +import com.nokia.PureJsModule 1.6 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((FirstAPI.greeting() == "Good news, everybody!") && + (FirstAPI.major == 1) && + (FirstAPI.minor == 6) && + (SecondAPI.greeting() == "Howdy") && + (SecondAPI.major == 1) && + (SecondAPI.minor == 5)) + } +} diff --git a/tests/auto/qml/qqmllanguage/data/importJs.5.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.5.errors.txt new file mode 100644 index 0000000000..10dbc80297 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.5.errors.txt @@ -0,0 +1 @@ +1:1:module "com.nokia.VersionedOnlyJsModule" is not installed diff --git a/tests/auto/qml/qqmllanguage/data/importJs.5.qml b/tests/auto/qml/qqmllanguage/data/importJs.5.qml new file mode 100644 index 0000000000..a9ec20c72b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.5.qml @@ -0,0 +1,6 @@ +import com.nokia.VersionedOnlyJsModule 1.0 +import QtQuick 2.0 + +Item { + property bool test: false +} diff --git a/tests/auto/qml/qqmllanguage/data/importJs.6.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.6.errors.txt new file mode 100644 index 0000000000..41c99702a2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.6.errors.txt @@ -0,0 +1 @@ +2:1:"com.nokia.VersionedOnlyJsModule" is ambiguous. diff --git a/tests/auto/qml/qqmllanguage/data/importJs.6.qml b/tests/auto/qml/qqmllanguage/data/importJs.6.qml new file mode 100644 index 0000000000..6c4eb89551 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.6.qml @@ -0,0 +1,13 @@ +import com.nokia.VersionedOnlyJsModule 9.0 +import com.nokia.VersionedOnlyJsModule 9.0 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((SomeAPI.greeting() == "Hey hey hey") && + (SomeAPI.major == 9) && + (SomeAPI.minor == 0)) + } +} diff --git a/tests/auto/qml/qqmllanguage/data/importJs.7.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.7.errors.txt new file mode 100644 index 0000000000..56bc4c548f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.7.errors.txt @@ -0,0 +1 @@ +2:1:"com.nokia.PureJsModule" is ambiguous. diff --git a/tests/auto/qml/qqmllanguage/data/importJs.7.qml b/tests/auto/qml/qqmllanguage/data/importJs.7.qml new file mode 100644 index 0000000000..5523a158bd --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.7.qml @@ -0,0 +1,13 @@ +import com.nokia.PureJsModule 1.0 +import com.nokia.PureJsModule 1.6 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((FirstAPI.greeting() == "Hello") && + (FirstAPI.major == 1) && + (FirstAPI.minor == 0)) + } +} diff --git a/tests/auto/qml/qqmllanguage/data/importJs.8.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.8.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.8.errors.txt diff --git a/tests/auto/qml/qqmllanguage/data/importJs.8.qml b/tests/auto/qml/qqmllanguage/data/importJs.8.qml new file mode 100644 index 0000000000..4ddedc31a8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.8.qml @@ -0,0 +1,15 @@ +import com.nokia.PureJsModule 1.5 as PJM +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((PJM.FirstAPI.greeting() == "Hello") && + (PJM.FirstAPI.major == 1) && + (PJM.FirstAPI.minor == 0) && + (PJM.SecondAPI.greeting() == "Howdy") && + (PJM.SecondAPI.major == 1) && + (PJM.SecondAPI.minor == 5)) + } +} diff --git a/tests/auto/qml/qqmllanguage/data/importJs.9.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.9.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.9.errors.txt diff --git a/tests/auto/qml/qqmllanguage/data/importJs.9.qml b/tests/auto/qml/qqmllanguage/data/importJs.9.qml new file mode 100644 index 0000000000..351164ba41 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importJs.9.qml @@ -0,0 +1,19 @@ +import com.nokia.PureJsModule 1.5 as PJM_1_5 +import com.nokia.PureJsModule 1.6 as PJM_1_6 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((PJM_1_5.FirstAPI.greeting() == "Hello") && + (PJM_1_5.FirstAPI.major == 1) && + (PJM_1_5.FirstAPI.minor == 0) && + (PJM_1_5.SecondAPI.greeting() == "Howdy") && + (PJM_1_5.SecondAPI.major == 1) && + (PJM_1_5.SecondAPI.minor == 5) && + (PJM_1_6.FirstAPI.greeting() == "Good news, everybody!") && + (PJM_1_6.FirstAPI.major == 1) && + (PJM_1_6.FirstAPI.minor == 6)) + } +} diff --git a/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.errors.txt b/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.errors.txt new file mode 100644 index 0000000000..231998daf7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.errors.txt @@ -0,0 +1 @@ +4:1:Namespace Rectangle cannot be used as a type diff --git a/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.qml b/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.qml new file mode 100644 index 0000000000..45ad40501b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.qml @@ -0,0 +1,4 @@ +import Test 1.0 as Rectangle +import QtQuick 2.0 + +Rectangle { } diff --git a/tests/auto/qml/qqmllanguage/data/importNewerVersion.errors.txt b/tests/auto/qml/qqmllanguage/data/importNewerVersion.errors.txt new file mode 100644 index 0000000000..413f096384 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importNewerVersion.errors.txt @@ -0,0 +1 @@ +1:1:module "Test" version 2.0 is not installed diff --git a/tests/auto/qml/qqmllanguage/data/importNewerVersion.qml b/tests/auto/qml/qqmllanguage/data/importNewerVersion.qml new file mode 100644 index 0000000000..c4a0d386a4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importNewerVersion.qml @@ -0,0 +1,3 @@ +import Test 2.0 + +MyTypeObject { } diff --git a/tests/auto/qml/qqmllanguage/data/importNonExist.errors.txt b/tests/auto/qml/qqmllanguage/data/importNonExist.errors.txt new file mode 100644 index 0000000000..1baf05cee0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importNonExist.errors.txt @@ -0,0 +1 @@ +2:1:"will-not-be-found": no such directory diff --git a/tests/auto/qml/qqmllanguage/data/importNonExist.qml b/tests/auto/qml/qqmllanguage/data/importNonExist.qml new file mode 100644 index 0000000000..5cbee0264b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importNonExist.qml @@ -0,0 +1,5 @@ +// imports... +import "will-not-be-found" +import QtQuick 2.0 + +Rectangle { } diff --git a/tests/auto/qml/qqmllanguage/data/importNonExistOlder.errors.txt b/tests/auto/qml/qqmllanguage/data/importNonExistOlder.errors.txt new file mode 100644 index 0000000000..dfa7a369ff --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importNonExistOlder.errors.txt @@ -0,0 +1 @@ +1:1:module "Test" version 0.1 is not installed diff --git a/tests/auto/qml/qqmllanguage/data/importNonExistOlder.qml b/tests/auto/qml/qqmllanguage/data/importNonExistOlder.qml new file mode 100644 index 0000000000..18514b1efa --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importNonExistOlder.qml @@ -0,0 +1,3 @@ +import Test 0.1 + +MyTypeObject { } diff --git a/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.errors.txt b/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.errors.txt new file mode 100644 index 0000000000..c7d880e79e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.errors.txt @@ -0,0 +1 @@ +1:16:Library import requires a version diff --git a/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.qml b/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.qml new file mode 100644 index 0000000000..23ed566e15 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.qml @@ -0,0 +1,7 @@ +import Test as S + +S.MyQmlObject { + property real x; + property real y; +} + diff --git a/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.errors.txt b/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.errors.txt new file mode 100644 index 0000000000..89e58ee764 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.errors.txt @@ -0,0 +1 @@ +1:35:Library import requires a version diff --git a/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.qml b/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.qml new file mode 100644 index 0000000000..97ec22280f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.qml @@ -0,0 +1,3 @@ +import com.nokia.installedtest as T + +T.InstalledTest {} diff --git a/tests/auto/qml/qqmllanguage/data/importscript.1.errors.txt b/tests/auto/qml/qqmllanguage/data/importscript.1.errors.txt new file mode 100644 index 0000000000..ebc936d153 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importscript.1.errors.txt @@ -0,0 +1 @@ +1:8:Script import requires a qualifier diff --git a/tests/auto/qml/qqmllanguage/data/importscript.1.qml b/tests/auto/qml/qqmllanguage/data/importscript.1.qml new file mode 100644 index 0000000000..2b2ab6ba0d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/importscript.1.qml @@ -0,0 +1,3 @@ +import "test.js" + +Item { } diff --git a/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.insensitive.txt b/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.insensitive.txt new file mode 100644 index 0000000000..3813680562 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.insensitive.txt @@ -0,0 +1,2 @@ +3:1:Type IncorrectCaseType unavailable +-1:-1:File name case mismatch diff --git a/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.sensitive.txt b/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.sensitive.txt new file mode 100644 index 0000000000..abed1a73f5 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.sensitive.txt @@ -0,0 +1 @@ +3:1:IncorrectCaseType is not a type diff --git a/tests/auto/qml/qqmllanguage/data/incorrectCase.qml b/tests/auto/qml/qqmllanguage/data/incorrectCase.qml new file mode 100644 index 0000000000..15b6dc3a6e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/incorrectCase.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 + +IncorrectCaseType { +} diff --git a/tests/auto/qml/qqmllanguage/data/incorrectCaseType.qml b/tests/auto/qml/qqmllanguage/data/incorrectCaseType.qml new file mode 100644 index 0000000000..addc4265a9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/incorrectCaseType.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 + +QtObject { +} diff --git a/tests/auto/qml/qqmllanguage/data/inlineAssignmentsOverrideBindings.qml b/tests/auto/qml/qqmllanguage/data/inlineAssignmentsOverrideBindings.qml new file mode 100644 index 0000000000..4390d22d45 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/inlineAssignmentsOverrideBindings.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +InlineAssignmentsOverrideBindingsType { + property int test: nested.value + nested.value: 11 +} diff --git a/tests/auto/qml/qqmllanguage/data/inlineQmlComponents.qml b/tests/auto/qml/qqmllanguage/data/inlineQmlComponents.qml new file mode 100644 index 0000000000..a6f277adb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/inlineQmlComponents.qml @@ -0,0 +1,10 @@ +import Test 1.0 +import QtQuick 2.0 +MyContainer { + Component { + id: myComponent + MyQmlObject { + value: 11 + } + } +} diff --git a/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.errors.txt b/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.errors.txt new file mode 100644 index 0000000000..651009cf05 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.errors.txt @@ -0,0 +1 @@ +9:5:Expected a qualified name id diff --git a/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.qml b/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.qml new file mode 100644 index 0000000000..4e561b48b2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.qml @@ -0,0 +1,10 @@ +import Test 1.0 + +MyQmlObject { + function foo() + { + return + } + + 1223 +} diff --git a/tests/auto/qml/qqmllanguage/data/interfaceProperty.qml b/tests/auto/qml/qqmllanguage/data/interfaceProperty.qml new file mode 100644 index 0000000000..f85e3e4e5b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/interfaceProperty.qml @@ -0,0 +1,5 @@ +import Test 1.0 +import QtQuick 2.0 +MyQmlObject { + interfaceProperty: MyQmlObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/interfaceQList.qml b/tests/auto/qml/qqmllanguage/data/interfaceQList.qml new file mode 100644 index 0000000000..c87dfae785 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/interfaceQList.qml @@ -0,0 +1,7 @@ +import Test 1.0 +MyContainer { + qlistInterfaces: [ + MyQmlObject {}, + MyQmlObject {} + ] +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.1.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.1.errors.txt new file mode 100644 index 0000000000..9848e48579 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.1.errors.txt @@ -0,0 +1 @@ +3:1:No property alias location diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.1.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.1.qml new file mode 100644 index 0000000000..8aab61e49e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.1.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property alias a +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.10.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.10.errors.txt new file mode 100644 index 0000000000..93652a7042 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.10.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias location diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.10.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.10.qml new file mode 100644 index 0000000000..3ff7b16fd8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.10.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.rectProperty.blah +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.2.errors.txt new file mode 100644 index 0000000000..3e15628a13 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.2.errors.txt @@ -0,0 +1 @@ +4:23:Invalid alias location diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.2.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.2.qml new file mode 100644 index 0000000000..b85b2584eb --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.2.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + property alias a: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.3.errors.txt new file mode 100644 index 0000000000..fbf1b580e2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.3.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias reference. An alias reference must be specified as <id>, <id>.<property> or <id>.<value property>.<property> diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.3.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.3.qml new file mode 100644 index 0000000000..a363373734 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.3.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.rectProperty.x.y +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.4.errors.txt new file mode 100644 index 0000000000..fbf1b580e2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.4.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias reference. An alias reference must be specified as <id>, <id>.<property> or <id>.<value property>.<property> diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.4.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.4.qml new file mode 100644 index 0000000000..cfdfca0590 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.4.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: print("Hello!") +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.5.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.5.errors.txt new file mode 100644 index 0000000000..6f78e599d4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.5.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias reference. Unable to find id "otherroot" diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.5.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.5.qml new file mode 100644 index 0000000000..0c1d5d7ef1 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.5.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: otherroot +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.6.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.6.errors.txt new file mode 100644 index 0000000000..93652a7042 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.6.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias location diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.6.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.6.qml new file mode 100644 index 0000000000..edfdb24bcc --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.6.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.foobar +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.7.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.7.errors.txt new file mode 100644 index 0000000000..93652a7042 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.7.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias location diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.7.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.7.qml new file mode 100644 index 0000000000..2a09648d57 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.7.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.nonScriptable +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.8.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.8.errors.txt new file mode 100644 index 0000000000..93652a7042 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.8.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias location diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.8.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.8.qml new file mode 100644 index 0000000000..4faa52d250 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.8.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.imaginary.x +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.9.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.9.errors.txt new file mode 100644 index 0000000000..93652a7042 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.9.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias location diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.9.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.9.qml new file mode 100644 index 0000000000..f1839127b0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.9.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.floatProperty.x +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.errors.txt new file mode 100644 index 0000000000..492bbb48fa --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.errors.txt @@ -0,0 +1 @@ +5:17:Cannot assign to non-existent property "foo" diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.qml new file mode 100644 index 0000000000..20864b9a41 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.qml @@ -0,0 +1,7 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + MyQmlObject.foo: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.errors.txt new file mode 100644 index 0000000000..ff2409bd2d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.errors.txt @@ -0,0 +1 @@ +5:15:Non-existent attached object diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.qml new file mode 100644 index 0000000000..20906de606 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.qml @@ -0,0 +1,6 @@ +import Test 1.0 as Namespace +import QtQuick 2.0 + +QtObject { + Namespace.MadeUpClass.foo: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.errors.txt new file mode 100644 index 0000000000..fee5050743 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.errors.txt @@ -0,0 +1 @@ +5:15:Not an attached property name diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.qml new file mode 100644 index 0000000000..95add15147 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.qml @@ -0,0 +1,7 @@ +import Test 1.0 as Namespace +import QtQuick 2.0 + +QtObject { + Namespace.madeUpClass.foo: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.errors.txt new file mode 100644 index 0000000000..189a795837 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.errors.txt @@ -0,0 +1 @@ +4:13:Attached properties cannot be used here diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.qml new file mode 100644 index 0000000000..7de503e766 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + grouped.MyQmlObject.value: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.errors.txt new file mode 100644 index 0000000000..46d7be2ac3 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.errors.txt @@ -0,0 +1 @@ +5:9:Attached properties cannot be used here diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.qml new file mode 100644 index 0000000000..986ab855c5 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + grouped { + MyQmlObject.value: 10 + } +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.errors.txt new file mode 100644 index 0000000000..34de769e13 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.errors.txt @@ -0,0 +1 @@ +5:27:Cannot assign to non-existent property "foo" diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.qml new file mode 100644 index 0000000000..050e619ff2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.qml @@ -0,0 +1,6 @@ +import Test 1.0 as Namespace +import QtQuick 2.0 + +QtObject { + Namespace.MyQmlObject.foo: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.errors.txt new file mode 100644 index 0000000000..05161c4d10 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.errors.txt @@ -0,0 +1 @@ +5:5:Invalid attached object assignment diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.qml new file mode 100644 index 0000000000..24b09a53d5 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.qml @@ -0,0 +1,8 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + MyQmlObject: 10 +} + + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.errors.txt new file mode 100644 index 0000000000..a208bcfaa7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.errors.txt @@ -0,0 +1 @@ +5:15:Invalid attached object assignment diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.qml new file mode 100644 index 0000000000..fb38ee9536 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.qml @@ -0,0 +1,7 @@ +import Test 1.0 as Namespace +import QtQuick 2.0 + +QtObject { + Namespace.MyQmlObject: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.errors.txt new file mode 100644 index 0000000000..05161c4d10 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.errors.txt @@ -0,0 +1 @@ +5:5:Invalid attached object assignment diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.qml new file mode 100644 index 0000000000..789e42f7ef --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.qml @@ -0,0 +1,7 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + MyQmlObject: QtObject {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.errors.txt new file mode 100644 index 0000000000..6770e1f30b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.errors.txt @@ -0,0 +1 @@ +5:5:Non-existent attached object diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.qml new file mode 100644 index 0000000000..9060a55d00 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.qml @@ -0,0 +1,7 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + Test.MyQmlObject: QtObject {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.errors.txt new file mode 100644 index 0000000000..6770e1f30b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.errors.txt @@ -0,0 +1 @@ +5:5:Non-existent attached object diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.qml new file mode 100644 index 0000000000..47b6cc37d8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.qml @@ -0,0 +1,6 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + MyTypeObject.foo: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.errors.txt new file mode 100644 index 0000000000..ff2409bd2d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.errors.txt @@ -0,0 +1 @@ +5:15:Non-existent attached object diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.qml new file mode 100644 index 0000000000..146934f7ac --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.qml @@ -0,0 +1,6 @@ +import Test 1.0 as Namespace +import QtQuick 2.0 + +QtObject { + Namespace.MyTypeObject.foo: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.errors.txt new file mode 100644 index 0000000000..6770e1f30b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.errors.txt @@ -0,0 +1 @@ +5:5:Non-existent attached object diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.qml new file mode 100644 index 0000000000..73724aa6e7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.qml @@ -0,0 +1,7 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + MadeUpClass.foo: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt new file mode 100644 index 0000000000..810fd31b41 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt @@ -0,0 +1 @@ +5:5:Invalid grouped property access diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.qml new file mode 100644 index 0000000000..fa46b8242a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + property variant o; + o.blah: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.errors.txt new file mode 100644 index 0000000000..1fcb1b65f5 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.errors.txt @@ -0,0 +1 @@ +4:14:Cannot assign a value directly to a grouped property diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.qml new file mode 100644 index 0000000000..41aa3e2923 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + grouped: "10x10" + grouped.value: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.errors.txt new file mode 100644 index 0000000000..810fd31b41 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.errors.txt @@ -0,0 +1 @@ +5:5:Invalid grouped property access diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.qml new file mode 100644 index 0000000000..3e516738d6 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +QtObject { + property int o; + o.blah: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt new file mode 100644 index 0000000000..f6d6f29fbf --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt @@ -0,0 +1 @@ +4:5:Invalid grouped property access diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.qml new file mode 100644 index 0000000000..0bbfc4f529 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyQmlObject { + customType.x: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.errors.txt new file mode 100644 index 0000000000..69c68716d9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.errors.txt @@ -0,0 +1 @@ +4:5:Cannot assign to non-existent property "foo" diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.qml new file mode 100644 index 0000000000..134fef9b0a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyQmlObject { + foo.x: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.errors.txt new file mode 100644 index 0000000000..2c8a970da7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.errors.txt @@ -0,0 +1 @@ +4:18:Property assignment expected diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.qml new file mode 100644 index 0000000000..55cefe66b9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + rectProperty.x.foo: 100 +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.qml new file mode 100644 index 0000000000..9ec33abe7b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + rectProperty.x: 100 + rectProperty.x: 101 +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt new file mode 100644 index 0000000000..4a7e3830a8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt @@ -0,0 +1 @@ +4:-1:Cannot set properties on nullGrouped as it is null diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.qml new file mode 100644 index 0000000000..977539a357 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + nullGrouped.script: console.log(1921) +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.errors.txt new file mode 100644 index 0000000000..fa0da21c55 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.errors.txt @@ -0,0 +1 @@ +5:19:Property has already been assigned a value diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.qml new file mode 100644 index 0000000000..56fca9b990 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + pointProperty: "10x10" + pointProperty.x: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.errors.txt new file mode 100644 index 0000000000..6d837a7222 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.errors.txt @@ -0,0 +1 @@ +5:20:Property has already been assigned a value diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.qml new file mode 100644 index 0000000000..982ab26051 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + pointProperty.x: 10 + pointProperty: "10x10" +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.2.errors.txt new file mode 100644 index 0000000000..2c6b8bf0f3 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.2.errors.txt @@ -0,0 +1,2 @@ +3:9:Invalid empty ID + diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.2.qml b/tests/auto/qml/qqmllanguage/data/invalidID.2.qml new file mode 100644 index 0000000000..4fb3b298dd --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.2.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyQmlObject { + id: "" +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.3.errors.txt new file mode 100644 index 0000000000..bb811cfe9d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.3.errors.txt @@ -0,0 +1 @@ +3:5:Invalid use of id property diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.3.qml b/tests/auto/qml/qqmllanguage/data/invalidID.3.qml new file mode 100644 index 0000000000..668417286b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.3.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyQmlObject { + id.other: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.4.errors.txt new file mode 100644 index 0000000000..c721fe91bf --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.4.errors.txt @@ -0,0 +1 @@ +4:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.4.qml b/tests/auto/qml/qqmllanguage/data/invalidID.4.qml new file mode 100644 index 0000000000..86010bf792 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.4.qml @@ -0,0 +1,6 @@ +import Test 1.0 +MyQmlObject { + id: hello + id: world +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.5.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.5.errors.txt new file mode 100644 index 0000000000..c167de382e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.5.errors.txt @@ -0,0 +1 @@ +2:20:Invalid import qualifier ID diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.5.qml b/tests/auto/qml/qqmllanguage/data/invalidID.5.qml new file mode 100644 index 0000000000..5b92a1a0eb --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.5.qml @@ -0,0 +1,6 @@ +import Test 1.0 +import Test 1.0 as hello +MyQmlObject { + id: hello +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.6.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.6.errors.txt new file mode 100644 index 0000000000..7251de118f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.6.errors.txt @@ -0,0 +1 @@ +3:9:IDs cannot start with an uppercase letter diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.6.qml b/tests/auto/qml/qqmllanguage/data/invalidID.6.qml new file mode 100644 index 0000000000..62187d9473 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.6.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyQmlObject { + id: StartsWithUpperCase +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.7.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.7.errors.txt new file mode 100644 index 0000000000..e4fd1db3f0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.7.errors.txt @@ -0,0 +1 @@ +3:9:ID illegally masks global JavaScript property diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.7.qml b/tests/auto/qml/qqmllanguage/data/invalidID.7.qml new file mode 100644 index 0000000000..d4bc539650 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.7.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyQmlObject { + id: gc +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.8.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.8.errors.txt new file mode 100644 index 0000000000..b03ec6ccea --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.8.errors.txt @@ -0,0 +1 @@ +3:9:IDs must contain only letters, numbers, and underscores diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.8.qml b/tests/auto/qml/qqmllanguage/data/invalidID.8.qml new file mode 100644 index 0000000000..1ea615c32e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.8.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyQmlObject { + id: hello.world +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.9.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.9.errors.txt new file mode 100644 index 0000000000..c010e79492 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.9.errors.txt @@ -0,0 +1 @@ +3:9:IDs must start with a letter or underscore diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.9.qml b/tests/auto/qml/qqmllanguage/data/invalidID.9.qml new file mode 100644 index 0000000000..57474b7212 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.9.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyQmlObject { + id: "3hello" +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.errors.txt new file mode 100644 index 0000000000..c010e79492 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.errors.txt @@ -0,0 +1 @@ +3:9:IDs must start with a letter or underscore diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.qml b/tests/auto/qml/qqmllanguage/data/invalidID.qml new file mode 100644 index 0000000000..04db3eb67c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + id: 1 +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidImportID.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidImportID.errors.txt new file mode 100644 index 0000000000..034e937366 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidImportID.errors.txt @@ -0,0 +1 @@ +2:23:Invalid import qualifier ID diff --git a/tests/auto/qml/qqmllanguage/data/invalidImportID.qml b/tests/auto/qml/qqmllanguage/data/invalidImportID.qml new file mode 100644 index 0000000000..37e7c5d4d0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidImportID.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 +import QtQuick 2.0 as qt + +QtObject {} diff --git a/tests/auto/qml/qqmllanguage/data/invalidOn.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidOn.errors.txt new file mode 100644 index 0000000000..b4210a11fc --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidOn.errors.txt @@ -0,0 +1 @@ +3:5:"MyQmlObject" cannot operate on "value" diff --git a/tests/auto/qml/qqmllanguage/data/invalidOn.qml b/tests/auto/qml/qqmllanguage/data/invalidOn.qml new file mode 100644 index 0000000000..d748bf4755 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidOn.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + MyQmlObject on value {} +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidProperty.errors.txt new file mode 100644 index 0000000000..e9e27c479b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidProperty.errors.txt @@ -0,0 +1 @@ +4:18:Illegal property name diff --git a/tests/auto/qml/qqmllanguage/data/invalidProperty.qml b/tests/auto/qml/qqmllanguage/data/invalidProperty.qml new file mode 100644 index 0000000000..f9b322e35c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidProperty.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property int parseInt +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.1.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidRoot.1.errors.txt new file mode 100644 index 0000000000..eff7c0e6c4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.1.errors.txt @@ -0,0 +1 @@ +1:1:Expected a qualified name id diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.1.qml b/tests/auto/qml/qqmllanguage/data/invalidRoot.1.qml new file mode 100644 index 0000000000..2c63c08510 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.1.qml @@ -0,0 +1,2 @@ +{ +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidRoot.2.errors.txt new file mode 100644 index 0000000000..4bcc948e92 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.2.errors.txt @@ -0,0 +1 @@ +1:1:Expected type name diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.2.qml b/tests/auto/qml/qqmllanguage/data/invalidRoot.2.qml new file mode 100644 index 0000000000..427827ca89 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.2.qml @@ -0,0 +1,2 @@ +foo { +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidRoot.3.errors.txt new file mode 100644 index 0000000000..fdce1abf06 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.3.errors.txt @@ -0,0 +1 @@ +3:5:Expected type name diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.3.qml b/tests/auto/qml/qqmllanguage/data/invalidRoot.3.qml new file mode 100644 index 0000000000..65e93ed55d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.3.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 as Foo + +Foo.foo { +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidRoot.4.errors.txt new file mode 100644 index 0000000000..3b90f573a2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.4.errors.txt @@ -0,0 +1 @@ +3:1:Bar.Item - Bar is not a namespace diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.4.qml b/tests/auto/qml/qqmllanguage/data/invalidRoot.4.qml new file mode 100644 index 0000000000..ba4c8ae1f7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.4.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 as Foo + +Bar.Item { +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.errors.txt new file mode 100644 index 0000000000..4bcc948e92 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.errors.txt @@ -0,0 +1 @@ +1:1:Expected type name diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.qml b/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.qml new file mode 100644 index 0000000000..658b72d9f2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.qml @@ -0,0 +1,2 @@ +item { +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.errors.txt new file mode 100644 index 0000000000..fdce1abf06 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.errors.txt @@ -0,0 +1 @@ +3:5:Expected type name diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.qml b/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.qml new file mode 100644 index 0000000000..9c83238282 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 as Foo + +Foo.item { +} + diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.errors.txt new file mode 100644 index 0000000000..208df2b84a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.errors.txt @@ -0,0 +1 @@ +5:9:Expected type name diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.qml b/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.qml new file mode 100644 index 0000000000..2f7027081e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 as Foo + +Foo.Item { + + Foo.item { + } +} diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.errors.txt new file mode 100644 index 0000000000..3b90f573a2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.errors.txt @@ -0,0 +1 @@ +3:1:Bar.Item - Bar is not a namespace diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.qml b/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.qml new file mode 100644 index 0000000000..ba4c8ae1f7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 as Foo + +Bar.Item { +} diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.1.6.js b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.1.6.js new file mode 100644 index 0000000000..c7b3c8b6ca --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.1.6.js @@ -0,0 +1,5 @@ +var major = 1 +var minor = 6 + +function greeting() { return "Good news, everybody!" } + diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.js b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.js new file mode 100644 index 0000000000..b90033eeb4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.js @@ -0,0 +1,5 @@ +var major = 1 +var minor = 0 + +function greeting() { return "Hello" } + diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/SecondAPI.js b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/SecondAPI.js new file mode 100644 index 0000000000..b802477cb6 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/SecondAPI.js @@ -0,0 +1,5 @@ +var major = 1 +var minor = 5 + +function greeting() { return "Howdy" } + diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/qmldir b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/qmldir new file mode 100644 index 0000000000..083afb051c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule.1.6/qmldir @@ -0,0 +1,3 @@ +FirstAPI 1.0 FirstAPI.js +FirstAPI 1.6 FirstAPI.1.6.js +SecondAPI 1.5 SecondAPI.js diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule/FirstAPI.js b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule/FirstAPI.js new file mode 100644 index 0000000000..b90033eeb4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule/FirstAPI.js @@ -0,0 +1,5 @@ +var major = 1 +var minor = 0 + +function greeting() { return "Hello" } + diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule/SecondAPI.js b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule/SecondAPI.js new file mode 100644 index 0000000000..b802477cb6 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule/SecondAPI.js @@ -0,0 +1,5 @@ +var major = 1 +var minor = 5 + +function greeting() { return "Howdy" } + diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule/qmldir b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule/qmldir new file mode 100644 index 0000000000..5c3acebd39 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/PureJsModule/qmldir @@ -0,0 +1,2 @@ +FirstAPI 1.0 FirstAPI.js +SecondAPI 1.5 SecondAPI.js diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/SomeAPI.js b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/SomeAPI.js new file mode 100644 index 0000000000..efac613fc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/SomeAPI.js @@ -0,0 +1,5 @@ +var major = 9 +var minor = 0 + +function greeting() { return "Hey hey hey" } + diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/qmldir b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/qmldir new file mode 100644 index 0000000000..5c1b182028 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/qmldir @@ -0,0 +1 @@ +SomeAPI 9.0 SomeAPI.js diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/InstalledTest.qml b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/InstalledTest.qml new file mode 100644 index 0000000000..56daa9c09a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/InstalledTest.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 as Qt47 +Qt47.Rectangle {} diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml new file mode 100644 index 0000000000..59df88216e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 +Text {} diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/LocalLast.qml b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/LocalLast.qml new file mode 100644 index 0000000000..26a5d6bba9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/LocalLast.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 +Rectangle {} diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml new file mode 100644 index 0000000000..ed1b09e419 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 +Image {} diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/qmldir b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/qmldir new file mode 100644 index 0000000000..d15720a154 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest/qmldir @@ -0,0 +1,4 @@ +Rectangle 1.5 InstalledTest2.qml +LocalLast 1.0 LocalLast.qml +InstalledTest 1.4 InstalledTest2.qml +InstalledTest 1.0 InstalledTest.qml diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml new file mode 100644 index 0000000000..56daa9c09a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 as Qt47 +Qt47.Rectangle {} diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml new file mode 100644 index 0000000000..59df88216e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 +Text {} diff --git a/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest0/qmldir b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest0/qmldir new file mode 100644 index 0000000000..b301226099 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/com/nokia/installedtest0/qmldir @@ -0,0 +1,2 @@ +InstalledTest 1.4 InstalledTest2.qml +InstalledTestTP 0.0 InstalledTest.qml diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.1.errors.txt b/tests/auto/qml/qqmllanguage/data/listAssignment.1.errors.txt new file mode 100644 index 0000000000..35d2d3510e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/listAssignment.1.errors.txt @@ -0,0 +1 @@ +4:24:Cannot assign object to list diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.1.qml b/tests/auto/qml/qqmllanguage/data/listAssignment.1.qml new file mode 100644 index 0000000000..1af190633d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/listAssignment.1.qml @@ -0,0 +1,6 @@ +import Test 1.0 +import QtQuick 2.0 +MyContainer { + containerChildren: QtObject {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.2.errors.txt b/tests/auto/qml/qqmllanguage/data/listAssignment.2.errors.txt new file mode 100644 index 0000000000..8b40aa3ebb --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/listAssignment.2.errors.txt @@ -0,0 +1,2 @@ +3:15:Cannot assign primitives to lists + diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.2.qml b/tests/auto/qml/qqmllanguage/data/listAssignment.2.qml new file mode 100644 index 0000000000..e3baadb46c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/listAssignment.2.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyContainer { + children: 2 +} diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.3.errors.txt b/tests/auto/qml/qqmllanguage/data/listAssignment.3.errors.txt new file mode 100644 index 0000000000..c721fe91bf --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/listAssignment.3.errors.txt @@ -0,0 +1 @@ +4:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.3.qml b/tests/auto/qml/qqmllanguage/data/listAssignment.3.qml new file mode 100644 index 0000000000..00c4c6b543 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/listAssignment.3.qml @@ -0,0 +1,6 @@ +import Test 1.0 +MyContainer { + children: childBinding.expression + children: childBinding2.expression +} + diff --git a/tests/auto/qml/qqmllanguage/data/listItemDeleteSelf.qml b/tests/auto/qml/qqmllanguage/data/listItemDeleteSelf.qml new file mode 100644 index 0000000000..74439c66d4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/listItemDeleteSelf.qml @@ -0,0 +1,38 @@ +import QtQuick 2.0 + +Item { + ListModel { + id: fruitModel + ListElement { + name: "Apple" + cost: 2.45 + } + ListElement { + name: "Orange" + cost: 3.25 + } + ListElement { + name: "Banana" + cost: 1.95 + } + } + + Component { + id: fruitDelegate + Item { + width: 200; height: 50 + Text { text: name } + Text { text: '$'+cost; anchors.right: parent.right } + MouseArea { + anchors.fill: parent + onClicked: fruitModel.remove(index) + } + } + } + + ListView { + model: fruitModel + delegate: fruitDelegate + anchors.fill: parent + } +} diff --git a/tests/auto/qml/qqmllanguage/data/listProperties.qml b/tests/auto/qml/qqmllanguage/data/listProperties.qml new file mode 100644 index 0000000000..dcfe37d6fc --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/listProperties.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +QtObject { + property list<QtObject> listProperty + property int test: listProperty.length + + listProperty: [ QtObject{}, QtObject {} ] +} + diff --git a/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.errors.txt b/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.errors.txt new file mode 100644 index 0000000000..07d05d3d21 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.errors.txt @@ -0,0 +1 @@ +3:1:MyQmlObject is not a type diff --git a/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.qml b/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.qml new file mode 100644 index 0000000000..717ca76f05 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.qml @@ -0,0 +1,4 @@ +import Test.Version 2.0 + +MyQmlObject { +} diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.errors.txt b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.errors.txt new file mode 100644 index 0000000000..29342dc46e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.errors.txt @@ -0,0 +1 @@ +8:5:"MyRevisionedClass.prop2" is not available in Test 1.0. diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.qml b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.qml new file mode 100644 index 0000000000..fbb37705a1 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.qml @@ -0,0 +1,9 @@ +// Check that a property in a later revision (prop2) cannot be assigned +import QtQuick 2.0 +import Test 1.0 + +MyRevisionedClass +{ + prop1: 1 + prop2: 2 +} diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.errors.txt b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.errors.txt new file mode 100644 index 0000000000..57b5764b08 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.errors.txt @@ -0,0 +1 @@ +6:5:"MyRevisionedClass.onSignal2" is not available in Test 1.0. diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.qml b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.qml new file mode 100644 index 0000000000..8da7a2558f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyRevisionedClass +{ + onSignal1: prop1 = 2 + onSignal2: prop1 = 3 +} diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.errors.txt b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.errors.txt new file mode 100644 index 0000000000..45364a044f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.errors.txt @@ -0,0 +1 @@ +9:5:"MyRevisionedClass.propD" is not available in Test 1.1. diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.qml b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.qml new file mode 100644 index 0000000000..195be2116a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.qml @@ -0,0 +1,10 @@ +import Test 1.1 + +MyRevisionedClass +{ + propA: 10 + propB: 10 + propC: 10 + // propD is in rev 1 of MyRevisionedClassUnregistered, but not registered in 1.1 + propD: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/method.1.errors.txt b/tests/auto/qml/qqmllanguage/data/method.1.errors.txt new file mode 100644 index 0000000000..98d0b9cefb --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/method.1.errors.txt @@ -0,0 +1 @@ +4:14:Method names cannot begin with an upper case letter diff --git a/tests/auto/qml/qqmllanguage/data/method.1.qml b/tests/auto/qml/qqmllanguage/data/method.1.qml new file mode 100644 index 0000000000..a888b1aaf4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/method.1.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + function MyMethod() {} +} diff --git a/tests/auto/qml/qqmllanguage/data/missingObject.errors.txt b/tests/auto/qml/qqmllanguage/data/missingObject.errors.txt new file mode 100644 index 0000000000..b31b562de1 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/missingObject.errors.txt @@ -0,0 +1 @@ +1:10:Expected token `{' diff --git a/tests/auto/qml/qqmllanguage/data/missingObject.qml b/tests/auto/qml/qqmllanguage/data/missingObject.qml new file mode 100644 index 0000000000..2f17045869 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/missingObject.qml @@ -0,0 +1 @@ +something: 24 diff --git a/tests/auto/qml/qqmllanguage/data/missingSignal.errors.txt b/tests/auto/qml/qqmllanguage/data/missingSignal.errors.txt new file mode 100644 index 0000000000..f562246288 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/missingSignal.errors.txt @@ -0,0 +1 @@ +4:5:Cannot assign to non-existent property "onClicked" diff --git a/tests/auto/qml/qqmllanguage/data/missingSignal.qml b/tests/auto/qml/qqmllanguage/data/missingSignal.qml new file mode 100644 index 0000000000..92aefef8c4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/missingSignal.qml @@ -0,0 +1,5 @@ +import Test 1.0 +import QtQuick 2.0 +QtObject { + onClicked: console.log("Hello world!") +} diff --git a/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.errors.txt new file mode 100644 index 0000000000..caf7e55ba2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.errors.txt @@ -0,0 +1 @@ +4:18:Cannot assign to non-existent property "foo" diff --git a/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.qml b/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.qml new file mode 100644 index 0000000000..9a0fa6a26b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + rectProperty.foo: 9 +} diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.1.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.1.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.1.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.1.qml b/tests/auto/qml/qqmllanguage/data/multiSet.1.qml new file mode 100644 index 0000000000..649c49ee3a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.1.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: 10 + intProperty: 11 +} + diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.10.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.10.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.10.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.10.qml b/tests/auto/qml/qqmllanguage/data/multiSet.10.qml new file mode 100644 index 0000000000..bc21db98f8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.10.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + property int a: 10 + a: 11 +} diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.11.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.11.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.11.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.11.qml b/tests/auto/qml/qqmllanguage/data/multiSet.11.qml new file mode 100644 index 0000000000..7d03139056 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.11.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + rectProperty.x: 10 + rectProperty.x: 11 +} diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.2.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.2.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.2.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.2.qml b/tests/auto/qml/qqmllanguage/data/multiSet.2.qml new file mode 100644 index 0000000000..abcd216744 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.2.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: 10 + intProperty: a + 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.3.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.3.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.3.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.3.qml b/tests/auto/qml/qqmllanguage/data/multiSet.3.qml new file mode 100644 index 0000000000..77eaba0b32 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.3.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: a + 10 + intProperty: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.4.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.4.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.4.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.4.qml b/tests/auto/qml/qqmllanguage/data/multiSet.4.qml new file mode 100644 index 0000000000..c16d04fea6 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.4.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: 10 + intProperty: MyTypeObject {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.5.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.5.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.5.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.5.qml b/tests/auto/qml/qqmllanguage/data/multiSet.5.qml new file mode 100644 index 0000000000..2980c5b28c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.5.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyContainer { + children: MyContainer {} + children: MyContainer {} +} diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.6.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.6.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.6.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.6.qml b/tests/auto/qml/qqmllanguage/data/multiSet.6.qml new file mode 100644 index 0000000000..492c720edc --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.6.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyContainer { + children: MyContainer {} + children: [ MyContainer {}, MyContainer {} ] +} + diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.7.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.7.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.7.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.7.qml b/tests/auto/qml/qqmllanguage/data/multiSet.7.qml new file mode 100644 index 0000000000..2a9c1d0de8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.7.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyContainer { + children: [ MyContainer {}, MyContainer {} ] + children: MyContainer {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.8.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.8.errors.txt new file mode 100644 index 0000000000..450fc163bd --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.8.errors.txt @@ -0,0 +1 @@ +6:9:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.8.qml b/tests/auto/qml/qqmllanguage/data/multiSet.8.qml new file mode 100644 index 0000000000..052437ea18 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.8.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + grouped { + value: 10 + value: 11 + } +} diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.9.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.9.errors.txt new file mode 100644 index 0000000000..e1f7ec5bc2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.9.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.9.qml b/tests/auto/qml/qqmllanguage/data/multiSet.9.qml new file mode 100644 index 0000000000..e2e954f778 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/multiSet.9.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + grouped.value: 10 + grouped.value: 11 +} diff --git a/tests/auto/qml/qqmllanguage/data/nestedComponentRoots.qml b/tests/auto/qml/qqmllanguage/data/nestedComponentRoots.qml new file mode 100644 index 0000000000..5e6c2a91c9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nestedComponentRoots.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 + +NestedComponentRoot { +} diff --git a/tests/auto/qml/qqmllanguage/data/nestedErrors.errors.txt b/tests/auto/qml/qqmllanguage/data/nestedErrors.errors.txt new file mode 100644 index 0000000000..53e752b641 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nestedErrors.errors.txt @@ -0,0 +1,2 @@ +4:5:Type NestedErrorsType unavailable +4:8:Invalid property assignment: number expected diff --git a/tests/auto/qml/qqmllanguage/data/nestedErrors.qml b/tests/auto/qml/qqmllanguage/data/nestedErrors.qml new file mode 100644 index 0000000000..cc1df4d181 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nestedErrors.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +Item { + NestedErrorsType {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/noCreation.errors.txt b/tests/auto/qml/qqmllanguage/data/noCreation.errors.txt new file mode 100644 index 0000000000..23cd3f3504 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/noCreation.errors.txt @@ -0,0 +1 @@ +3:1:Keys is only available via attached properties diff --git a/tests/auto/qml/qqmllanguage/data/noCreation.qml b/tests/auto/qml/qqmllanguage/data/noCreation.qml new file mode 100644 index 0000000000..28852f1a0c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/noCreation.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 + +Keys { +} diff --git a/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.errors.txt new file mode 100644 index 0000000000..cdfa4b2ef2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.errors.txt @@ -0,0 +1 @@ +4:5:Cannot assign to non-existent property "nonScriptable" diff --git a/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.qml b/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.qml new file mode 100644 index 0000000000..bd59bc80f9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyQmlObject { + nonScriptable: 11 +} diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.errors.txt new file mode 100644 index 0000000000..6bfce9a2c9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.errors.txt @@ -0,0 +1 @@ +2:15:Cannot assign to non-existent property "something" diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.qml new file mode 100644 index 0000000000..df7406ce98 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.qml @@ -0,0 +1,2 @@ +import Test 1.0 +MyQmlObject { something: 24 } diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.errors.txt new file mode 100644 index 0000000000..4b30056d59 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.errors.txt @@ -0,0 +1 @@ +3:5:Cannot assign to non-existent property "something" diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.qml new file mode 100644 index 0000000000..06ccd37905 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + something: 24 +} diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.errors.txt new file mode 100644 index 0000000000..4b30056d59 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.errors.txt @@ -0,0 +1 @@ +3:5:Cannot assign to non-existent property "something" diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.qml new file mode 100644 index 0000000000..5b08608862 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + something: 1 + 1 +} diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.errors.txt new file mode 100644 index 0000000000..4b30056d59 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.errors.txt @@ -0,0 +1 @@ +3:5:Cannot assign to non-existent property "something" diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.qml new file mode 100644 index 0000000000..65791919ba --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + something: ; +} diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.errors.txt new file mode 100644 index 0000000000..c07f2b99a2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.errors.txt @@ -0,0 +1 @@ +3:5:Expected a qualified name id diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.qml new file mode 100644 index 0000000000..37af05731e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + 24 +} diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.errors.txt new file mode 100644 index 0000000000..89925b74c2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.errors.txt @@ -0,0 +1 @@ +3:5:Cannot assign to non-existent default property diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.qml new file mode 100644 index 0000000000..5cd55d0856 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + MyQmlObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/notAvailable.errors.txt b/tests/auto/qml/qqmllanguage/data/notAvailable.errors.txt new file mode 100644 index 0000000000..af95a53cc7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/notAvailable.errors.txt @@ -0,0 +1 @@ +3:1:UnavailableType is unavailable for testing diff --git a/tests/auto/qml/qqmllanguage/data/notAvailable.qml b/tests/auto/qml/qqmllanguage/data/notAvailable.qml new file mode 100644 index 0000000000..7c3c7ee08d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/notAvailable.qml @@ -0,0 +1,4 @@ +import Test 1.0 + +UnavailableType { +} diff --git a/tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt new file mode 100644 index 0000000000..07a40949cd --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt @@ -0,0 +1 @@ +3:-1:Cannot set properties on obj as it is null diff --git a/tests/auto/qml/qqmllanguage/data/nullDotProperty.qml b/tests/auto/qml/qqmllanguage/data/nullDotProperty.qml new file mode 100644 index 0000000000..4e36779b5c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nullDotProperty.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyDotPropertyObject { + obj.value: 1 +} diff --git a/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.errors.txt new file mode 100644 index 0000000000..db7d9c0f60 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.errors.txt @@ -0,0 +1 @@ +4:18:Unexpected object assignment diff --git a/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.qml b/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.qml new file mode 100644 index 0000000000..99247735dd --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + rectProperty.x: MyTypeObject {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/onCompleted.qml b/tests/auto/qml/qqmllanguage/data/onCompleted.qml new file mode 100644 index 0000000000..89e6777f8a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/onCompleted.qml @@ -0,0 +1,17 @@ +import Test 1.0 +import QtQuick 2.0 + +MyTypeObject { + // We set a and b to ensure that onCompleted is executed after bindings and + // constants have been assigned + property int a: Math.min(6, 7) + Component.onCompleted: console.log("Completed " + a + " " + nestedObject.b) + + objectProperty: OnCompletedType { + qmlobjectProperty: MyQmlObject { + id: nestedObject + property int b: 10 + Component.onCompleted: console.log("Completed " + a + " " + nestedObject.b) + } + } +} diff --git a/tests/auto/qml/qqmllanguage/data/onDestruction.qml b/tests/auto/qml/qqmllanguage/data/onDestruction.qml new file mode 100644 index 0000000000..7d6da260b4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/onDestruction.qml @@ -0,0 +1,17 @@ +import Test 1.0 +import QtQuick 2.0 + +MyTypeObject { + // We set a and b to ensure that onCompleted is executed after bindings and + // constants have been assigned + property int a: Math.min(6, 7) + Component.onDestruction: console.log("Destruction " + a + " " + nestedObject.b) + + objectProperty: OnDestructionType { + qmlobjectProperty: MyQmlObject { + id: nestedObject + property int b: 10 + Component.onDestruction: console.log("Destruction " + a + " " + nestedObject.b) + } + } +} diff --git a/tests/auto/qml/qqmllanguage/data/property.1.errors.txt b/tests/auto/qml/qqmllanguage/data/property.1.errors.txt new file mode 100644 index 0000000000..3ae6c4601b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.1.errors.txt @@ -0,0 +1 @@ +4:14:Expected property type diff --git a/tests/auto/qml/qqmllanguage/data/property.1.qml b/tests/auto/qml/qqmllanguage/data/property.1.qml new file mode 100644 index 0000000000..6b43e6cc89 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.1.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property blah a; +} diff --git a/tests/auto/qml/qqmllanguage/data/property.2.errors.txt b/tests/auto/qml/qqmllanguage/data/property.2.errors.txt new file mode 100644 index 0000000000..a18e21a01c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.2.errors.txt @@ -0,0 +1 @@ +4:14:Unexpected property type modifier diff --git a/tests/auto/qml/qqmllanguage/data/property.2.qml b/tests/auto/qml/qqmllanguage/data/property.2.qml new file mode 100644 index 0000000000..e6aa00e730 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.2.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + property invalidmodifier<int> a; +} + diff --git a/tests/auto/qml/qqmllanguage/data/property.3.errors.txt b/tests/auto/qml/qqmllanguage/data/property.3.errors.txt new file mode 100644 index 0000000000..5e09a25b57 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.3.errors.txt @@ -0,0 +1 @@ +4:14:Invalid property type modifier diff --git a/tests/auto/qml/qqmllanguage/data/property.3.qml b/tests/auto/qml/qqmllanguage/data/property.3.qml new file mode 100644 index 0000000000..978c1aa80b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.3.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +QtObject { + property invalidmodifier<QtObject> a; +} + + diff --git a/tests/auto/qml/qqmllanguage/data/property.4.errors.txt b/tests/auto/qml/qqmllanguage/data/property.4.errors.txt new file mode 100644 index 0000000000..b447186849 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.4.errors.txt @@ -0,0 +1 @@ +5:1:Syntax error diff --git a/tests/auto/qml/qqmllanguage/data/property.4.qml b/tests/auto/qml/qqmllanguage/data/property.4.qml new file mode 100644 index 0000000000..bb94e84244 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.4.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + readonly property int a +} diff --git a/tests/auto/qml/qqmllanguage/data/property.6.errors.txt b/tests/auto/qml/qqmllanguage/data/property.6.errors.txt new file mode 100644 index 0000000000..985c083cc3 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.6.errors.txt @@ -0,0 +1 @@ +4:18:Property names cannot begin with an upper case letter diff --git a/tests/auto/qml/qqmllanguage/data/property.6.qml b/tests/auto/qml/qqmllanguage/data/property.6.qml new file mode 100644 index 0000000000..88f493f9a9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.6.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + property int Hello +} + diff --git a/tests/auto/qml/qqmllanguage/data/property.7.errors.txt b/tests/auto/qml/qqmllanguage/data/property.7.errors.txt new file mode 100644 index 0000000000..985c083cc3 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.7.errors.txt @@ -0,0 +1 @@ +4:18:Property names cannot begin with an upper case letter diff --git a/tests/auto/qml/qqmllanguage/data/property.7.qml b/tests/auto/qml/qqmllanguage/data/property.7.qml new file mode 100644 index 0000000000..05eb319947 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/property.7.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property int Hello: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/propertyInit.1.qml b/tests/auto/qml/qqmllanguage/data/propertyInit.1.qml new file mode 100644 index 0000000000..7d6fea24db --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/propertyInit.1.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property int test: { var _ = 1; _ } +} diff --git a/tests/auto/qml/qqmllanguage/data/propertyInit.2.qml b/tests/auto/qml/qqmllanguage/data/propertyInit.2.qml new file mode 100644 index 0000000000..fa690ba6bc --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/propertyInit.2.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + property int test: if (b == 1) 123; else 321; + property int b: 1 +} diff --git a/tests/auto/qml/qqmllanguage/data/propertyValueSource.2.qml b/tests/auto/qml/qqmllanguage/data/propertyValueSource.2.qml new file mode 100644 index 0000000000..e48526abec --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/propertyValueSource.2.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + MyCompositeValueSource on intProperty {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/propertyValueSource.qml b/tests/auto/qml/qqmllanguage/data/propertyValueSource.qml new file mode 100644 index 0000000000..22aa68250e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/propertyValueSource.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyTypeObject { + MyPropertyValueSource on intProperty {} +} diff --git a/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.1.qml b/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.1.qml new file mode 100644 index 0000000000..55c507f67e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.1.qml @@ -0,0 +1,5 @@ +import Test 1.0 +import QtQuick 2.0 +QtObject { +} + diff --git a/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.2.qml b/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.2.qml new file mode 100644 index 0000000000..db8a3da2b2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.2.qml @@ -0,0 +1,6 @@ +import Test 1.0 +import QtQuick 2.0 +QtObject { + MyQmlObject.value: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/LocalInternal.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/LocalInternal.qml new file mode 100644 index 0000000000..4ce04c46d2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/LocalInternal.qml @@ -0,0 +1,3 @@ +import QtQuick 2.0 + +Image { source: "pics/blue.png" } diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/Test.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/Test.qml new file mode 100644 index 0000000000..f789a905f2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/Test.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 +Rectangle { } diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestLocal.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestLocal.qml new file mode 100644 index 0000000000..11443ca6d5 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestLocal.qml @@ -0,0 +1 @@ +LocalInternal {} diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestNamed.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestNamed.qml new file mode 100644 index 0000000000..672cb8f201 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestNamed.qml @@ -0,0 +1 @@ +NamedLocal { } diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestSubDir.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestSubDir.qml new file mode 100644 index 0000000000..0dfede4093 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestSubDir.qml @@ -0,0 +1,2 @@ +import "subdir" +SubTest { } diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/UndeclaredLocal.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/UndeclaredLocal.qml new file mode 100644 index 0000000000..4ce04c46d2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/UndeclaredLocal.qml @@ -0,0 +1,3 @@ +import QtQuick 2.0 + +Image { source: "pics/blue.png" } diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/WrongTestLocal.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/WrongTestLocal.qml new file mode 100644 index 0000000000..8dcb7be231 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/WrongTestLocal.qml @@ -0,0 +1 @@ +UndeclaredInternal {} diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/noqmldir/Test.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/noqmldir/Test.qml new file mode 100644 index 0000000000..f789a905f2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/noqmldir/Test.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 +Rectangle { } diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/pics/blue.png b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/pics/blue.png Binary files differnew file mode 100644 index 0000000000..46f815f1ed --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/pics/blue.png diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/qmldir b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/qmldir new file mode 100644 index 0000000000..60150f837c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/qmldir @@ -0,0 +1,5 @@ +Test Test.qml +TestSubDir TestSubDir.qml +TestLocal TestLocal.qml +NamedLocal LocalInternal.qml +internal LocalInternal LocalInternal.qml diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/SubTest.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/SubTest.qml new file mode 100644 index 0000000000..1480ae8683 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/SubTest.qml @@ -0,0 +1,3 @@ +import QtQuick 2.0 + +Text {} diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/qmldir b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/qmldir new file mode 100644 index 0000000000..a54f7dfa61 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/qmldir @@ -0,0 +1 @@ +SubTest SubTest.qml diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.1.errors.txt b/tests/auto/qml/qqmllanguage/data/readOnly.1.errors.txt new file mode 100644 index 0000000000..b8c34042be --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/readOnly.1.errors.txt @@ -0,0 +1 @@ +3:21:Invalid property assignment: "readOnlyString" is a read-only property diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.1.qml b/tests/auto/qml/qqmllanguage/data/readOnly.1.qml new file mode 100644 index 0000000000..60757bd005 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/readOnly.1.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + readOnlyString: "Hello World" +} diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.2.errors.txt b/tests/auto/qml/qqmllanguage/data/readOnly.2.errors.txt new file mode 100644 index 0000000000..d857a0440e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/readOnly.2.errors.txt @@ -0,0 +1 @@ +3:5:Invalid property assignment: "readOnlyString" is a read-only property diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.2.qml b/tests/auto/qml/qqmllanguage/data/readOnly.2.qml new file mode 100644 index 0000000000..8f1633cc11 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/readOnly.2.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + readOnlyString: "Hello" + "World" +} diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.3.errors.txt b/tests/auto/qml/qqmllanguage/data/readOnly.3.errors.txt new file mode 100644 index 0000000000..c7e9e1bb2f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/readOnly.3.errors.txt @@ -0,0 +1 @@ +6:36:Invalid property assignment: "objAlias" is a read-only property diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.3.qml b/tests/auto/qml/qqmllanguage/data/readOnly.3.qml new file mode 100644 index 0000000000..e3c56b701a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/readOnly.3.qml @@ -0,0 +1,8 @@ +import Test 1.0 +import QtQuick 2.0 + +QtObject { + property variant child + child: HelperAlias { objAlias: QtObject {} } +} + diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.4.errors.txt b/tests/auto/qml/qqmllanguage/data/readOnly.4.errors.txt new file mode 100644 index 0000000000..d857a0440e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/readOnly.4.errors.txt @@ -0,0 +1 @@ +3:5:Invalid property assignment: "readOnlyString" is a read-only property diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.4.qml b/tests/auto/qml/qqmllanguage/data/readOnly.4.qml new file mode 100644 index 0000000000..5338ac77bc --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/readOnly.4.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + MyPropertyValueSource on readOnlyString {} +} diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.5.errors.txt b/tests/auto/qml/qqmllanguage/data/readOnly.5.errors.txt new file mode 100644 index 0000000000..e71ae4447c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/readOnly.5.errors.txt @@ -0,0 +1 @@ +2:23:Invalid property assignment: "readOnlyProperty" is a read-only property diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.5.qml b/tests/auto/qml/qqmllanguage/data/readOnly.5.qml new file mode 100644 index 0000000000..d80b27a1e3 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/readOnly.5.qml @@ -0,0 +1,3 @@ +ReadOnlyType { + readOnlyProperty: 13 +} diff --git a/tests/auto/qml/qqmllanguage/data/readonly.qml b/tests/auto/qml/qqmllanguage/data/readonly.qml new file mode 100644 index 0000000000..493a9ad502 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/readonly.qml @@ -0,0 +1,17 @@ +import Test 1.0 + +MyQmlObject { + property int testData: 9 + property alias testData2: myObject.test1 + + readonly property int test1: 10 + readonly property int test2: testData + 9 + readonly property alias test3: myObject.test1 + + + property variant dummy: MyQmlObject { + id: myObject + property int test1: 13 + } +} + diff --git a/tests/auto/qml/qqmllanguage/data/registrationOrder.qml b/tests/auto/qml/qqmllanguage/data/registrationOrder.qml new file mode 100644 index 0000000000..14217ad521 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/registrationOrder.qml @@ -0,0 +1,4 @@ +import Test.VersionOrder 2.0 + +MyQmlObject { +} diff --git a/tests/auto/qml/qqmllanguage/data/remoteLoadCrash.qml b/tests/auto/qml/qqmllanguage/data/remoteLoadCrash.qml new file mode 100644 index 0000000000..5f237d39a2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/remoteLoadCrash.qml @@ -0,0 +1,3 @@ +import QtQuick 2.0 +Text { +} diff --git a/tests/auto/qml/qqmllanguage/data/revisions11.qml b/tests/auto/qml/qqmllanguage/data/revisions11.qml new file mode 100644 index 0000000000..823439acdd --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/revisions11.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +import Test 1.1 + +MyRevisionedClass +{ + prop1: 1 + prop2: 10 + + onSignal2: prop2 = 3 +} diff --git a/tests/auto/qml/qqmllanguage/data/revisionsbasesub11.qml b/tests/auto/qml/qqmllanguage/data/revisionsbasesub11.qml new file mode 100644 index 0000000000..78ab51a4b7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/revisionsbasesub11.qml @@ -0,0 +1,16 @@ +import QtQuick 2.0 +import Test 1.1 + +MyRevisionedSubclass +{ + propA: 10 + propB: 10 + propC: 10 + // propD is not registered in 1.1 + prop1: 10 + prop2: 10 + prop3: 10 + prop4: 10 + + onSignal4: prop4 = 2 +} diff --git a/tests/auto/qml/qqmllanguage/data/revisionssub11.qml b/tests/auto/qml/qqmllanguage/data/revisionssub11.qml new file mode 100644 index 0000000000..d00758387e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/revisionssub11.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 +import Test 1.1 + +MyRevisionedSubclass +{ + prop1: 10 + prop2: 10 + prop3: 10 + prop4: 10 + + onSignal4: prop4 = 2 +} diff --git a/tests/auto/qml/qqmllanguage/data/rootAsQmlComponent.qml b/tests/auto/qml/qqmllanguage/data/rootAsQmlComponent.qml new file mode 100644 index 0000000000..8d72cd3844 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/rootAsQmlComponent.qml @@ -0,0 +1,6 @@ +import Test 1.0 +MyContainerComponent { + x: 11 + MyQmlObject {} + MyQmlObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/scriptString.1.errors.txt b/tests/auto/qml/qqmllanguage/data/scriptString.1.errors.txt new file mode 100644 index 0000000000..14463e0941 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/scriptString.1.errors.txt @@ -0,0 +1 @@ +4:21:Invalid property assignment: script expected diff --git a/tests/auto/qml/qqmllanguage/data/scriptString.1.qml b/tests/auto/qml/qqmllanguage/data/scriptString.1.qml new file mode 100644 index 0000000000..f07d2231fe --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/scriptString.1.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + scriptProperty: MyTypeObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/scriptString.2.errors.txt b/tests/auto/qml/qqmllanguage/data/scriptString.2.errors.txt new file mode 100644 index 0000000000..f8a776f9a0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/scriptString.2.errors.txt @@ -0,0 +1 @@ +4:40:Cannot assign multiple values to a script property diff --git a/tests/auto/qml/qqmllanguage/data/scriptString.2.qml b/tests/auto/qml/qqmllanguage/data/scriptString.2.qml new file mode 100644 index 0000000000..dc825c7511 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/scriptString.2.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + scriptProperty: [ MyTypeObject {}, MyTypeObject {} ] +} + diff --git a/tests/auto/qml/qqmllanguage/data/scriptString.qml b/tests/auto/qml/qqmllanguage/data/scriptString.qml new file mode 100644 index 0000000000..40a3bbeede --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/scriptString.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + scriptProperty: foo + bar + grouped.script: console.log(1921) +} diff --git a/tests/auto/qml/qqmllanguage/data/scriptString2.qml b/tests/auto/qml/qqmllanguage/data/scriptString2.qml new file mode 100644 index 0000000000..c42da2b9e1 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/scriptString2.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + scriptProperty: "hello\n\"world\"" +} diff --git a/tests/auto/qml/qqmllanguage/data/scriptString3.qml b/tests/auto/qml/qqmllanguage/data/scriptString3.qml new file mode 100644 index 0000000000..0cd82ff58f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/scriptString3.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + scriptProperty: 12.345 +} diff --git a/tests/auto/qml/qqmllanguage/data/scriptString4.qml b/tests/auto/qml/qqmllanguage/data/scriptString4.qml new file mode 100644 index 0000000000..3e2f9a49f1 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/scriptString4.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + scriptProperty: true +} diff --git a/tests/auto/qml/qqmllanguage/data/signal.1.errors.txt b/tests/auto/qml/qqmllanguage/data/signal.1.errors.txt new file mode 100644 index 0000000000..78d996016a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/signal.1.errors.txt @@ -0,0 +1 @@ +4:12:Expected parameter type diff --git a/tests/auto/qml/qqmllanguage/data/signal.1.qml b/tests/auto/qml/qqmllanguage/data/signal.1.qml new file mode 100644 index 0000000000..1c27baa4e8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/signal.1.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + signal mySignal(nontype a) +} diff --git a/tests/auto/qml/qqmllanguage/data/signal.2.errors.txt b/tests/auto/qml/qqmllanguage/data/signal.2.errors.txt new file mode 100644 index 0000000000..0d4c33d750 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/signal.2.errors.txt @@ -0,0 +1 @@ +4:21:Unexpected token `,' diff --git a/tests/auto/qml/qqmllanguage/data/signal.2.qml b/tests/auto/qml/qqmllanguage/data/signal.2.qml new file mode 100644 index 0000000000..2b00ab80bb --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/signal.2.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + signal mySignal(,) +} + diff --git a/tests/auto/qml/qqmllanguage/data/signal.3.errors.txt b/tests/auto/qml/qqmllanguage/data/signal.3.errors.txt new file mode 100644 index 0000000000..bf043ac85a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/signal.3.errors.txt @@ -0,0 +1 @@ +4:22:Expected token `identifier' diff --git a/tests/auto/qml/qqmllanguage/data/signal.3.qml b/tests/auto/qml/qqmllanguage/data/signal.3.qml new file mode 100644 index 0000000000..1bfcfff7b5 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/signal.3.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + signal mySignal(a) +} + diff --git a/tests/auto/qml/qqmllanguage/data/signal.4.errors.txt b/tests/auto/qml/qqmllanguage/data/signal.4.errors.txt new file mode 100644 index 0000000000..513ff60ae6 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/signal.4.errors.txt @@ -0,0 +1 @@ +4:12:Signal names cannot begin with an upper case letter diff --git a/tests/auto/qml/qqmllanguage/data/signal.4.qml b/tests/auto/qml/qqmllanguage/data/signal.4.qml new file mode 100644 index 0000000000..653c14e6aa --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/signal.4.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + signal MySignal +} + diff --git a/tests/auto/qml/qqmllanguage/data/simpleBindings.qml b/tests/auto/qml/qqmllanguage/data/simpleBindings.qml new file mode 100644 index 0000000000..2fcd1a5a4f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/simpleBindings.qml @@ -0,0 +1,18 @@ +import Test 1.0 +MyTypeObject { + id: me + property int v1: 10 + property int v2: 11 + + property int value1 + property int value2 + property int value3 + property int value4 + + value1: v1 + value2: me.v1 + value3: v1 + v2 + value4: Math.min(v1, v2) + + objectProperty: me +} diff --git a/tests/auto/qml/qqmllanguage/data/simpleContainer.qml b/tests/auto/qml/qqmllanguage/data/simpleContainer.qml new file mode 100644 index 0000000000..c3a795f536 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/simpleContainer.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyContainer { + MyQmlObject {} + MyQmlObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/simpleObject.qml b/tests/auto/qml/qqmllanguage/data/simpleObject.qml new file mode 100644 index 0000000000..30c78237de --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/simpleObject.qml @@ -0,0 +1,2 @@ +import Test 1.0 +MyQmlObject {} diff --git a/tests/auto/qml/qqmllanguage/data/singularProperty.2.errors.txt b/tests/auto/qml/qqmllanguage/data/singularProperty.2.errors.txt new file mode 100644 index 0000000000..beae562ff0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/singularProperty.2.errors.txt @@ -0,0 +1 @@ +5:10:Cannot assign multiple values to a singular property diff --git a/tests/auto/qml/qqmllanguage/data/singularProperty.2.qml b/tests/auto/qml/qqmllanguage/data/singularProperty.2.qml new file mode 100644 index 0000000000..e2760cb418 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/singularProperty.2.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +QtObject { + property QtObject a + a: [ QtObject {}, QtObject {} ] +} + diff --git a/tests/auto/qml/qqmllanguage/data/singularProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/singularProperty.errors.txt new file mode 100644 index 0000000000..beae562ff0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/singularProperty.errors.txt @@ -0,0 +1 @@ +5:10:Cannot assign multiple values to a singular property diff --git a/tests/auto/qml/qqmllanguage/data/singularProperty.qml b/tests/auto/qml/qqmllanguage/data/singularProperty.qml new file mode 100644 index 0000000000..ccbc6f0849 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/singularProperty.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + property variant a + a: [ QtObject {}, QtObject {} ] +} diff --git a/tests/auto/qml/qqmllanguage/data/subdir/Test.qml b/tests/auto/qml/qqmllanguage/data/subdir/Test.qml new file mode 100644 index 0000000000..f789a905f2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/subdir/Test.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 +Rectangle { } diff --git a/tests/auto/qml/qqmllanguage/data/subdir/subsubdir/SubTest.qml b/tests/auto/qml/qqmllanguage/data/subdir/subsubdir/SubTest.qml new file mode 100644 index 0000000000..f789a905f2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/subdir/subsubdir/SubTest.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 +Rectangle { } diff --git a/tests/auto/qml/qqmllanguage/data/test.js b/tests/auto/qml/qqmllanguage/data/test.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/test.js diff --git a/tests/auto/qml/qqmllanguage/data/test2.js b/tests/auto/qml/qqmllanguage/data/test2.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/test2.js diff --git a/tests/auto/qml/qqmllanguage/data/unregisteredObject.errors.txt b/tests/auto/qml/qqmllanguage/data/unregisteredObject.errors.txt new file mode 100644 index 0000000000..10e5fb2d96 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/unregisteredObject.errors.txt @@ -0,0 +1 @@ +2:1:UnregisteredObjectType is not a type diff --git a/tests/auto/qml/qqmllanguage/data/unregisteredObject.qml b/tests/auto/qml/qqmllanguage/data/unregisteredObject.qml new file mode 100644 index 0000000000..4969f62ad5 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/unregisteredObject.qml @@ -0,0 +1,2 @@ +import Test 1.0 +UnregisteredObjectType {} diff --git a/tests/auto/qml/qqmllanguage/data/unsupportedProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/unsupportedProperty.errors.txt new file mode 100644 index 0000000000..3cd626de86 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/unsupportedProperty.errors.txt @@ -0,0 +1 @@ +3:13:Invalid property assignment: unsupported type "QMatrix" diff --git a/tests/auto/qml/qqmllanguage/data/unsupportedProperty.qml b/tests/auto/qml/qqmllanguage/data/unsupportedProperty.qml new file mode 100644 index 0000000000..9f19680368 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/unsupportedProperty.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + matrix: "1,0,0,0,1,0,0,0,1" +} diff --git a/tests/auto/qml/qqmllanguage/data/valueTypes.qml b/tests/auto/qml/qqmllanguage/data/valueTypes.qml new file mode 100644 index 0000000000..bf325a74ee --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/valueTypes.qml @@ -0,0 +1,13 @@ +import Test 1.0 +MyTypeObject { + rectProperty.x: 10 + rectProperty.y: 11 + rectProperty.width: rectProperty.x + 2 + rectProperty.height: 13 + + intProperty: rectProperty.x + + onAction: { var a = rectProperty; a.x = 12; } + + rectProperty2: rectProperty +} diff --git a/tests/auto/qml/qqmllanguage/data/variantNotify.qml b/tests/auto/qml/qqmllanguage/data/variantNotify.qml new file mode 100644 index 0000000000..169b245450 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/variantNotify.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +QtObject { + property int notifyCount: 0 + + property variant foo + onFooChanged: notifyCount++ + + Component.onCompleted: { + foo = 1; + foo = 1; + } +} diff --git a/tests/auto/qml/qqmllanguage/data/versionedbase.qml b/tests/auto/qml/qqmllanguage/data/versionedbase.qml new file mode 100644 index 0000000000..3e8bca0368 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/versionedbase.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 +import Test 1.1 + +MySubclass +{ + prop1: 10 + prop2: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.1.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.1.errors.txt new file mode 100644 index 0000000000..ba7a0766b2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.1.errors.txt @@ -0,0 +1 @@ +3:12:Invalid property assignment: int expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.1.qml b/tests/auto/qml/qqmllanguage/data/wrongType.1.qml new file mode 100644 index 0000000000..289d37f050 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.1.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + value: "hello" +} diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.10.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.10.errors.txt new file mode 100644 index 0000000000..ae75b5289d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.10.errors.txt @@ -0,0 +1 @@ +3:23:Invalid property assignment: datetime expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.10.qml b/tests/auto/qml/qqmllanguage/data/wrongType.10.qml new file mode 100644 index 0000000000..2cf0e50277 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.10.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + dateTimeProperty: 12 +} + diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.11.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.11.errors.txt new file mode 100644 index 0000000000..23a4cda4c2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.11.errors.txt @@ -0,0 +1 @@ +3:20:Invalid property assignment: point expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.11.qml b/tests/auto/qml/qqmllanguage/data/wrongType.11.qml new file mode 100644 index 0000000000..ae77ba1fe8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.11.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + pointProperty: "apples" +} + diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.12.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.12.errors.txt new file mode 100644 index 0000000000..3092100280 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.12.errors.txt @@ -0,0 +1 @@ +3:19:Invalid property assignment: size expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.12.qml b/tests/auto/qml/qqmllanguage/data/wrongType.12.qml new file mode 100644 index 0000000000..b7a366f567 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.12.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + sizeProperty: "red" +} + diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.13.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.13.errors.txt new file mode 100644 index 0000000000..ba7a0766b2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.13.errors.txt @@ -0,0 +1 @@ +3:12:Invalid property assignment: int expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.13.qml b/tests/auto/qml/qqmllanguage/data/wrongType.13.qml new file mode 100644 index 0000000000..477aff1dbe --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.13.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + value: "12" +} diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.14.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.14.errors.txt new file mode 100644 index 0000000000..d621fdd6cd --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.14.errors.txt @@ -0,0 +1 @@ +3:21:Invalid property assignment: string expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.14.qml b/tests/auto/qml/qqmllanguage/data/wrongType.14.qml new file mode 100644 index 0000000000..672d693c72 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.14.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + stringProperty: 10 +} + diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.15.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.15.errors.txt new file mode 100644 index 0000000000..44768e30cb --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.15.errors.txt @@ -0,0 +1 @@ +3:18:Invalid property assignment: url expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.15.qml b/tests/auto/qml/qqmllanguage/data/wrongType.15.qml new file mode 100644 index 0000000000..633a5ba2ba --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.15.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyTypeObject { + urlProperty: 12 +} diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt new file mode 100644 index 0000000000..77cf210918 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt @@ -0,0 +1 @@ +4:24:Cannot assign object to property diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.16.qml b/tests/auto/qml/qqmllanguage/data/wrongType.16.qml new file mode 100644 index 0000000000..973fdada24 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.16.qml @@ -0,0 +1,5 @@ +import Test 1.0 +import QtQuick 2.0 +MyQmlObject { + qmlobjectProperty: QtObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.17.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.17.errors.txt new file mode 100644 index 0000000000..ef34d0ea95 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.17.errors.txt @@ -0,0 +1 @@ +3:19:Invalid property assignment: unknown enumeration diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.17.qml b/tests/auto/qml/qqmllanguage/data/wrongType.17.qml new file mode 100644 index 0000000000..f678fb3136 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.17.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + enumProperty: 6 +} + diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.2.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.2.errors.txt new file mode 100644 index 0000000000..9ff9f250c0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.2.errors.txt @@ -0,0 +1 @@ +3:14:Invalid property assignment: boolean expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.2.qml b/tests/auto/qml/qqmllanguage/data/wrongType.2.qml new file mode 100644 index 0000000000..34b74f7e01 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.2.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + enabled: 5 +} diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.3.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.3.errors.txt new file mode 100644 index 0000000000..6d971c6499 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.3.errors.txt @@ -0,0 +1 @@ +3:11:Invalid property assignment: rect expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.3.qml b/tests/auto/qml/qqmllanguage/data/wrongType.3.qml new file mode 100644 index 0000000000..384181a17f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.3.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyQmlObject { + rect: "5,5x10" +} diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.4.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.4.errors.txt new file mode 100644 index 0000000000..ef34d0ea95 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.4.errors.txt @@ -0,0 +1 @@ +3:19:Invalid property assignment: unknown enumeration diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.4.qml b/tests/auto/qml/qqmllanguage/data/wrongType.4.qml new file mode 100644 index 0000000000..0787bf5fda --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.4.qml @@ -0,0 +1,4 @@ +import Test 1.0 +MyTypeObject { + enumProperty: "InvalidEnumName" +} diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.5.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.5.errors.txt new file mode 100644 index 0000000000..cab10bddb8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.5.errors.txt @@ -0,0 +1 @@ +3:19:Invalid property assignment: unsigned int expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.5.qml b/tests/auto/qml/qqmllanguage/data/wrongType.5.qml new file mode 100644 index 0000000000..c50ae9a26d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.5.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + uintProperty: -13 +} + diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.6.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.6.errors.txt new file mode 100644 index 0000000000..d2b8c54c5b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.6.errors.txt @@ -0,0 +1 @@ +3:19:Invalid property assignment: number expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.6.qml b/tests/auto/qml/qqmllanguage/data/wrongType.6.qml new file mode 100644 index 0000000000..da10b7895f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.6.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + realProperty: "Hello" +} + diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.7.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.7.errors.txt new file mode 100644 index 0000000000..614346bd2b --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.7.errors.txt @@ -0,0 +1 @@ +3:20:Invalid property assignment: color expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.7.qml b/tests/auto/qml/qqmllanguage/data/wrongType.7.qml new file mode 100644 index 0000000000..ddc3835199 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.7.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + colorProperty: 12 +} + diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.8.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.8.errors.txt new file mode 100644 index 0000000000..1773c00825 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.8.errors.txt @@ -0,0 +1 @@ +3:19:Invalid property assignment: date expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.8.qml b/tests/auto/qml/qqmllanguage/data/wrongType.8.qml new file mode 100644 index 0000000000..a5f6756399 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.8.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + dateProperty: 12 +} + diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.9.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.9.errors.txt new file mode 100644 index 0000000000..8630975c57 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.9.errors.txt @@ -0,0 +1 @@ +3:19:Invalid property assignment: time expected diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.9.qml b/tests/auto/qml/qqmllanguage/data/wrongType.9.qml new file mode 100644 index 0000000000..a3db732692 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/wrongType.9.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyTypeObject { + timeProperty: 12 +} + diff --git a/tests/auto/qml/qqmllanguage/qqmllanguage.pro b/tests/auto/qml/qqmllanguage/qqmllanguage.pro new file mode 100644 index 0000000000..41b1d11764 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/qqmllanguage.pro @@ -0,0 +1,18 @@ +CONFIG += testcase +TARGET = tst_qqmllanguage +macx:CONFIG -= app_bundle + +SOURCES += tst_qqmllanguage.cpp \ + testtypes.cpp +HEADERS += testtypes.h + +INCLUDEPATH += ../../shared/ +HEADERS += ../../shared/testhttpserver.h +SOURCES += ../../shared/testhttpserver.cpp + +importFiles.files = data +importFiles.path = . +DEPLOYMENT += importFiles + +CONFIG += parallel_test +QT += core-private gui-private v8-private qml-private network testlib diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp new file mode 100644 index 0000000000..3c7a7c2058 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/testtypes.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "testtypes.h" + +void registerTypes() +{ + qmlRegisterInterface<MyInterface>("MyInterface"); + qmlRegisterType<MyQmlObject>("Test",1,0,"MyQmlObject"); + qmlRegisterType<MyTypeObject>("Test",1,0,"MyTypeObject"); + qmlRegisterType<MyContainer>("Test",1,0,"MyContainer"); + qmlRegisterType<MyPropertyValueSource>("Test",1,0,"MyPropertyValueSource"); + qmlRegisterType<MyDotPropertyObject>("Test",1,0,"MyDotPropertyObject"); + qmlRegisterType<MyNamespace::MyNamespacedType>("Test",1,0,"MyNamespacedType"); + qmlRegisterType<MyNamespace::MySecondNamespacedType>("Test",1,0,"MySecondNamespacedType"); + qmlRegisterType<MyParserStatus>("Test",1,0,"MyParserStatus"); + qmlRegisterType<MyGroupedObject>(); + qmlRegisterType<MyRevisionedClass>("Test",1,0,"MyRevisionedClass"); + qmlRegisterType<MyRevisionedClass,1>("Test",1,1,"MyRevisionedClass"); + qmlRegisterType<MyRevisionedIllegalOverload>("Test",1,0,"MyRevisionedIllegalOverload"); + qmlRegisterType<MyRevisionedLegalOverload>("Test",1,0,"MyRevisionedLegalOverload"); + + // Register the uncreatable base class + qmlRegisterRevision<MyRevisionedBaseClassRegistered,1>("Test",1,1); + // MyRevisionedSubclass 1.0 uses MyRevisionedClass revision 0 + qmlRegisterType<MyRevisionedSubclass>("Test",1,0,"MyRevisionedSubclass"); + // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1 + qmlRegisterType<MyRevisionedSubclass,1>("Test",1,1,"MyRevisionedSubclass"); + + // Only version 1.0, but its super class is registered in version 1.1 also + qmlRegisterType<MySubclass>("Test",1,0,"MySubclass"); + + qmlRegisterCustomType<MyCustomParserType>("Test", 1, 0, "MyCustomParserType", new MyCustomParserTypeParser); + + qmlRegisterTypeNotAvailable("Test",1,0,"UnavailableType", "UnavailableType is unavailable for testing"); + + qmlRegisterType<MyQmlObject>("Test.Version",1,0,"MyQmlObject"); + qmlRegisterType<MyTypeObject>("Test.Version",1,0,"MyTypeObject"); + qmlRegisterType<MyTypeObject>("Test.Version",2,0,"MyTypeObject"); + + qmlRegisterType<MyVersion2Class>("Test.VersionOrder", 2,0, "MyQmlObject"); + qmlRegisterType<MyQmlObject>("Test.VersionOrder", 1,0, "MyQmlObject"); +} + +QVariant myCustomVariantTypeConverter(const QString &data) +{ + MyCustomVariantType rv; + rv.a = data.toInt(); + return QVariant::fromValue(rv); +} + diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h new file mode 100644 index 0000000000..e9898bd039 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/testtypes.h @@ -0,0 +1,823 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef TESTTYPES_H +#define TESTTYPES_H + +#include <QtCore/qobject.h> +#include <QtCore/qrect.h> +#include <QtCore/qdatetime.h> +#include <QtGui/qmatrix.h> +#include <QtGui/qcolor.h> +#include <QtGui/qvector3d.h> +#include <QtGui/qvector4d.h> +#include <QtQml/qqml.h> +#include <QtQml/qqmlcomponent.h> +#include <QtQml/qqmlparserstatus.h> +#include <QtQml/qqmlpropertyvaluesource.h> +#include <QtQml/qqmlscriptstring.h> +#include <QtQml/qqmlproperty.h> + +#include <private/qqmlcustomparser_p.h> + +QVariant myCustomVariantTypeConverter(const QString &data); + +class MyInterface +{ +public: + MyInterface() : id(913) {} + int id; +}; + +QT_BEGIN_NAMESPACE +Q_DECLARE_INTERFACE(MyInterface, "com.trolltech.Qt.Test.MyInterface"); +QT_END_NAMESPACE +QML_DECLARE_INTERFACE(MyInterface); + +struct MyCustomVariantType +{ + MyCustomVariantType() : a(0) {} + int a; +}; +Q_DECLARE_METATYPE(MyCustomVariantType); + +class MyAttachedObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) + Q_PROPERTY(int value2 READ value2 WRITE setValue2) +public: + MyAttachedObject(QObject *parent) : QObject(parent), m_value(0), m_value2(0) {} + + int value() const { return m_value; } + void setValue(int v) { if (m_value != v) { m_value = v; emit valueChanged(); } } + + int value2() const { return m_value2; } + void setValue2(int v) { m_value2 = v; } + +signals: + void valueChanged(); + +private: + int m_value; + int m_value2; +}; + +class MyQmlObject : public QObject, public MyInterface +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue FINAL) + Q_PROPERTY(QString readOnlyString READ readOnlyString) + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled) + Q_PROPERTY(QRect rect READ rect WRITE setRect) + Q_PROPERTY(QMatrix matrix READ matrix WRITE setMatrix) //assumed to be unsupported by QML + Q_PROPERTY(MyInterface *interfaceProperty READ interface WRITE setInterface) + Q_PROPERTY(int onLiteralSignal READ onLiteralSignal WRITE setOnLiteralSignal) + Q_PROPERTY(MyCustomVariantType customType READ customType WRITE setCustomType) + Q_PROPERTY(MyQmlObject *qmlobjectProperty READ qmlobject WRITE setQmlobject) + Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) + Q_PROPERTY(int nonScriptable READ nonScriptable WRITE setNonScriptable SCRIPTABLE false) + + Q_INTERFACES(MyInterface) +public: + MyQmlObject() : m_value(-1), m_interface(0), m_qmlobject(0) { qRegisterMetaType<MyCustomVariantType>("MyCustomVariantType"); } + + int value() const { return m_value; } + void setValue(int v) { m_value = v; } + + QString readOnlyString() const { return QLatin1String(""); } + + bool enabled() const { return false; } + void setEnabled(bool) {} + + QRect rect() const { return QRect(); } + void setRect(const QRect&) {} + + QMatrix matrix() const { return QMatrix(); } + void setMatrix(const QMatrix&) {} + + MyInterface *interface() const { return m_interface; } + void setInterface(MyInterface *iface) { m_interface = iface; } + + static MyAttachedObject *qmlAttachedProperties(QObject *other) { + return new MyAttachedObject(other); + } + Q_CLASSINFO("DefaultMethod", "basicSlot()") + + int onLiteralSignal() const { return m_value; } + void setOnLiteralSignal(int v) { m_value = v; } + + MyQmlObject *qmlobject() const { return m_qmlobject; } + void setQmlobject(MyQmlObject *o) { m_qmlobject = o; } + + MyCustomVariantType customType() const { return m_custom; } + void setCustomType(const MyCustomVariantType &v) { m_custom = v; } + + int propertyWithNotify() const { return m_propertyWithNotify; } + void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); } + + int nonScriptable() const { return 0; } + void setNonScriptable(int) {} +public slots: + void basicSlot() { qWarning("MyQmlObject::basicSlot"); } + void basicSlotWithArgs(int v) { qWarning("MyQmlObject::basicSlotWithArgs(%d)", v); } + +signals: + void basicSignal(); + void basicParameterizedSignal(int parameter); + void oddlyNamedNotifySignal(); + +private: + friend class tst_qqmllanguage; + int m_value; + MyInterface *m_interface; + MyQmlObject *m_qmlobject; + MyCustomVariantType m_custom; + int m_propertyWithNotify; +}; +QML_DECLARE_TYPE(MyQmlObject) +QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) + +class MyGroupedObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(QQmlScriptString script READ script WRITE setScript) + Q_PROPERTY(int value READ value WRITE setValue) +public: + QQmlScriptString script() const { return m_script; } + void setScript(const QQmlScriptString &s) { m_script = s; } + + int value() const { return m_value; } + void setValue(int v) { m_value = v; } + +private: + int m_value; + QQmlScriptString m_script; +}; + + +class MyTypeObject : public QObject +{ + Q_OBJECT + Q_ENUMS(MyEnum) + Q_FLAGS(MyFlags) + + Q_PROPERTY(QString id READ id WRITE setId) + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty) + Q_PROPERTY(QQmlComponent *componentProperty READ componentProperty WRITE setComponentProperty) + Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty) + Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty) + Q_PROPERTY(MyEnum readOnlyEnumProperty READ readOnlyEnumProperty) + Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty) + Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty) + Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty) + Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty) + Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty) + Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty) + Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty) + Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty) + Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty) + Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty) + Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty) + Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty) + Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty) + Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty) + Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged) + Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2) + Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty) + Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty) + Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty) + Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty) + Q_PROPERTY(QVector4D vector4Property READ vector4Property WRITE setVector4Property) + Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty) + + Q_PROPERTY(QQmlScriptString scriptProperty READ scriptProperty WRITE setScriptProperty) + Q_PROPERTY(MyGroupedObject *grouped READ grouped CONSTANT) + Q_PROPERTY(MyGroupedObject *nullGrouped READ nullGrouped CONSTANT) + +public: + MyTypeObject() + : objectPropertyValue(0), componentPropertyValue(0) {} + + QString idValue; + QString id() const { + return idValue; + } + void setId(const QString &v) { + idValue = v; + } + + QObject *objectPropertyValue; + QObject *objectProperty() const { + return objectPropertyValue; + } + void setObjectProperty(QObject *v) { + objectPropertyValue = v; + } + + QQmlComponent *componentPropertyValue; + QQmlComponent *componentProperty() const { + return componentPropertyValue; + } + void setComponentProperty(QQmlComponent *v) { + componentPropertyValue = v; + } + + enum MyFlag { FlagVal1 = 0x01, FlagVal2 = 0x02, FlagVal3 = 0x04 }; + Q_DECLARE_FLAGS(MyFlags, MyFlag) + MyFlags flagPropertyValue; + MyFlags flagProperty() const { + return flagPropertyValue; + } + void setFlagProperty(MyFlags v) { + flagPropertyValue = v; + } + + enum MyEnum { EnumVal1, EnumVal2 }; + MyEnum enumPropertyValue; + MyEnum enumProperty() const { + return enumPropertyValue; + } + void setEnumProperty(MyEnum v) { + enumPropertyValue = v; + } + + MyEnum readOnlyEnumProperty() const { + return EnumVal1; + } + + QString stringPropertyValue; + QString stringProperty() const { + return stringPropertyValue; + } + void setStringProperty(const QString &v) { + stringPropertyValue = v; + } + + uint uintPropertyValue; + uint uintProperty() const { + return uintPropertyValue; + } + void setUintProperty(const uint &v) { + uintPropertyValue = v; + } + + int intPropertyValue; + int intProperty() const { + return intPropertyValue; + } + void setIntProperty(const int &v) { + intPropertyValue = v; + } + + qreal realPropertyValue; + qreal realProperty() const { + return realPropertyValue; + } + void setRealProperty(const qreal &v) { + realPropertyValue = v; + } + + double doublePropertyValue; + double doubleProperty() const { + return doublePropertyValue; + } + void setDoubleProperty(const double &v) { + doublePropertyValue = v; + } + + float floatPropertyValue; + float floatProperty() const { + return floatPropertyValue; + } + void setFloatProperty(const float &v) { + floatPropertyValue = v; + } + + QColor colorPropertyValue; + QColor colorProperty() const { + return colorPropertyValue; + } + void setColorProperty(const QColor &v) { + colorPropertyValue = v; + } + + QDate datePropertyValue; + QDate dateProperty() const { + return datePropertyValue; + } + void setDateProperty(const QDate &v) { + datePropertyValue = v; + } + + QTime timePropertyValue; + QTime timeProperty() const { + return timePropertyValue; + } + void setTimeProperty(const QTime &v) { + timePropertyValue = v; + } + + QDateTime dateTimePropertyValue; + QDateTime dateTimeProperty() const { + return dateTimePropertyValue; + } + void setDateTimeProperty(const QDateTime &v) { + dateTimePropertyValue = v; + } + + QPoint pointPropertyValue; + QPoint pointProperty() const { + return pointPropertyValue; + } + void setPointProperty(const QPoint &v) { + pointPropertyValue = v; + } + + QPointF pointFPropertyValue; + QPointF pointFProperty() const { + return pointFPropertyValue; + } + void setPointFProperty(const QPointF &v) { + pointFPropertyValue = v; + } + + QSize sizePropertyValue; + QSize sizeProperty() const { + return sizePropertyValue; + } + void setSizeProperty(const QSize &v) { + sizePropertyValue = v; + } + + QSizeF sizeFPropertyValue; + QSizeF sizeFProperty() const { + return sizeFPropertyValue; + } + void setSizeFProperty(const QSizeF &v) { + sizeFPropertyValue = v; + } + + QRect rectPropertyValue; + QRect rectProperty() const { + return rectPropertyValue; + } + void setRectProperty(const QRect &v) { + rectPropertyValue = v; + emit rectPropertyChanged(); + } + + QRect rectPropertyValue2; + QRect rectProperty2() const { + return rectPropertyValue2; + } + void setRectProperty2(const QRect &v) { + rectPropertyValue2 = v; + } + + QRectF rectFPropertyValue; + QRectF rectFProperty() const { + return rectFPropertyValue; + } + void setRectFProperty(const QRectF &v) { + rectFPropertyValue = v; + } + + bool boolPropertyValue; + bool boolProperty() const { + return boolPropertyValue; + } + void setBoolProperty(const bool &v) { + boolPropertyValue = v; + } + + QVariant variantPropertyValue; + QVariant variantProperty() const { + return variantPropertyValue; + } + void setVariantProperty(const QVariant &v) { + variantPropertyValue = v; + } + + QVector3D vectorPropertyValue; + QVector3D vectorProperty() const { + return vectorPropertyValue; + } + void setVectorProperty(const QVector3D &v) { + vectorPropertyValue = v; + } + + QVector4D vector4PropertyValue; + QVector4D vector4Property() const { + return vector4PropertyValue; + } + void setVector4Property(const QVector4D &v) { + vector4PropertyValue = v; + } + + QUrl urlPropertyValue; + QUrl urlProperty() const { + return urlPropertyValue; + } + void setUrlProperty(const QUrl &v) { + urlPropertyValue = v; + } + + QQmlScriptString scriptPropertyValue; + QQmlScriptString scriptProperty() const { + return scriptPropertyValue; + } + void setScriptProperty(const QQmlScriptString &v) { + scriptPropertyValue = v; + } + + MyGroupedObject groupedValue; + MyGroupedObject *grouped() { return &groupedValue; } + + MyGroupedObject *nullGrouped() { return 0; } + + void doAction() { emit action(); } +signals: + void action(); + void rectPropertyChanged(); +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags) + + +class MyContainer : public QObject +{ + Q_OBJECT + Q_PROPERTY(QQmlListProperty<QObject> children READ children) + Q_PROPERTY(QQmlListProperty<MyContainer> containerChildren READ containerChildren) + Q_PROPERTY(QQmlListProperty<MyInterface> qlistInterfaces READ qlistInterfaces) + Q_CLASSINFO("DefaultProperty", "children") +public: + MyContainer() {} + + QQmlListProperty<QObject> children() { return QQmlListProperty<QObject>(this, m_children); } + QQmlListProperty<MyContainer> containerChildren() { return QQmlListProperty<MyContainer>(this, m_containerChildren); } + QList<QObject *> *getChildren() { return &m_children; } + QQmlListProperty<MyInterface> qlistInterfaces() { return QQmlListProperty<MyInterface>(this, m_interfaces); } + QList<MyInterface *> *getQListInterfaces() { return &m_interfaces; } + + QList<MyContainer*> m_containerChildren; + QList<QObject*> m_children; + QList<MyInterface *> m_interfaces; +}; + + +class MyPropertyValueSource : public QObject, public QQmlPropertyValueSource +{ + Q_OBJECT + Q_INTERFACES(QQmlPropertyValueSource) +public: + MyPropertyValueSource() + : QQmlPropertyValueSource() {} + + QQmlProperty prop; + virtual void setTarget(const QQmlProperty &p) + { + prop = p; + } +}; + +class UnavailableType : public QObject +{ + Q_OBJECT +public: + UnavailableType() {} +}; + +class MyDotPropertyObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(MyQmlObject *obj READ obj) + Q_PROPERTY(MyQmlObject *readWriteObj READ readWriteObj WRITE setReadWriteObj) +public: + MyDotPropertyObject() : m_rwobj(0), m_ownRWObj(false) {} + ~MyDotPropertyObject() + { + if (m_ownRWObj) + delete m_rwobj; + } + + MyQmlObject *obj() { return 0; } + + MyQmlObject *readWriteObj() + { + if (!m_rwobj) { + m_rwobj = new MyQmlObject; + m_ownRWObj = true; + } + return m_rwobj; + } + + void setReadWriteObj(MyQmlObject *obj) + { + if (m_ownRWObj) { + delete m_rwobj; + m_ownRWObj = false; + } + + m_rwobj = obj; + } + +private: + MyQmlObject *m_rwobj; + bool m_ownRWObj; +}; + + +namespace MyNamespace { + class MyNamespacedType : public QObject + { + Q_OBJECT + }; + + class MySecondNamespacedType : public QObject + { + Q_OBJECT + Q_PROPERTY(QQmlListProperty<MyNamespace::MyNamespacedType> list READ list) + public: + QQmlListProperty<MyNamespacedType> list() { return QQmlListProperty<MyNamespacedType>(this, m_list); } + + private: + QList<MyNamespacedType *> m_list; + }; +} + +class MyCustomParserType : public QObject +{ + Q_OBJECT +}; + +class MyCustomParserTypeParser : public QQmlCustomParser +{ +public: + QByteArray compile(const QList<QQmlCustomParserProperty> &) { return QByteArray(); } + void setCustomData(QObject *, const QByteArray &) {} +}; + +class MyParserStatus : public QObject, public QQmlParserStatus +{ + Q_INTERFACES(QQmlParserStatus) + Q_OBJECT +public: + MyParserStatus() : m_cbc(0), m_ccc(0) {} + + int classBeginCount() const { return m_cbc; } + int componentCompleteCount() const { return m_ccc; } + + virtual void classBegin() { m_cbc++; } + virtual void componentComplete() { m_ccc++; } +private: + int m_cbc; + int m_ccc; +}; + +class MyRevisionedBaseClassRegistered : public QObject +{ + Q_OBJECT + Q_PROPERTY(qreal propA READ propA WRITE setPropA NOTIFY propAChanged) + Q_PROPERTY(qreal propB READ propB WRITE setPropB NOTIFY propBChanged REVISION 1) + +public: + MyRevisionedBaseClassRegistered() : m_pa(1), m_pb(2) {} + + qreal propA() const { return m_pa; } + void setPropA(qreal p) { + if (p != m_pa) { + m_pa = p; + emit propAChanged(); + } + } + qreal propB() const { return m_pb; } + void setPropB(qreal p) { + if (p != m_pb) { + m_pb = p; + emit propBChanged(); + } + } + + Q_INVOKABLE void methodA() { } + Q_INVOKABLE Q_REVISION(1) void methodB() { } + +signals: + void propAChanged(); + void propBChanged(); + + void signalA(); + Q_REVISION(1) void signalB(); + +protected: + qreal m_pa; + qreal m_pb; +}; + +class MyRevisionedIllegalOverload : public MyRevisionedBaseClassRegistered +{ + Q_OBJECT + Q_PROPERTY(qreal propA READ propA WRITE setPropA REVISION 1); +}; + +class MyRevisionedLegalOverload : public MyRevisionedBaseClassRegistered +{ + Q_OBJECT + Q_PROPERTY(qreal propB READ propB WRITE setPropB REVISION 1); +}; + +class MyRevisionedBaseClassUnregistered : public MyRevisionedBaseClassRegistered +{ + Q_OBJECT + Q_PROPERTY(qreal propC READ propC WRITE setPropC NOTIFY propCChanged) + Q_PROPERTY(qreal propD READ propD WRITE setPropD NOTIFY propDChanged REVISION 1) + +public: + MyRevisionedBaseClassUnregistered() : m_pc(1), m_pd(2) {} + + qreal propC() const { return m_pc; } + void setPropC(qreal p) { + if (p != m_pc) { + m_pc = p; + emit propCChanged(); + } + } + qreal propD() const { return m_pd; } + void setPropD(qreal p) { + if (p != m_pd) { + m_pd = p; + emit propDChanged(); + } + } + + Q_INVOKABLE void methodC() { } + Q_INVOKABLE Q_REVISION(1) void methodD() { } + +signals: + void propCChanged(); + void propDChanged(); + + void signalC(); + Q_REVISION(1) void signalD(); + +protected: + qreal m_pc; + qreal m_pd; +}; + +class MyRevisionedClass : public MyRevisionedBaseClassUnregistered +{ + Q_OBJECT + Q_PROPERTY(qreal prop1 READ prop1 WRITE setProp1 NOTIFY prop1Changed) + Q_PROPERTY(qreal prop2 READ prop2 WRITE setProp2 NOTIFY prop2Changed REVISION 1) + +public: + MyRevisionedClass() : m_p1(1), m_p2(2) {} + + qreal prop1() const { return m_p1; } + void setProp1(qreal p) { + if (p != m_p1) { + m_p1 = p; + emit prop1Changed(); + } + } + qreal prop2() const { return m_p2; } + void setProp2(qreal p) { + if (p != m_p2) { + m_p2 = p; + emit prop2Changed(); + } + } + + Q_INVOKABLE void method1() { } + Q_INVOKABLE Q_REVISION(1) void method2() { } + +signals: + void prop1Changed(); + void prop2Changed(); + + void signal1(); + Q_REVISION(1) void signal2(); + +protected: + qreal m_p1; + qreal m_p2; +}; + +class MyRevisionedSubclass : public MyRevisionedClass +{ + Q_OBJECT + Q_PROPERTY(qreal prop3 READ prop3 WRITE setProp3 NOTIFY prop3Changed) + Q_PROPERTY(qreal prop4 READ prop4 WRITE setProp4 NOTIFY prop4Changed REVISION 1) + +public: + MyRevisionedSubclass() : m_p3(3), m_p4(4) {} + + qreal prop3() const { return m_p3; } + void setProp3(qreal p) { + if (p != m_p3) { + m_p3 = p; + emit prop3Changed(); + } + } + qreal prop4() const { return m_p4; } + void setProp4(qreal p) { + if (p != m_p4) { + m_p4 = p; + emit prop4Changed(); + } + } + + Q_INVOKABLE void method3() { } + Q_INVOKABLE Q_REVISION(1) void method4() { } + +signals: + void prop3Changed(); + void prop4Changed(); + + void signal3(); + Q_REVISION(1) void signal4(); + +protected: + qreal m_p3; + qreal m_p4; +}; + +class MySubclass : public MyRevisionedClass +{ + Q_OBJECT + Q_PROPERTY(qreal prop5 READ prop5 WRITE setProp5 NOTIFY prop5Changed) + +public: + MySubclass() : m_p5(5) {} + + qreal prop5() const { return m_p5; } + void setProp5(qreal p) { + if (p != m_p5) { + m_p5 = p; + emit prop5Changed(); + } + } + + Q_INVOKABLE void method5() { } + +signals: + void prop5Changed(); + +protected: + qreal m_p5; +}; + +class MyVersion2Class : public QObject +{ + Q_OBJECT +}; + +QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered) +QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered) +QML_DECLARE_TYPE(MyRevisionedClass) +QML_DECLARE_TYPE(MyRevisionedSubclass) +QML_DECLARE_TYPE(MySubclass) + + + +void registerTypes(); + +#endif // TESTTYPES_H diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp new file mode 100644 index 0000000000..379c32d4b8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -0,0 +1,2289 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <qtest.h> +#include <QtQml/qqmlengine.h> +#include <QtQml/qqmlcomponent.h> +#include <QtCore/qcoreapplication.h> +#include <QtCore/qfile.h> +#include <QtCore/qdebug.h> +#include <QtCore/qfileinfo.h> +#include <QtCore/qdir.h> + +#include <private/qqmlproperty_p.h> +#include <private/qqmlmetatype_p.h> +#include <private/qqmlglobal_p.h> + +#include "testtypes.h" +#include "testhttpserver.h" + +DEFINE_BOOL_CONFIG_OPTION(qmlCheckTypes, QML_CHECK_TYPES) + +/* + Returns the path to some testdata file or directory. +*/ +QString testdata(QString const& name = QString()) +{ + static const QString dataDirectory = QDir::currentPath() + QLatin1String("/data"); + QString result = dataDirectory; + if (!name.isEmpty()) { + result += QLatin1Char('/'); + result += name; + } + return result; +} + +/* +This test case covers QML language issues. This covers everything that does not +involve evaluating ECMAScript expressions and bindings. + +Evaluation of expressions and bindings is covered in qmlecmascript +*/ +class tst_qqmllanguage : public QObject +{ + Q_OBJECT +public: + tst_qqmllanguage() { + QQmlMetaType::registerCustomStringConverter(qMetaTypeId<MyCustomVariantType>(), myCustomVariantTypeConverter); + engine.addImportPath(testdata("lib")); + } + +private slots: + void initTestCase(); + void cleanupTestCase(); + + void errors_data(); + void errors(); + + void insertedSemicolon_data(); + void insertedSemicolon(); + + void simpleObject(); + void simpleContainer(); + void interfaceProperty(); + void interfaceQList(); + void assignObjectToSignal(); + void assignObjectToVariant(); + void assignLiteralSignalProperty(); + void assignQmlComponent(); + void assignBasicTypes(); + void assignTypeExtremes(); + void assignCompositeToType(); + void assignLiteralToVariant(); + void assignLiteralToVar(); + void customParserTypes(); + void rootAsQmlComponent(); + void inlineQmlComponents(); + void idProperty(); + void autoNotifyConnection(); + void assignSignal(); + void dynamicProperties(); + void dynamicPropertiesNested(); + void listProperties(); + void dynamicObjectProperties(); + void dynamicSignalsAndSlots(); + void simpleBindings(); + void autoComponentCreation(); + void propertyValueSource(); + void attachedProperties(); + void dynamicObjects(); + void customVariantTypes(); + void valueTypes(); + void cppnamespace(); + void aliasProperties(); + void aliasPropertiesAndSignals(); + void aliasPropertyChangeSignals(); + void componentCompositeType(); + void i18n(); + void i18n_data(); + void onCompleted(); + void onDestruction(); + void scriptString(); + void defaultPropertyListOrder(); + void declaredPropertyValues(); + void dontDoubleCallClassBegin(); + void reservedWords_data(); + void reservedWords(); + void inlineAssignmentsOverrideBindings(); + void nestedComponentRoots(); + void registrationOrder(); + void readonly(); + + void basicRemote_data(); + void basicRemote(); + void importsBuiltin_data(); + void importsBuiltin(); + void importsLocal_data(); + void importsLocal(); + void importsRemote_data(); + void importsRemote(); + void importsInstalled_data(); + void importsInstalled(); + void importsOrder_data(); + void importsOrder(); + void importIncorrectCase(); + void importJs_data(); + void importJs(); + + void qmlAttachedPropertiesObjectMethod(); + void customOnProperty(); + void variantNotify(); + + void revisions(); + void revisionOverloads(); + + void propertyInit(); + void remoteLoadCrash(); + + // regression tests for crashes + void crash1(); + void crash2(); + +private: + QQmlEngine engine; + void testType(const QString& qml, const QString& type, const QString& error); +}; + +#define DETERMINE_ERRORS(errorfile,expected,actual)\ + QList<QByteArray> expected; \ + QList<QByteArray> actual; \ + do { \ + QFile file(testdata(QLatin1String(errorfile))); \ + QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \ + QByteArray data = file.readAll(); \ + file.close(); \ + expected = data.split('\n'); \ + expected.removeAll(QByteArray("")); \ + QList<QQmlError> errors = component.errors(); \ + for (int ii = 0; ii < errors.count(); ++ii) { \ + const QQmlError &error = errors.at(ii); \ + QByteArray errorStr = QByteArray::number(error.line()) + ":" + \ + QByteArray::number(error.column()) + ":" + \ + error.description().toUtf8(); \ + actual << errorStr; \ + } \ + } while (false); + +#define VERIFY_ERRORS(errorfile) \ + if (!errorfile) { \ + if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \ + qWarning() << "Unexpected Errors:" << component.errors(); \ + QVERIFY(!component.isError()); \ + QVERIFY(component.errors().isEmpty()); \ + } else { \ + DETERMINE_ERRORS(errorfile,actual,expected);\ + if (qgetenv("DEBUG") != "" && expected != actual) \ + qWarning() << "Expected:" << expected << "Actual:" << actual; \ + if (qgetenv("QDECLARATIVELANGUAGE_UPDATEERRORS") != "" && expected != actual) {\ + QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \ + QVERIFY(file.open(QIODevice::WriteOnly)); \ + for (int ii = 0; ii < actual.count(); ++ii) { \ + file.write(actual.at(ii)); file.write("\n"); \ + } \ + file.close(); \ + } else { \ + QCOMPARE(expected, actual); \ + } \ + } + +inline QUrl TEST_FILE(const QString &filename) +{ + return QUrl::fromLocalFile(testdata(filename)); +} + +inline QUrl TEST_FILE(const char *filename) +{ + return TEST_FILE(QLatin1String(filename)); +} + +void tst_qqmllanguage::cleanupTestCase() +{ + QVERIFY(QFile::remove(TEST_FILE(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml")).toLocalFile())); +} + +void tst_qqmllanguage::insertedSemicolon_data() +{ + QTest::addColumn<QString>("file"); + QTest::addColumn<QString>("errorFile"); + QTest::addColumn<bool>("create"); + + QTest::newRow("insertedSemicolon.1") << "insertedSemicolon.1.qml" << "insertedSemicolon.1.errors.txt" << false; +} + +void tst_qqmllanguage::insertedSemicolon() +{ + QFETCH(QString, file); + QFETCH(QString, errorFile); + QFETCH(bool, create); + + QQmlComponent component(&engine, TEST_FILE(file)); + + if(create) { + QObject *object = component.create(); + QVERIFY(object == 0); + } + + VERIFY_ERRORS(errorFile.toLatin1().constData()); +} + +void tst_qqmllanguage::errors_data() +{ + QTest::addColumn<QString>("file"); + QTest::addColumn<QString>("errorFile"); + QTest::addColumn<bool>("create"); + + QTest::newRow("nonexistantProperty.1") << "nonexistantProperty.1.qml" << "nonexistantProperty.1.errors.txt" << false; + QTest::newRow("nonexistantProperty.2") << "nonexistantProperty.2.qml" << "nonexistantProperty.2.errors.txt" << false; + QTest::newRow("nonexistantProperty.3") << "nonexistantProperty.3.qml" << "nonexistantProperty.3.errors.txt" << false; + QTest::newRow("nonexistantProperty.4") << "nonexistantProperty.4.qml" << "nonexistantProperty.4.errors.txt" << false; + QTest::newRow("nonexistantProperty.5") << "nonexistantProperty.5.qml" << "nonexistantProperty.5.errors.txt" << false; + QTest::newRow("nonexistantProperty.6") << "nonexistantProperty.6.qml" << "nonexistantProperty.6.errors.txt" << false; + + QTest::newRow("wrongType (string for int)") << "wrongType.1.qml" << "wrongType.1.errors.txt" << false; + QTest::newRow("wrongType (int for bool)") << "wrongType.2.qml" << "wrongType.2.errors.txt" << false; + QTest::newRow("wrongType (bad rect)") << "wrongType.3.qml" << "wrongType.3.errors.txt" << false; + + QTest::newRow("wrongType (invalid enum)") << "wrongType.4.qml" << "wrongType.4.errors.txt" << false; + QTest::newRow("wrongType (int for uint)") << "wrongType.5.qml" << "wrongType.5.errors.txt" << false; + QTest::newRow("wrongType (string for real)") << "wrongType.6.qml" << "wrongType.6.errors.txt" << false; + QTest::newRow("wrongType (int for color)") << "wrongType.7.qml" << "wrongType.7.errors.txt" << false; + QTest::newRow("wrongType (int for date)") << "wrongType.8.qml" << "wrongType.8.errors.txt" << false; + QTest::newRow("wrongType (int for time)") << "wrongType.9.qml" << "wrongType.9.errors.txt" << false; + QTest::newRow("wrongType (int for datetime)") << "wrongType.10.qml" << "wrongType.10.errors.txt" << false; + QTest::newRow("wrongType (string for point)") << "wrongType.11.qml" << "wrongType.11.errors.txt" << false; + QTest::newRow("wrongType (color for size)") << "wrongType.12.qml" << "wrongType.12.errors.txt" << false; + QTest::newRow("wrongType (number string for int)") << "wrongType.13.qml" << "wrongType.13.errors.txt" << false; + QTest::newRow("wrongType (int for string)") << "wrongType.14.qml" << "wrongType.14.errors.txt" << false; + QTest::newRow("wrongType (int for url)") << "wrongType.15.qml" << "wrongType.15.errors.txt" << false; + QTest::newRow("wrongType (invalid object)") << "wrongType.16.qml" << "wrongType.16.errors.txt" << false; + QTest::newRow("wrongType (int for enum)") << "wrongType.17.qml" << "wrongType.17.errors.txt" << false; + + QTest::newRow("readOnly.1") << "readOnly.1.qml" << "readOnly.1.errors.txt" << false; + QTest::newRow("readOnly.2") << "readOnly.2.qml" << "readOnly.2.errors.txt" << false; + QTest::newRow("readOnly.3") << "readOnly.3.qml" << "readOnly.3.errors.txt" << false; + QTest::newRow("readOnly.4") << "readOnly.4.qml" << "readOnly.4.errors.txt" << false; + QTest::newRow("readOnly.5") << "readOnly.5.qml" << "readOnly.5.errors.txt" << false; + + QTest::newRow("listAssignment.1") << "listAssignment.1.qml" << "listAssignment.1.errors.txt" << false; + QTest::newRow("listAssignment.2") << "listAssignment.2.qml" << "listAssignment.2.errors.txt" << false; + QTest::newRow("listAssignment.3") << "listAssignment.3.qml" << "listAssignment.3.errors.txt" << false; + + QTest::newRow("invalidID.1") << "invalidID.qml" << "invalidID.errors.txt" << false; + QTest::newRow("invalidID.2") << "invalidID.2.qml" << "invalidID.2.errors.txt" << false; + QTest::newRow("invalidID.3") << "invalidID.3.qml" << "invalidID.3.errors.txt" << false; + QTest::newRow("invalidID.4") << "invalidID.4.qml" << "invalidID.4.errors.txt" << false; + QTest::newRow("invalidID.5") << "invalidID.5.qml" << "invalidID.5.errors.txt" << false; + QTest::newRow("invalidID.6") << "invalidID.6.qml" << "invalidID.6.errors.txt" << false; + QTest::newRow("invalidID.7") << "invalidID.7.qml" << "invalidID.7.errors.txt" << false; + QTest::newRow("invalidID.8") << "invalidID.8.qml" << "invalidID.8.errors.txt" << false; + QTest::newRow("invalidID.9") << "invalidID.9.qml" << "invalidID.9.errors.txt" << false; + + QTest::newRow("scriptString.1") << "scriptString.1.qml" << "scriptString.1.errors.txt" << false; + QTest::newRow("scriptString.2") << "scriptString.2.qml" << "scriptString.2.errors.txt" << false; + + QTest::newRow("unsupportedProperty") << "unsupportedProperty.qml" << "unsupportedProperty.errors.txt" << false; + QTest::newRow("nullDotProperty") << "nullDotProperty.qml" << "nullDotProperty.errors.txt" << true; + QTest::newRow("fakeDotProperty") << "fakeDotProperty.qml" << "fakeDotProperty.errors.txt" << false; + QTest::newRow("duplicateIDs") << "duplicateIDs.qml" << "duplicateIDs.errors.txt" << false; + QTest::newRow("unregisteredObject") << "unregisteredObject.qml" << "unregisteredObject.errors.txt" << false; + QTest::newRow("empty") << "empty.qml" << "empty.errors.txt" << false; + QTest::newRow("missingObject") << "missingObject.qml" << "missingObject.errors.txt" << false; + QTest::newRow("failingComponent") << "failingComponentTest.qml" << "failingComponent.errors.txt" << false; + QTest::newRow("missingSignal") << "missingSignal.qml" << "missingSignal.errors.txt" << false; + QTest::newRow("finalOverride") << "finalOverride.qml" << "finalOverride.errors.txt" << false; + QTest::newRow("customParserIdNotAllowed") << "customParserIdNotAllowed.qml" << "customParserIdNotAllowed.errors.txt" << false; + + QTest::newRow("invalidGroupedProperty.1") << "invalidGroupedProperty.1.qml" << "invalidGroupedProperty.1.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.2") << "invalidGroupedProperty.2.qml" << "invalidGroupedProperty.2.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.3") << "invalidGroupedProperty.3.qml" << "invalidGroupedProperty.3.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.4") << "invalidGroupedProperty.4.qml" << "invalidGroupedProperty.4.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.5") << "invalidGroupedProperty.5.qml" << "invalidGroupedProperty.5.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.6") << "invalidGroupedProperty.6.qml" << "invalidGroupedProperty.6.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.7") << "invalidGroupedProperty.7.qml" << "invalidGroupedProperty.7.errors.txt" << true; + QTest::newRow("invalidGroupedProperty.8") << "invalidGroupedProperty.8.qml" << "invalidGroupedProperty.8.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.9") << "invalidGroupedProperty.9.qml" << "invalidGroupedProperty.9.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.10") << "invalidGroupedProperty.10.qml" << "invalidGroupedProperty.10.errors.txt" << false; + + QTest::newRow("importNamespaceConflict") << "importNamespaceConflict.qml" << "importNamespaceConflict.errors.txt" << false; + QTest::newRow("importVersionMissing (builtin)") << "importVersionMissingBuiltIn.qml" << "importVersionMissingBuiltIn.errors.txt" << false; + QTest::newRow("importVersionMissing (installed)") << "importVersionMissingInstalled.qml" << "importVersionMissingInstalled.errors.txt" << false; + QTest::newRow("importNonExist (installed)") << "importNonExist.qml" << "importNonExist.errors.txt" << false; + QTest::newRow("importNonExistOlder (installed)") << "importNonExistOlder.qml" << "importNonExistOlder.errors.txt" << false; + QTest::newRow("importNewerVersion (installed)") << "importNewerVersion.qml" << "importNewerVersion.errors.txt" << false; + QTest::newRow("invalidImportID") << "invalidImportID.qml" << "invalidImportID.errors.txt" << false; + QTest::newRow("importFile") << "importFile.qml" << "importFile.errors.txt" << false; + + QTest::newRow("signal.1") << "signal.1.qml" << "signal.1.errors.txt" << false; + QTest::newRow("signal.2") << "signal.2.qml" << "signal.2.errors.txt" << false; + QTest::newRow("signal.3") << "signal.3.qml" << "signal.3.errors.txt" << false; + QTest::newRow("signal.4") << "signal.4.qml" << "signal.4.errors.txt" << false; + + QTest::newRow("method.1") << "method.1.qml" << "method.1.errors.txt" << false; + + QTest::newRow("property.1") << "property.1.qml" << "property.1.errors.txt" << false; + QTest::newRow("property.2") << "property.2.qml" << "property.2.errors.txt" << false; + QTest::newRow("property.3") << "property.3.qml" << "property.3.errors.txt" << false; + QTest::newRow("property.4") << "property.4.qml" << "property.4.errors.txt" << false; + QTest::newRow("property.6") << "property.6.qml" << "property.6.errors.txt" << false; + QTest::newRow("property.7") << "property.7.qml" << "property.7.errors.txt" << false; + + QTest::newRow("importScript.1") << "importscript.1.qml" << "importscript.1.errors.txt" << false; + + QTest::newRow("Component.1") << "component.1.qml" << "component.1.errors.txt" << false; + QTest::newRow("Component.2") << "component.2.qml" << "component.2.errors.txt" << false; + QTest::newRow("Component.3") << "component.3.qml" << "component.3.errors.txt" << false; + QTest::newRow("Component.4") << "component.4.qml" << "component.4.errors.txt" << false; + QTest::newRow("Component.5") << "component.5.qml" << "component.5.errors.txt" << false; + QTest::newRow("Component.6") << "component.6.qml" << "component.6.errors.txt" << false; + QTest::newRow("Component.7") << "component.7.qml" << "component.7.errors.txt" << false; + QTest::newRow("Component.8") << "component.8.qml" << "component.8.errors.txt" << false; + QTest::newRow("Component.9") << "component.9.qml" << "component.9.errors.txt" << false; + + QTest::newRow("MultiSet.1") << "multiSet.1.qml" << "multiSet.1.errors.txt" << false; + QTest::newRow("MultiSet.2") << "multiSet.2.qml" << "multiSet.2.errors.txt" << false; + QTest::newRow("MultiSet.3") << "multiSet.3.qml" << "multiSet.3.errors.txt" << false; + QTest::newRow("MultiSet.4") << "multiSet.4.qml" << "multiSet.4.errors.txt" << false; + QTest::newRow("MultiSet.5") << "multiSet.5.qml" << "multiSet.5.errors.txt" << false; + QTest::newRow("MultiSet.6") << "multiSet.6.qml" << "multiSet.6.errors.txt" << false; + QTest::newRow("MultiSet.7") << "multiSet.7.qml" << "multiSet.7.errors.txt" << false; + QTest::newRow("MultiSet.8") << "multiSet.8.qml" << "multiSet.8.errors.txt" << false; + QTest::newRow("MultiSet.9") << "multiSet.9.qml" << "multiSet.9.errors.txt" << false; + QTest::newRow("MultiSet.10") << "multiSet.10.qml" << "multiSet.10.errors.txt" << false; + QTest::newRow("MultiSet.11") << "multiSet.11.qml" << "multiSet.11.errors.txt" << false; + + QTest::newRow("dynamicMeta.1") << "dynamicMeta.1.qml" << "dynamicMeta.1.errors.txt" << false; + QTest::newRow("dynamicMeta.2") << "dynamicMeta.2.qml" << "dynamicMeta.2.errors.txt" << false; + QTest::newRow("dynamicMeta.3") << "dynamicMeta.3.qml" << "dynamicMeta.3.errors.txt" << false; + QTest::newRow("dynamicMeta.4") << "dynamicMeta.4.qml" << "dynamicMeta.4.errors.txt" << false; + QTest::newRow("dynamicMeta.5") << "dynamicMeta.5.qml" << "dynamicMeta.5.errors.txt" << false; + + QTest::newRow("invalidAlias.1") << "invalidAlias.1.qml" << "invalidAlias.1.errors.txt" << false; + QTest::newRow("invalidAlias.2") << "invalidAlias.2.qml" << "invalidAlias.2.errors.txt" << false; + QTest::newRow("invalidAlias.3") << "invalidAlias.3.qml" << "invalidAlias.3.errors.txt" << false; + QTest::newRow("invalidAlias.4") << "invalidAlias.4.qml" << "invalidAlias.4.errors.txt" << false; + QTest::newRow("invalidAlias.5") << "invalidAlias.5.qml" << "invalidAlias.5.errors.txt" << false; + QTest::newRow("invalidAlias.6") << "invalidAlias.6.qml" << "invalidAlias.6.errors.txt" << false; + QTest::newRow("invalidAlias.7") << "invalidAlias.7.qml" << "invalidAlias.7.errors.txt" << false; + QTest::newRow("invalidAlias.8") << "invalidAlias.8.qml" << "invalidAlias.8.errors.txt" << false; + QTest::newRow("invalidAlias.9") << "invalidAlias.9.qml" << "invalidAlias.9.errors.txt" << false; + QTest::newRow("invalidAlias.10") << "invalidAlias.10.qml" << "invalidAlias.10.errors.txt" << false; + + QTest::newRow("invalidAttachedProperty.1") << "invalidAttachedProperty.1.qml" << "invalidAttachedProperty.1.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.2") << "invalidAttachedProperty.2.qml" << "invalidAttachedProperty.2.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.3") << "invalidAttachedProperty.3.qml" << "invalidAttachedProperty.3.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.4") << "invalidAttachedProperty.4.qml" << "invalidAttachedProperty.4.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.5") << "invalidAttachedProperty.5.qml" << "invalidAttachedProperty.5.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.6") << "invalidAttachedProperty.6.qml" << "invalidAttachedProperty.6.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.7") << "invalidAttachedProperty.7.qml" << "invalidAttachedProperty.7.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.8") << "invalidAttachedProperty.8.qml" << "invalidAttachedProperty.8.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.9") << "invalidAttachedProperty.9.qml" << "invalidAttachedProperty.9.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.10") << "invalidAttachedProperty.10.qml" << "invalidAttachedProperty.10.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.11") << "invalidAttachedProperty.11.qml" << "invalidAttachedProperty.11.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.12") << "invalidAttachedProperty.12.qml" << "invalidAttachedProperty.12.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.13") << "invalidAttachedProperty.13.qml" << "invalidAttachedProperty.13.errors.txt" << false; + + QTest::newRow("assignValueToSignal") << "assignValueToSignal.qml" << "assignValueToSignal.errors.txt" << false; + QTest::newRow("emptySignal") << "emptySignal.qml" << "emptySignal.errors.txt" << false; + + QTest::newRow("nestedErrors") << "nestedErrors.qml" << "nestedErrors.errors.txt" << false; + QTest::newRow("defaultGrouped") << "defaultGrouped.qml" << "defaultGrouped.errors.txt" << false; + QTest::newRow("doubleSignal") << "doubleSignal.qml" << "doubleSignal.errors.txt" << false; + QTest::newRow("missingValueTypeProperty") << "missingValueTypeProperty.qml" << "missingValueTypeProperty.errors.txt" << false; + QTest::newRow("objectValueTypeProperty") << "objectValueTypeProperty.qml" << "objectValueTypeProperty.errors.txt" << false; + QTest::newRow("enumTypes") << "enumTypes.qml" << "enumTypes.errors.txt" << false; + QTest::newRow("noCreation") << "noCreation.qml" << "noCreation.errors.txt" << false; + QTest::newRow("destroyedSignal") << "destroyedSignal.qml" << "destroyedSignal.errors.txt" << false; + QTest::newRow("assignToNamespace") << "assignToNamespace.qml" << "assignToNamespace.errors.txt" << false; + QTest::newRow("invalidOn") << "invalidOn.qml" << "invalidOn.errors.txt" << false; + QTest::newRow("invalidProperty") << "invalidProperty.qml" << "invalidProperty.errors.txt" << false; + QTest::newRow("nonScriptableProperty") << "nonScriptableProperty.qml" << "nonScriptableProperty.errors.txt" << false; + QTest::newRow("notAvailable") << "notAvailable.qml" << "notAvailable.errors.txt" << false; + QTest::newRow("singularProperty") << "singularProperty.qml" << "singularProperty.errors.txt" << false; + QTest::newRow("singularProperty.2") << "singularProperty.2.qml" << "singularProperty.2.errors.txt" << false; + QTest::newRow("incorrectCase") << "incorrectCase.qml" +#if defined(Q_OS_MAC) || defined(Q_OS_WIN32) + << "incorrectCase.errors.insensitive.txt" +#else + << "incorrectCase.errors.sensitive.txt" +#endif + << false; + + QTest::newRow("metaobjectRevision.1") << "metaobjectRevision.1.qml" << "metaobjectRevision.1.errors.txt" << false; + QTest::newRow("metaobjectRevision.2") << "metaobjectRevision.2.qml" << "metaobjectRevision.2.errors.txt" << false; + QTest::newRow("metaobjectRevision.3") << "metaobjectRevision.3.qml" << "metaobjectRevision.3.errors.txt" << false; + + QTest::newRow("invalidRoot.1") << "invalidRoot.1.qml" << "invalidRoot.1.errors.txt" << false; + QTest::newRow("invalidRoot.2") << "invalidRoot.2.qml" << "invalidRoot.2.errors.txt" << false; + QTest::newRow("invalidRoot.3") << "invalidRoot.3.qml" << "invalidRoot.3.errors.txt" << false; + QTest::newRow("invalidRoot.4") << "invalidRoot.4.qml" << "invalidRoot.4.errors.txt" << false; + + QTest::newRow("invalidTypeName.1") << "invalidTypeName.1.qml" << "invalidTypeName.1.errors.txt" << false; + QTest::newRow("invalidTypeName.2") << "invalidTypeName.2.qml" << "invalidTypeName.2.errors.txt" << false; + QTest::newRow("invalidTypeName.3") << "invalidTypeName.3.qml" << "invalidTypeName.3.errors.txt" << false; + QTest::newRow("invalidTypeName.4") << "invalidTypeName.4.qml" << "invalidTypeName.4.errors.txt" << false; + + QTest::newRow("Major version isolation") << "majorVersionIsolation.qml" << "majorVersionIsolation.errors.txt" << false; +} + + +void tst_qqmllanguage::errors() +{ + QFETCH(QString, file); + QFETCH(QString, errorFile); + QFETCH(bool, create); + + QQmlComponent component(&engine, TEST_FILE(file)); + + if(create) { + QObject *object = component.create(); + QVERIFY(object == 0); + } + + VERIFY_ERRORS(errorFile.toLatin1().constData()); +} + +void tst_qqmllanguage::simpleObject() +{ + QQmlComponent component(&engine, TEST_FILE("simpleObject.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +void tst_qqmllanguage::simpleContainer() +{ + QQmlComponent component(&engine, TEST_FILE("simpleContainer.qml")); + VERIFY_ERRORS(0); + MyContainer *container= qobject_cast<MyContainer*>(component.create()); + QVERIFY(container != 0); + QCOMPARE(container->getChildren()->count(),2); +} + +void tst_qqmllanguage::interfaceProperty() +{ + QQmlComponent component(&engine, TEST_FILE("interfaceProperty.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->interface()); + QVERIFY(object->interface()->id == 913); +} + +void tst_qqmllanguage::interfaceQList() +{ + QQmlComponent component(&engine, TEST_FILE("interfaceQList.qml")); + VERIFY_ERRORS(0); + MyContainer *container= qobject_cast<MyContainer*>(component.create()); + QVERIFY(container != 0); + QVERIFY(container->getQListInterfaces()->count() == 2); + for(int ii = 0; ii < 2; ++ii) + QVERIFY(container->getQListInterfaces()->at(ii)->id == 913); +} + +void tst_qqmllanguage::assignObjectToSignal() +{ + QQmlComponent component(&engine, TEST_FILE("assignObjectToSignal.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); + emit object->basicSignal(); +} + +void tst_qqmllanguage::assignObjectToVariant() +{ + QQmlComponent component(&engine, TEST_FILE("assignObjectToVariant.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QVariant v = object->property("a"); + QVERIFY(v.userType() == qMetaTypeId<QObject *>()); +} + +void tst_qqmllanguage::assignLiteralSignalProperty() +{ + QQmlComponent component(&engine, TEST_FILE("assignLiteralSignalProperty.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->onLiteralSignal(), 10); +} + +// Test is an external component can be loaded and assigned (to a qlist) +void tst_qqmllanguage::assignQmlComponent() +{ + QQmlComponent component(&engine, TEST_FILE("assignQmlComponent.qml")); + VERIFY_ERRORS(0); + MyContainer *object = qobject_cast<MyContainer *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->getChildren()->count() == 1); + QObject *child = object->getChildren()->at(0); + QCOMPARE(child->property("x"), QVariant(10)); + QCOMPARE(child->property("y"), QVariant(11)); +} + +// Test literal assignment to all the basic types +void tst_qqmllanguage::assignBasicTypes() +{ + QQmlComponent component(&engine, TEST_FILE("assignBasicTypes.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); + QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); + QCOMPARE(object->stringProperty(), QString("Hello World!")); + QCOMPARE(object->uintProperty(), uint(10)); + QCOMPARE(object->intProperty(), -19); + QCOMPARE((float)object->realProperty(), float(23.2)); + QCOMPARE((float)object->doubleProperty(), float(-19.7)); + QCOMPARE((float)object->floatProperty(), float(8.5)); + QCOMPARE(object->colorProperty(), QColor("red")); + QCOMPARE(object->dateProperty(), QDate(1982, 11, 25)); + QCOMPARE(object->timeProperty(), QTime(11, 11, 32)); + QCOMPARE(object->dateTimeProperty(), QDateTime(QDate(2009, 5, 12), QTime(13, 22, 1))); + QCOMPARE(object->pointProperty(), QPoint(99,13)); + QCOMPARE(object->pointFProperty(), QPointF(-10.1, 12.3)); + QCOMPARE(object->sizeProperty(), QSize(99, 13)); + QCOMPARE(object->sizeFProperty(), QSizeF(0.1, 0.2)); + QCOMPARE(object->rectProperty(), QRect(9, 7, 100, 200)); + QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99)); + QCOMPARE(object->boolProperty(), true); + QCOMPARE(object->variantProperty(), QVariant("Hello World!")); + QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2)); + QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2, 2.3)); + QUrl encoded; + encoded.setEncodedUrl("main.qml?with%3cencoded%3edata", QUrl::TolerantMode); + QCOMPARE(object->urlProperty(), component.url().resolved(encoded)); + QVERIFY(object->objectProperty() != 0); + MyTypeObject *child = qobject_cast<MyTypeObject *>(object->objectProperty()); + QVERIFY(child != 0); + QCOMPARE(child->intProperty(), 8); +} + +// Test edge case type assignments +void tst_qqmllanguage::assignTypeExtremes() +{ + QQmlComponent component(&engine, TEST_FILE("assignTypeExtremes.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->uintProperty(), 0xEE6B2800); + QCOMPARE(object->intProperty(), -0x77359400); +} + +// Test that a composite type can assign to a property of its base type +void tst_qqmllanguage::assignCompositeToType() +{ + QQmlComponent component(&engine, TEST_FILE("assignCompositeToType.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +// Test that literals are stored correctly in variant properties +void tst_qqmllanguage::assignLiteralToVariant() +{ + QQmlComponent component(&engine, TEST_FILE("assignLiteralToVariant.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").userType(), (int)QVariant::Int); + QCOMPARE(object->property("test2").userType(), (int)QMetaType::Double); + QCOMPARE(object->property("test3").userType(), (int)QVariant::String); + QCOMPARE(object->property("test4").userType(), (int)QVariant::Color); + QCOMPARE(object->property("test5").userType(), (int)QVariant::RectF); + QCOMPARE(object->property("test6").userType(), (int)QVariant::PointF); + QCOMPARE(object->property("test7").userType(), (int)QVariant::SizeF); + QCOMPARE(object->property("test8").userType(), (int)QVariant::Vector3D); + QCOMPARE(object->property("test9").userType(), (int)QVariant::String); + QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool); + QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool); + QCOMPARE(object->property("test12").userType(), (int)QVariant::Vector4D); + + QVERIFY(object->property("test1") == QVariant(1)); + QVERIFY(object->property("test2") == QVariant((double)1.7)); + QVERIFY(object->property("test3") == QVariant(QString(QLatin1String("Hello world!")))); + QVERIFY(object->property("test4") == QVariant(QColor::fromRgb(0xFF008800))); + QVERIFY(object->property("test5") == QVariant(QRectF(10, 10, 10, 10))); + QVERIFY(object->property("test6") == QVariant(QPointF(10, 10))); + QVERIFY(object->property("test7") == QVariant(QSizeF(10, 10))); + QVERIFY(object->property("test8") == QVariant(QVector3D(100, 100, 100))); + QVERIFY(object->property("test9") == QVariant(QString(QLatin1String("#FF008800")))); + QVERIFY(object->property("test10") == QVariant(bool(true))); + QVERIFY(object->property("test11") == QVariant(bool(false))); + QVERIFY(object->property("test12") == QVariant(QVector4D(100, 100, 100, 100))); + + delete object; +} + +// Test that literals are stored correctly in "var" properties +// Note that behaviour differs from "variant" properties in that +// no conversion from "special strings" to QVariants is performed. +void tst_qqmllanguage::assignLiteralToVar() +{ + QQmlComponent component(&engine, TEST_FILE("assignLiteralToVar.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").userType(), (int)QMetaType::Int); + QCOMPARE(object->property("test2").userType(), (int)QMetaType::Double); + QCOMPARE(object->property("test3").userType(), (int)QVariant::String); + QCOMPARE(object->property("test4").userType(), (int)QVariant::String); + QCOMPARE(object->property("test5").userType(), (int)QVariant::String); + QCOMPARE(object->property("test6").userType(), (int)QVariant::String); + QCOMPARE(object->property("test7").userType(), (int)QVariant::String); + QCOMPARE(object->property("test8").userType(), (int)QVariant::String); + QCOMPARE(object->property("test9").userType(), (int)QVariant::String); + QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool); + QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool); + QCOMPARE(object->property("test12").userType(), (int)QVariant::Color); + QCOMPARE(object->property("test13").userType(), (int)QVariant::RectF); + QCOMPARE(object->property("test14").userType(), (int)QVariant::PointF); + QCOMPARE(object->property("test15").userType(), (int)QVariant::SizeF); + QCOMPARE(object->property("test16").userType(), (int)QVariant::Vector3D); + QCOMPARE(object->property("variantTest1Bound").userType(), (int)QMetaType::Int); + QCOMPARE(object->property("test1Bound").userType(), (int)QMetaType::Int); + + QCOMPARE(object->property("test1"), QVariant(5)); + QCOMPARE(object->property("test2"), QVariant((double)1.7)); + QCOMPARE(object->property("test3"), QVariant(QString(QLatin1String("Hello world!")))); + QCOMPARE(object->property("test4"), QVariant(QString(QLatin1String("#FF008800")))); + QCOMPARE(object->property("test5"), QVariant(QString(QLatin1String("10,10,10x10")))); + QCOMPARE(object->property("test6"), QVariant(QString(QLatin1String("10,10")))); + QCOMPARE(object->property("test7"), QVariant(QString(QLatin1String("10x10")))); + QCOMPARE(object->property("test8"), QVariant(QString(QLatin1String("100,100,100")))); + QCOMPARE(object->property("test9"), QVariant(QString(QLatin1String("#FF008800")))); + QCOMPARE(object->property("test10"), QVariant(bool(true))); + QCOMPARE(object->property("test11"), QVariant(bool(false))); + QCOMPARE(object->property("test12"), QVariant(QColor::fromRgbF(0.2, 0.3, 0.4, 0.5))); + QCOMPARE(object->property("test13"), QVariant(QRectF(10, 10, 10, 10))); + QCOMPARE(object->property("test14"), QVariant(QPointF(10, 10))); + QCOMPARE(object->property("test15"), QVariant(QSizeF(10, 10))); + QCOMPARE(object->property("test16"), QVariant(QVector3D(100, 100, 100))); + QCOMPARE(object->property("variantTest1Bound"), QVariant(9)); + QCOMPARE(object->property("test1Bound"), QVariant(11)); + + delete object; +} + +// Tests that custom parser types can be instantiated +void tst_qqmllanguage::customParserTypes() +{ + QQmlComponent component(&engine, TEST_FILE("customParserTypes.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QVERIFY(object->property("count") == QVariant(2)); +} + +// Tests that the root item can be a custom component +void tst_qqmllanguage::rootAsQmlComponent() +{ + QQmlComponent component(&engine, TEST_FILE("rootAsQmlComponent.qml")); + VERIFY_ERRORS(0); + MyContainer *object = qobject_cast<MyContainer *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->property("x"), QVariant(11)); + QCOMPARE(object->getChildren()->count(), 2); +} + +// Tests that components can be specified inline +void tst_qqmllanguage::inlineQmlComponents() +{ + QQmlComponent component(&engine, TEST_FILE("inlineQmlComponents.qml")); + VERIFY_ERRORS(0); + MyContainer *object = qobject_cast<MyContainer *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->getChildren()->count(), 1); + QQmlComponent *comp = qobject_cast<QQmlComponent *>(object->getChildren()->at(0)); + QVERIFY(comp != 0); + MyQmlObject *compObject = qobject_cast<MyQmlObject *>(comp->create()); + QVERIFY(compObject != 0); + QCOMPARE(compObject->value(), 11); +} + +// Tests that types that have an id property have it set +void tst_qqmllanguage::idProperty() +{ + QQmlComponent component(&engine, TEST_FILE("idProperty.qml")); + VERIFY_ERRORS(0); + MyContainer *object = qobject_cast<MyContainer *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->getChildren()->count(), 1); + MyTypeObject *child = + qobject_cast<MyTypeObject *>(object->getChildren()->at(0)); + QVERIFY(child != 0); + QCOMPARE(child->id(), QString("myObjectId")); + QCOMPARE(object->property("object"), QVariant::fromValue((QObject *)child)); +} + +// Tests automatic connection to notify signals if "onBlahChanged" syntax is used +// even if the notify signal for "blah" is not called "blahChanged" +void tst_qqmllanguage::autoNotifyConnection() +{ + QQmlComponent component(&engine, TEST_FILE("autoNotifyConnection.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QMetaProperty prop = object->metaObject()->property(object->metaObject()->indexOfProperty("receivedNotify")); + QVERIFY(prop.isValid()); + + QCOMPARE(prop.read(object), QVariant::fromValue(false)); + object->setPropertyWithNotify(1); + QCOMPARE(prop.read(object), QVariant::fromValue(true)); +} + +// Tests that signals can be assigned to +void tst_qqmllanguage::assignSignal() +{ + QQmlComponent component(&engine, TEST_FILE("assignSignal.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); + emit object->basicSignal(); + QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlotWithArgs(9)"); + emit object->basicParameterizedSignal(9); +} + +// Tests the creation and assignment of dynamic properties +void tst_qqmllanguage::dynamicProperties() +{ + QQmlComponent component(&engine, TEST_FILE("dynamicProperties.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("intProperty"), QVariant(10)); + QCOMPARE(object->property("boolProperty"), QVariant(false)); + QCOMPARE(object->property("doubleProperty"), QVariant(-10.1)); + QCOMPARE(object->property("realProperty"), QVariant((qreal)-19.9)); + QCOMPARE(object->property("stringProperty"), QVariant("Hello World!")); + QCOMPARE(object->property("urlProperty"), QVariant(TEST_FILE("main.qml"))); + QCOMPARE(object->property("colorProperty"), QVariant(QColor("red"))); + QCOMPARE(object->property("dateProperty"), QVariant(QDate(1945, 9, 2))); + QCOMPARE(object->property("varProperty"), QVariant("Hello World!")); +} + +// Test that nested types can use dynamic properties +void tst_qqmllanguage::dynamicPropertiesNested() +{ + QQmlComponent component(&engine, TEST_FILE("dynamicPropertiesNested.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("super_a").toInt(), 11); // Overridden + QCOMPARE(object->property("super_c").toInt(), 14); // Inherited + QCOMPARE(object->property("a").toInt(), 13); // New + QCOMPARE(object->property("b").toInt(), 12); // New + + delete object; +} + +// Tests the creation and assignment to dynamic list properties +void tst_qqmllanguage::listProperties() +{ + QQmlComponent component(&engine, TEST_FILE("listProperties.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toInt(), 2); +} + +// Tests the creation and assignment of dynamic object properties +// ### Not complete +void tst_qqmllanguage::dynamicObjectProperties() +{ + { + QQmlComponent component(&engine, TEST_FILE("dynamicObjectProperties.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QVERIFY(object->property("objectProperty") == qVariantFromValue((QObject*)0)); + QVERIFY(object->property("objectProperty2") != qVariantFromValue((QObject*)0)); + } + { + QQmlComponent component(&engine, TEST_FILE("dynamicObjectProperties.2.qml")); + QEXPECT_FAIL("", "QTBUG-10822", Abort); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QVERIFY(object->property("objectProperty") != qVariantFromValue((QObject*)0)); + } +} + +// Tests the declaration of dynamic signals and slots +void tst_qqmllanguage::dynamicSignalsAndSlots() +{ + QTest::ignoreMessage(QtDebugMsg, "1921"); + + QQmlComponent component(&engine, TEST_FILE("dynamicSignalsAndSlots.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QVERIFY(object->metaObject()->indexOfMethod("signal1()") != -1); + QVERIFY(object->metaObject()->indexOfMethod("signal2()") != -1); + QVERIFY(object->metaObject()->indexOfMethod("slot1()") != -1); + QVERIFY(object->metaObject()->indexOfMethod("slot2()") != -1); + + QCOMPARE(object->property("test").toInt(), 0); + QMetaObject::invokeMethod(object, "slot3", Qt::DirectConnection, Q_ARG(QVariant, QVariant(10))); + QCOMPARE(object->property("test").toInt(), 10); +} + +void tst_qqmllanguage::simpleBindings() +{ + QQmlComponent component(&engine, TEST_FILE("simpleBindings.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("value1"), QVariant(10)); + QCOMPARE(object->property("value2"), QVariant(10)); + QCOMPARE(object->property("value3"), QVariant(21)); + QCOMPARE(object->property("value4"), QVariant(10)); + QCOMPARE(object->property("objectProperty"), QVariant::fromValue(object)); +} + +void tst_qqmllanguage::autoComponentCreation() +{ + QQmlComponent component(&engine, TEST_FILE("autoComponentCreation.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->componentProperty() != 0); + MyTypeObject *child = qobject_cast<MyTypeObject *>(object->componentProperty()->create()); + QVERIFY(child != 0); + QCOMPARE(child->realProperty(), qreal(9)); +} + +void tst_qqmllanguage::propertyValueSource() +{ + { + QQmlComponent component(&engine, TEST_FILE("propertyValueSource.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QList<QObject *> valueSources; + QObjectList allChildren = object->findChildren<QObject*>(); + foreach (QObject *child, allChildren) { + if (qobject_cast<QQmlPropertyValueSource *>(child)) + valueSources.append(child); + } + + QCOMPARE(valueSources.count(), 1); + MyPropertyValueSource *valueSource = + qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); + QVERIFY(valueSource != 0); + QCOMPARE(valueSource->prop.object(), qobject_cast<QObject*>(object)); + QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty"))); + } + + { + QQmlComponent component(&engine, TEST_FILE("propertyValueSource.2.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QList<QObject *> valueSources; + QObjectList allChildren = object->findChildren<QObject*>(); + foreach (QObject *child, allChildren) { + if (qobject_cast<QQmlPropertyValueSource *>(child)) + valueSources.append(child); + } + + QCOMPARE(valueSources.count(), 1); + MyPropertyValueSource *valueSource = + qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); + QVERIFY(valueSource != 0); + QCOMPARE(valueSource->prop.object(), qobject_cast<QObject*>(object)); + QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty"))); + } +} + +void tst_qqmllanguage::attachedProperties() +{ + QQmlComponent component(&engine, TEST_FILE("attachedProperties.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QObject *attached = qmlAttachedPropertiesObject<MyQmlObject>(object); + QVERIFY(attached != 0); + QCOMPARE(attached->property("value"), QVariant(10)); + QCOMPARE(attached->property("value2"), QVariant(13)); +} + +// Tests non-static object properties +void tst_qqmllanguage::dynamicObjects() +{ + QQmlComponent component(&engine, TEST_FILE("dynamicObject.1.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +// Tests the registration of custom variant string converters +void tst_qqmllanguage::customVariantTypes() +{ + QQmlComponent component(&engine, TEST_FILE("customVariantTypes.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->customType().a, 10); +} + +void tst_qqmllanguage::valueTypes() +{ + QQmlComponent component(&engine, TEST_FILE("valueTypes.qml")); + VERIFY_ERRORS(0); + + QString message = component.url().toString() + ":2:1: QML MyTypeObject: Binding loop detected for property \"rectProperty.width\""; + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + + MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); + QVERIFY(object != 0); + + + QCOMPARE(object->rectProperty(), QRect(10, 11, 12, 13)); + QCOMPARE(object->rectProperty2(), QRect(10, 11, 12, 13)); + QCOMPARE(object->intProperty(), 10); + object->doAction(); + QCOMPARE(object->rectProperty(), QRect(12, 11, 14, 13)); + QCOMPARE(object->rectProperty2(), QRect(12, 11, 14, 13)); + QCOMPARE(object->intProperty(), 12); + + // ### +#if 0 + QQmlProperty p(object, "rectProperty.x"); + QCOMPARE(p.read(), QVariant(12)); + p.write(13); + QCOMPARE(p.read(), QVariant(13)); + + quint32 r = QQmlPropertyPrivate::saveValueType(p.coreIndex(), p.valueTypeCoreIndex()); + QQmlProperty p2; + QQmlPropertyPrivate::restore(p2, r, object); + QCOMPARE(p2.read(), QVariant(13)); +#endif +} + +void tst_qqmllanguage::cppnamespace() +{ + { + QQmlComponent component(&engine, TEST_FILE("cppnamespace.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; + } + + { + QQmlComponent component(&engine, TEST_FILE("cppnamespace.2.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; + } +} + +void tst_qqmllanguage::aliasProperties() +{ + // Simple "int" alias + { + QQmlComponent component(&engine, TEST_FILE("alias.1.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + // Read through alias + QCOMPARE(object->property("valueAlias").toInt(), 10); + object->setProperty("value", QVariant(13)); + QCOMPARE(object->property("valueAlias").toInt(), 13); + + // Write through alias + object->setProperty("valueAlias", QVariant(19)); + QCOMPARE(object->property("valueAlias").toInt(), 19); + QCOMPARE(object->property("value").toInt(), 19); + + delete object; + } + + // Complex object alias + { + QQmlComponent component(&engine, TEST_FILE("alias.2.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + // Read through alias + MyQmlObject *v = + qvariant_cast<MyQmlObject *>(object->property("aliasObject")); + QVERIFY(v != 0); + QCOMPARE(v->value(), 10); + + // Write through alias + MyQmlObject *v2 = new MyQmlObject(); + v2->setParent(object); + object->setProperty("aliasObject", qVariantFromValue(v2)); + MyQmlObject *v3 = + qvariant_cast<MyQmlObject *>(object->property("aliasObject")); + QVERIFY(v3 != 0); + QCOMPARE(v3, v2); + + delete object; + } + + // Nested aliases + { + QQmlComponent component(&engine, TEST_FILE("alias.3.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("value").toInt(), 1892); + QCOMPARE(object->property("value2").toInt(), 1892); + + object->setProperty("value", QVariant(1313)); + QCOMPARE(object->property("value").toInt(), 1313); + QCOMPARE(object->property("value2").toInt(), 1313); + + object->setProperty("value2", QVariant(8080)); + QCOMPARE(object->property("value").toInt(), 8080); + QCOMPARE(object->property("value2").toInt(), 8080); + + delete object; + } + + // Enum aliases + { + QQmlComponent component(&engine, TEST_FILE("alias.4.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("enumAlias").toInt(), 1); + + delete object; + } + + // Id aliases + { + QQmlComponent component(&engine, TEST_FILE("alias.5.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QVariant v = object->property("otherAlias"); + QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>()); + MyQmlObject *o = qvariant_cast<MyQmlObject*>(v); + QCOMPARE(o->value(), 10); + + delete o; + + v = object->property("otherAlias"); + QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>()); + o = qvariant_cast<MyQmlObject*>(v); + QVERIFY(o == 0); + + delete object; + } + + // Nested aliases - this used to cause a crash + { + QQmlComponent component(&engine, TEST_FILE("alias.6.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("a").toInt(), 1923); + } + + // Ptr Alias Cleanup - check that aliases to ptr types return 0 + // if the object aliased to is removed + { + QQmlComponent component(&engine, TEST_FILE("alias.7.qml")); + VERIFY_ERRORS(0); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QObject *object1 = qvariant_cast<QObject *>(object->property("object")); + QVERIFY(object1 != 0); + QObject *object2 = qvariant_cast<QObject *>(object1->property("object")); + QVERIFY(object2 != 0); + + QObject *alias = qvariant_cast<QObject *>(object->property("aliasedObject")); + QVERIFY(alias == object2); + + delete object1; + + QObject *alias2 = object; // "Random" start value + int status = -1; + void *a[] = { &alias2, 0, &status }; + QMetaObject::metacall(object, QMetaObject::ReadProperty, + object->metaObject()->indexOfProperty("aliasedObject"), a); + QVERIFY(alias2 == 0); + } + + // Simple composite type + { + QQmlComponent component(&engine, TEST_FILE("alias.8.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("value").toInt(), 10); + + delete object; + } + + // Complex composite type + { + QQmlComponent component(&engine, TEST_FILE("alias.9.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("value").toInt(), 10); + + delete object; + } + + // Valuetype alias + // Simple "int" alias + { + QQmlComponent component(&engine, TEST_FILE("alias.10.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + // Read through alias + QCOMPARE(object->property("valueAlias").toRect(), QRect(10, 11, 9, 8)); + object->setProperty("rectProperty", QVariant(QRect(33, 12, 99, 100))); + QCOMPARE(object->property("valueAlias").toRect(), QRect(33, 12, 99, 100)); + + // Write through alias + object->setProperty("valueAlias", QVariant(QRect(3, 3, 4, 9))); + QCOMPARE(object->property("valueAlias").toRect(), QRect(3, 3, 4, 9)); + QCOMPARE(object->property("rectProperty").toRect(), QRect(3, 3, 4, 9)); + + delete object; + } + + // Valuetype sub-alias + { + QQmlComponent component(&engine, TEST_FILE("alias.11.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + // Read through alias + QCOMPARE(object->property("aliasProperty").toInt(), 19); + object->setProperty("rectProperty", QVariant(QRect(33, 8, 102, 111))); + QCOMPARE(object->property("aliasProperty").toInt(), 33); + + // Write through alias + object->setProperty("aliasProperty", QVariant(4)); + QCOMPARE(object->property("aliasProperty").toInt(), 4); + QCOMPARE(object->property("rectProperty").toRect(), QRect(4, 8, 102, 111)); + + delete object; + } +} + +// QTBUG-13374 Test that alias properties and signals can coexist +void tst_qqmllanguage::aliasPropertiesAndSignals() +{ + QQmlComponent component(&engine, TEST_FILE("aliasPropertiesAndSignals.qml")); + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o); + QCOMPARE(o->property("test").toBool(), true); + delete o; +} + +// Test that the root element in a composite type can be a Component +void tst_qqmllanguage::componentCompositeType() +{ + QQmlComponent component(&engine, TEST_FILE("componentCompositeType.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +class TestType : public QObject { + Q_OBJECT +public: + TestType(QObject *p=0) : QObject(p) {} +}; + +class TestType2 : public QObject { + Q_OBJECT +public: + TestType2(QObject *p=0) : QObject(p) {} +}; + +void tst_qqmllanguage::i18n_data() +{ + QTest::addColumn<QString>("file"); + QTest::addColumn<QString>("stringProperty"); + QTest::newRow("i18nStrings") << "i18nStrings.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245 (5 accented 'a' letters)"); + QTest::newRow("i18nDeclaredPropertyNames") << "i18nDeclaredPropertyNames.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 10"); + QTest::newRow("i18nDeclaredPropertyUse") << "i18nDeclaredPropertyUse.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 15"); + QTest::newRow("i18nScript") << "i18nScript.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 20"); + QTest::newRow("i18nType") << "i18nType.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 30"); + QTest::newRow("i18nNameSpace") << "i18nNameSpace.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 40"); +} + +void tst_qqmllanguage::i18n() +{ + QFETCH(QString, file); + QFETCH(QString, stringProperty); + QQmlComponent component(&engine, TEST_FILE(file)); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->stringProperty(), stringProperty); + + delete object; +} + +// Check that the Component::onCompleted attached property works +void tst_qqmllanguage::onCompleted() +{ + QQmlComponent component(&engine, TEST_FILE("onCompleted.qml")); + VERIFY_ERRORS(0); + QTest::ignoreMessage(QtDebugMsg, "Completed 6 10"); + QTest::ignoreMessage(QtDebugMsg, "Completed 6 10"); + QTest::ignoreMessage(QtDebugMsg, "Completed 10 11"); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +// Check that the Component::onDestruction attached property works +void tst_qqmllanguage::onDestruction() +{ + QQmlComponent component(&engine, TEST_FILE("onDestruction.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QTest::ignoreMessage(QtDebugMsg, "Destruction 6 10"); + QTest::ignoreMessage(QtDebugMsg, "Destruction 6 10"); + QTest::ignoreMessage(QtDebugMsg, "Destruction 10 11"); + delete object; +} + +// Check that assignments to QQmlScriptString properties work +void tst_qqmllanguage::scriptString() +{ + { + QQmlComponent component(&engine, TEST_FILE("scriptString.qml")); + VERIFY_ERRORS(0); + + MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->scriptProperty().script(), QString("foo + bar")); + QCOMPARE(object->scriptProperty().scopeObject(), qobject_cast<QObject*>(object)); + QCOMPARE(object->scriptProperty().context(), qmlContext(object)); + + QVERIFY(object->grouped() != 0); + QCOMPARE(object->grouped()->script().script(), QString("console.log(1921)")); + QCOMPARE(object->grouped()->script().scopeObject(), qobject_cast<QObject*>(object)); + QCOMPARE(object->grouped()->script().context(), qmlContext(object)); + } + + { + QQmlComponent component(&engine, TEST_FILE("scriptString2.qml")); + VERIFY_ERRORS(0); + + MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->scriptProperty().script(), QString("\"hello\\n\\\"world\\\"\"")); + } + + { + QQmlComponent component(&engine, TEST_FILE("scriptString3.qml")); + VERIFY_ERRORS(0); + + MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->scriptProperty().script(), QString("12.345")); + } + + { + QQmlComponent component(&engine, TEST_FILE("scriptString4.qml")); + VERIFY_ERRORS(0); + + MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->scriptProperty().script(), QString("true")); + } +} + +// Check that default property assignments are correctly spliced into explicit +// property assignments +void tst_qqmllanguage::defaultPropertyListOrder() +{ + QQmlComponent component(&engine, TEST_FILE("defaultPropertyListOrder.qml")); + VERIFY_ERRORS(0); + + MyContainer *container = qobject_cast<MyContainer *>(component.create()); + QVERIFY(container != 0); + + QCOMPARE(container->getChildren()->count(), 6); + QCOMPARE(container->getChildren()->at(0)->property("index"), QVariant(0)); + QCOMPARE(container->getChildren()->at(1)->property("index"), QVariant(1)); + QCOMPARE(container->getChildren()->at(2)->property("index"), QVariant(2)); + QCOMPARE(container->getChildren()->at(3)->property("index"), QVariant(3)); + QCOMPARE(container->getChildren()->at(4)->property("index"), QVariant(4)); + QCOMPARE(container->getChildren()->at(5)->property("index"), QVariant(5)); +} + +void tst_qqmllanguage::declaredPropertyValues() +{ + QQmlComponent component(&engine, TEST_FILE("declaredPropertyValues.qml")); + VERIFY_ERRORS(0); +} + +void tst_qqmllanguage::dontDoubleCallClassBegin() +{ + QQmlComponent component(&engine, TEST_FILE("dontDoubleCallClassBegin.qml")); + QObject *o = component.create(); + QVERIFY(o); + + MyParserStatus *o2 = qobject_cast<MyParserStatus *>(qvariant_cast<QObject *>(o->property("object"))); + QVERIFY(o2); + QCOMPARE(o2->classBeginCount(), 1); + QCOMPARE(o2->componentCompleteCount(), 1); + + delete o; +} + +void tst_qqmllanguage::reservedWords_data() +{ + QTest::addColumn<QByteArray>("word"); + + QTest::newRow("abstract") << QByteArray("abstract"); + QTest::newRow("as") << QByteArray("as"); + QTest::newRow("boolean") << QByteArray("boolean"); + QTest::newRow("break") << QByteArray("break"); + QTest::newRow("byte") << QByteArray("byte"); + QTest::newRow("case") << QByteArray("case"); + QTest::newRow("catch") << QByteArray("catch"); + QTest::newRow("char") << QByteArray("char"); + QTest::newRow("class") << QByteArray("class"); + QTest::newRow("continue") << QByteArray("continue"); + QTest::newRow("const") << QByteArray("const"); + QTest::newRow("debugger") << QByteArray("debugger"); + QTest::newRow("default") << QByteArray("default"); + QTest::newRow("delete") << QByteArray("delete"); + QTest::newRow("do") << QByteArray("do"); + QTest::newRow("double") << QByteArray("double"); + QTest::newRow("else") << QByteArray("else"); + QTest::newRow("enum") << QByteArray("enum"); + QTest::newRow("export") << QByteArray("export"); + QTest::newRow("extends") << QByteArray("extends"); + QTest::newRow("false") << QByteArray("false"); + QTest::newRow("final") << QByteArray("final"); + QTest::newRow("finally") << QByteArray("finally"); + QTest::newRow("float") << QByteArray("float"); + QTest::newRow("for") << QByteArray("for"); + QTest::newRow("function") << QByteArray("function"); + QTest::newRow("goto") << QByteArray("goto"); + QTest::newRow("if") << QByteArray("if"); + QTest::newRow("implements") << QByteArray("implements"); + QTest::newRow("import") << QByteArray("import"); + QTest::newRow("in") << QByteArray("in"); + QTest::newRow("instanceof") << QByteArray("instanceof"); + QTest::newRow("int") << QByteArray("int"); + QTest::newRow("interface") << QByteArray("interface"); + QTest::newRow("long") << QByteArray("long"); + QTest::newRow("native") << QByteArray("native"); + QTest::newRow("new") << QByteArray("new"); + QTest::newRow("null") << QByteArray("null"); + QTest::newRow("package") << QByteArray("package"); + QTest::newRow("private") << QByteArray("private"); + QTest::newRow("protected") << QByteArray("protected"); + QTest::newRow("public") << QByteArray("public"); + QTest::newRow("return") << QByteArray("return"); + QTest::newRow("short") << QByteArray("short"); + QTest::newRow("static") << QByteArray("static"); + QTest::newRow("super") << QByteArray("super"); + QTest::newRow("switch") << QByteArray("switch"); + QTest::newRow("synchronized") << QByteArray("synchronized"); + QTest::newRow("this") << QByteArray("this"); + QTest::newRow("throw") << QByteArray("throw"); + QTest::newRow("throws") << QByteArray("throws"); + QTest::newRow("transient") << QByteArray("transient"); + QTest::newRow("true") << QByteArray("true"); + QTest::newRow("try") << QByteArray("try"); + QTest::newRow("typeof") << QByteArray("typeof"); + QTest::newRow("var") << QByteArray("var"); + QTest::newRow("void") << QByteArray("void"); + QTest::newRow("volatile") << QByteArray("volatile"); + QTest::newRow("while") << QByteArray("while"); + QTest::newRow("with") << QByteArray("with"); +} + +void tst_qqmllanguage::reservedWords() +{ + QFETCH(QByteArray, word); + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0\nQtObject { property string " + word + " }", QUrl()); + QCOMPARE(component.errorString(), QLatin1String(":2 Expected token `identifier'\n")); +} + +// Check that first child of qml is of given type. Empty type insists on error. +void tst_qqmllanguage::testType(const QString& qml, const QString& type, const QString& expectederror) +{ + QQmlComponent component(&engine); + component.setData(qml.toUtf8(), TEST_FILE("empty.qml")); // just a file for relative local imports + + QTRY_VERIFY(!component.isLoading()); + + if (type.isEmpty()) { + QVERIFY(component.isError()); + QString actualerror; + foreach (const QQmlError e, component.errors()) { + if (!actualerror.isEmpty()) + actualerror.append("; "); + actualerror.append(e.description()); + } + QCOMPARE(actualerror,expectederror); + } else { + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(QString(object->metaObject()->className()), type); + delete object; + } +} + +// QTBUG-17276 +void tst_qqmllanguage::inlineAssignmentsOverrideBindings() +{ + QQmlComponent component(&engine, TEST_FILE("inlineAssignmentsOverrideBindings.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test").toInt(), 11); + delete o; +} + +// QTBUG-19354 +void tst_qqmllanguage::nestedComponentRoots() +{ + QQmlComponent component(&engine, TEST_FILE("nestedComponentRoots.qml")); +} + +// Import tests (QT-558) +void tst_qqmllanguage::importsBuiltin_data() +{ + // QT-610 + + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("type"); + QTest::addColumn<QString>("error"); + + // import built-ins + QTest::newRow("missing import") + << "Test {}" + << "" + << "Test is not a type"; + QTest::newRow("not in version 0.0") + << "import com.nokia.Test 0.0\n" + "Test {}" + << "" + << "Test is not a type"; + QTest::newRow("version not installed") + << "import com.nokia.Test 99.0\n" + "Test {}" + << "" + << "module \"com.nokia.Test\" version 99.0 is not installed"; + QTest::newRow("in version 0.0") + << "import com.nokia.Test 0.0\n" + "TestTP {}" + << "TestType" + << ""; + QTest::newRow("qualified in version 0.0") + << "import com.nokia.Test 0.0 as T\n" + "T.TestTP {}" + << "TestType" + << ""; + QTest::newRow("in version 1.0") + << "import com.nokia.Test 1.0\n" + "Test {}" + << "TestType" + << ""; + QTest::newRow("qualified wrong") + << "import com.nokia.Test 1.0 as T\n" // QT-610 + "Test {}" + << "" + << "Test is not a type"; + QTest::newRow("qualified right") + << "import com.nokia.Test 1.0 as T\n" + "T.Test {}" + << "TestType" + << ""; + QTest::newRow("qualified right but not in version 0.0") + << "import com.nokia.Test 0.0 as T\n" + "T.Test {}" + << "" + << "T.Test is not a type"; + QTest::newRow("in version 1.1") + << "import com.nokia.Test 1.1\n" + "Test {}" + << "TestType" + << ""; + QTest::newRow("in version 1.3") + << "import com.nokia.Test 1.3\n" + "Test {}" + << "TestType" + << ""; + QTest::newRow("in version 1.5") + << "import com.nokia.Test 1.5\n" + "Test {}" + << "TestType" + << ""; + QTest::newRow("changed in version 1.8") + << "import com.nokia.Test 1.8\n" + "Test {}" + << "TestType2" + << ""; + QTest::newRow("in version 1.12") + << "import com.nokia.Test 1.12\n" + "Test {}" + << "TestType2" + << ""; + QTest::newRow("old in version 1.9") + << "import com.nokia.Test 1.9\n" + "OldTest {}" + << "TestType" + << ""; + QTest::newRow("old in version 1.11") + << "import com.nokia.Test 1.11\n" + "OldTest {}" + << "TestType" + << ""; + QTest::newRow("multiversion 1") + << "import com.nokia.Test 1.11\n" + "import com.nokia.Test 1.12\n" + "Test {}" + << (!qmlCheckTypes()?"TestType2":"") + << (!qmlCheckTypes()?"":"Test is ambiguous. Found in com/nokia/Test in version 1.12 and 1.11"); + QTest::newRow("multiversion 2") + << "import com.nokia.Test 1.11\n" + "import com.nokia.Test 1.12\n" + "OldTest {}" + << (!qmlCheckTypes()?"TestType":"") + << (!qmlCheckTypes()?"":"OldTest is ambiguous. Found in com/nokia/Test in version 1.12 and 1.11"); + QTest::newRow("qualified multiversion 3") + << "import com.nokia.Test 1.0 as T0\n" + "import com.nokia.Test 1.8 as T8\n" + "T0.Test {}" + << "TestType" + << ""; + QTest::newRow("qualified multiversion 4") + << "import com.nokia.Test 1.0 as T0\n" + "import com.nokia.Test 1.8 as T8\n" + "T8.Test {}" + << "TestType2" + << ""; +} + +void tst_qqmllanguage::importsBuiltin() +{ + QFETCH(QString, qml); + QFETCH(QString, type); + QFETCH(QString, error); + testType(qml,type,error); +} + +void tst_qqmllanguage::importsLocal_data() +{ + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("type"); + QTest::addColumn<QString>("error"); + + // import locals + QTest::newRow("local import") + << "import \"subdir\"\n" // QT-613 + "Test {}" + << "QQuickRectangle" + << ""; + QTest::newRow("local import second") + << "import QtQuick 2.0\nimport \"subdir\"\n" + "Test {}" + << "QQuickRectangle" + << ""; + QTest::newRow("local import subsubdir") + << "import QtQuick 2.0\nimport \"subdir/subsubdir\"\n" + "SubTest {}" + << "QQuickRectangle" + << ""; + QTest::newRow("local import QTBUG-7721 A") + << "subdir.Test {}" // no longer allowed (QTBUG-7721) + << "" + << "subdir.Test - subdir is not a namespace"; + QTest::newRow("local import QTBUG-7721 B") + << "import \"subdir\" as X\n" + "X.subsubdir.SubTest {}" // no longer allowed (QTBUG-7721) + << "" + << "X.subsubdir.SubTest - nested namespaces not allowed"; + QTest::newRow("local import as") + << "import \"subdir\" as T\n" + "T.Test {}" + << "QQuickRectangle" + << ""; + QTest::newRow("wrong local import as") + << "import \"subdir\" as T\n" + "Test {}" + << "" + << "Test is not a type"; + QTest::newRow("library precedence over local import") + << "import \"subdir\"\n" + "import com.nokia.Test 1.0\n" + "Test {}" + << (!qmlCheckTypes()?"TestType":"") + << (!qmlCheckTypes()?"":"Test is ambiguous. Found in com/nokia/Test and in subdir"); +} + +void tst_qqmllanguage::importsLocal() +{ + QFETCH(QString, qml); + QFETCH(QString, type); + QFETCH(QString, error); + testType(qml,type,error); +} + +void tst_qqmllanguage::basicRemote_data() +{ + QTest::addColumn<QUrl>("url"); + QTest::addColumn<QString>("type"); + QTest::addColumn<QString>("error"); + + QString serverdir = "http://127.0.0.1:14447/qtest/qml/qqmllanguage/"; + + QTest::newRow("no need for qmldir") << QUrl(serverdir+"Test.qml") << "" << ""; + QTest::newRow("absent qmldir") << QUrl(serverdir+"/noqmldir/Test.qml") << "" << ""; + QTest::newRow("need qmldir") << QUrl(serverdir+"TestLocal.qml") << "" << ""; +} + +void tst_qqmllanguage::basicRemote() +{ + QFETCH(QUrl, url); + QFETCH(QString, type); + QFETCH(QString, error); + + TestHTTPServer server(14447); + server.serveDirectory(testdata()); + + QQmlComponent component(&engine, url); + + QTRY_VERIFY(!component.isLoading()); + + if (error.isEmpty()) { + if (component.isError()) + qDebug() << component.errors(); + QVERIFY(!component.isError()); + } else { + QVERIFY(component.isError()); + } +} + +void tst_qqmllanguage::importsRemote_data() +{ + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("type"); + QTest::addColumn<QString>("error"); + + QString serverdir = "http://127.0.0.1:14447/qtest/qml/qqmllanguage"; + + QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QQuickRectangle" + << ""; + QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QQuickText" + << ""; + QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QQuickImage" + << ""; + QTest::newRow("wrong remote import with undeclared local") << "import \""+serverdir+"\"\nWrongTestLocal {}" << "" + << "WrongTestLocal is not a type"; + QTest::newRow("wrong remote import of internal local") << "import \""+serverdir+"\"\nLocalInternal {}" << "" + << "LocalInternal is not a type"; + QTest::newRow("wrong remote import of undeclared local") << "import \""+serverdir+"\"\nUndeclaredLocal {}" << "" + << "UndeclaredLocal is not a type"; +} + +void tst_qqmllanguage::importsRemote() +{ + QFETCH(QString, qml); + QFETCH(QString, type); + QFETCH(QString, error); + + TestHTTPServer server(14447); + server.serveDirectory(testdata()); + + testType(qml,type,error); +} + +void tst_qqmllanguage::importsInstalled_data() +{ + // QT-610 + + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("type"); + QTest::addColumn<QString>("error"); + + // import installed + QTest::newRow("installed import 0") + << "import com.nokia.installedtest0 0.0\n" + "InstalledTestTP {}" + << "QQuickRectangle" + << ""; + QTest::newRow("installed import 0 as TP") + << "import com.nokia.installedtest0 0.0 as TP\n" + "TP.InstalledTestTP {}" + << "QQuickRectangle" + << ""; + QTest::newRow("installed import 1") + << "import com.nokia.installedtest 1.0\n" + "InstalledTest {}" + << "QQuickRectangle" + << ""; + QTest::newRow("installed import 2") + << "import com.nokia.installedtest 1.3\n" + "InstalledTest {}" + << "QQuickRectangle" + << ""; + QTest::newRow("installed import 3") + << "import com.nokia.installedtest 1.4\n" + "InstalledTest {}" + << "QQuickText" + << ""; + QTest::newRow("installed import minor version not available") // QTBUG-11936 + << "import com.nokia.installedtest 0.1\n" + "InstalledTest {}" + << "" + << "module \"com.nokia.installedtest\" version 0.1 is not installed"; + QTest::newRow("installed import minor version not available") // QTBUG-9627 + << "import com.nokia.installedtest 1.10\n" + "InstalledTest {}" + << "" + << "module \"com.nokia.installedtest\" version 1.10 is not installed"; + QTest::newRow("installed import major version not available") // QTBUG-9627 + << "import com.nokia.installedtest 9.0\n" + "InstalledTest {}" + << "" + << "module \"com.nokia.installedtest\" version 9.0 is not installed"; + QTest::newRow("installed import visibility") // QT-614 + << "import com.nokia.installedtest 1.4\n" + "PrivateType {}" + << "" + << "PrivateType is not a type"; +} + +void tst_qqmllanguage::importsInstalled() +{ + QFETCH(QString, qml); + QFETCH(QString, type); + QFETCH(QString, error); + testType(qml,type,error); +} + + +void tst_qqmllanguage::importsOrder_data() +{ + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("type"); + QTest::addColumn<QString>("error"); + + QTest::newRow("double import") << + "import com.nokia.installedtest 1.4\n" + "import com.nokia.installedtest 1.4\n" + "InstalledTest {}" + << (!qmlCheckTypes()?"QQuickText":"") + << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/com/nokia/installedtest in version 1.4 and 1.4"); + QTest::newRow("installed import overrides 1") << + "import com.nokia.installedtest 1.0\n" + "import com.nokia.installedtest 1.4\n" + "InstalledTest {}" + << (!qmlCheckTypes()?"QQuickText":"") + << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/com/nokia/installedtest in version 1.4 and 1.0"); + QTest::newRow("installed import overrides 2") << + "import com.nokia.installedtest 1.4\n" + "import com.nokia.installedtest 1.0\n" + "InstalledTest {}" + << (!qmlCheckTypes()?"QQuickRectangle":"") + << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/com/nokia/installedtest in version 1.0 and 1.4"); + QTest::newRow("installed import re-overrides 1") << + "import com.nokia.installedtest 1.4\n" + "import com.nokia.installedtest 1.0\n" + "import com.nokia.installedtest 1.4\n" + "InstalledTest {}" + << (!qmlCheckTypes()?"QQuickText":"") + << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/com/nokia/installedtest in version 1.4 and 1.0"); + QTest::newRow("installed import re-overrides 2") << + "import com.nokia.installedtest 1.4\n" + "import com.nokia.installedtest 1.0\n" + "import com.nokia.installedtest 1.4\n" + "import com.nokia.installedtest 1.0\n" + "InstalledTest {}" + << (!qmlCheckTypes()?"QQuickRectangle":"") + << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/com/nokia/installedtest in version 1.0 and 1.4"); + + QTest::newRow("installed import versus builtin 1") << + "import com.nokia.installedtest 1.5\n" + "import QtQuick 2.0\n" + "Rectangle {}" + << (!qmlCheckTypes()?"QQuickRectangle":"") + << (!qmlCheckTypes()?"":"Rectangle is ambiguous. Found in Qt and in lib/com/nokia/installedtest"); + QTest::newRow("installed import versus builtin 2") << + "import QtQuick 2.0\n" + "import com.nokia.installedtest 1.5\n" + "Rectangle {}" + << (!qmlCheckTypes()?"QQuickText":"") + << (!qmlCheckTypes()?"":"Rectangle is ambiguous. Found in lib/com/nokia/installedtest and in Qt"); + QTest::newRow("namespaces cannot be overridden by types 1") << + "import QtQuick 2.0 as Rectangle\n" + "import com.nokia.installedtest 1.5\n" + "Rectangle {}" + << "" + << "Namespace Rectangle cannot be used as a type"; + QTest::newRow("namespaces cannot be overridden by types 2") << + "import QtQuick 2.0 as Rectangle\n" + "import com.nokia.installedtest 1.5\n" + "Rectangle.Image {}" + << "QQuickImage" + << ""; + QTest::newRow("local last 1") << + "LocalLast {}" + << "QQuickText" + << ""; + QTest::newRow("local last 2") << + "import com.nokia.installedtest 1.0\n" + "LocalLast {}" + << (!qmlCheckTypes()?"QQuickRectangle":"")// i.e. from com.nokia.installedtest, not data/LocalLast.qml + << (!qmlCheckTypes()?"":"LocalLast is ambiguous. Found in lib/com/nokia/installedtest and in local directory"); +} + +void tst_qqmllanguage::importsOrder() +{ + QFETCH(QString, qml); + QFETCH(QString, type); + QFETCH(QString, error); + testType(qml,type,error); +} + +void tst_qqmllanguage::importIncorrectCase() +{ + QQmlComponent component(&engine, TEST_FILE("importIncorrectCase.qml")); + + QList<QQmlError> errors = component.errors(); + QCOMPARE(errors.count(), 1); + +#if defined(Q_OS_MAC) || defined(Q_OS_WIN32) + QString expectedError = QLatin1String("cannot load module \"com.Nokia.installedtest\": File name case mismatch for \"") + testdata("lib/com/Nokia/installedtest/qmldir") + QLatin1String("\""); +#else + QString expectedError = QLatin1String("module \"com.Nokia.installedtest\" is not installed"); +#endif + + QCOMPARE(errors.at(0).description(), expectedError); +} + +void tst_qqmllanguage::importJs_data() +{ + QTest::addColumn<QString>("file"); + QTest::addColumn<QString>("errorFile"); + QTest::addColumn<bool>("performTest"); + + QTest::newRow("defaultVersion") + << "importJs.1.qml" + << "importJs.1.errors.txt" + << true; + + QTest::newRow("specifiedVersion") + << "importJs.2.qml" + << "importJs.2.errors.txt" + << true; + + QTest::newRow("excludeExcessiveVersion") + << "importJs.3.qml" + << "importJs.3.errors.txt" + << false; + + QTest::newRow("includeAppropriateVersion") + << "importJs.4.qml" + << "importJs.4.errors.txt" + << true; + + QTest::newRow("noDefaultVersion") + << "importJs.5.qml" + << "importJs.5.errors.txt" + << false; + + QTest::newRow("repeatImportFails") + << "importJs.6.qml" + << "importJs.6.errors.txt" + << false; + + QTest::newRow("multipleVersionImportFails") + << "importJs.7.qml" + << "importJs.7.errors.txt" + << false; + + QTest::newRow("namespacedImport") + << "importJs.8.qml" + << "importJs.8.errors.txt" + << true; + + QTest::newRow("namespacedVersionedImport") + << "importJs.9.qml" + << "importJs.9.errors.txt" + << true; + + QTest::newRow("namespacedRepeatImport") + << "importJs.10.qml" + << "importJs.10.errors.txt" + << true; +} + +void tst_qqmllanguage::importJs() +{ + QFETCH(QString, file); + QFETCH(QString, errorFile); + QFETCH(bool, performTest); + + QQmlComponent component(&engine, TEST_FILE(file)); + + { + DETERMINE_ERRORS(errorFile.toLatin1().constData(),expected,actual); + QCOMPARE(expected.size(), actual.size()); + for (int i = 0; i < expected.size(); ++i) + { + size_t compareLen = std::min(expected.at(i).length(), actual.at(i).length()); + QCOMPARE(expected.at(i).left(compareLen), actual.at(i).left(compareLen)); + } + } + + if (performTest) { + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("test").toBool(),true); + delete object; + } +} + +void tst_qqmllanguage::qmlAttachedPropertiesObjectMethod() +{ + QObject object; + + QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, false), (QObject *)0); + QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, true), (QObject *)0); + + { + QQmlComponent component(&engine, TEST_FILE("qmlAttachedPropertiesObjectMethod.1.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(object, false), (QObject *)0); + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0); + } + + { + QQmlComponent component(&engine, TEST_FILE("qmlAttachedPropertiesObjectMethod.2.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, false) != 0); + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0); + } +} + +void tst_qqmllanguage::crash1() +{ + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0\nComponent {}", QUrl()); +} + +void tst_qqmllanguage::crash2() +{ + QQmlComponent component(&engine, TEST_FILE("crash2.qml")); +} + +// QTBUG-8676 +void tst_qqmllanguage::customOnProperty() +{ + QQmlComponent component(&engine, TEST_FILE("customOnProperty.qml")); + + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("on").toInt(), 10); + + delete object; +} + +// QTBUG-12601 +void tst_qqmllanguage::variantNotify() +{ + QQmlComponent component(&engine, TEST_FILE("variantNotify.qml")); + + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("notifyCount").toInt(), 1); + + delete object; +} + +void tst_qqmllanguage::revisions() +{ + { + QQmlComponent component(&engine, TEST_FILE("revisions11.qml")); + + VERIFY_ERRORS(0); + MyRevisionedClass *object = qobject_cast<MyRevisionedClass*>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->prop2(), 10.0); + + delete object; + } + { + QQmlEngine myEngine; + QQmlComponent component(&myEngine, TEST_FILE("revisionssub11.qml")); + + VERIFY_ERRORS(0); + MyRevisionedSubclass *object = qobject_cast<MyRevisionedSubclass*>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->prop1(), 10.0); + QCOMPARE(object->prop2(), 10.0); + QCOMPARE(object->prop3(), 10.0); + QCOMPARE(object->prop4(), 10.0); + + delete object; + } + { + QQmlComponent component(&engine, TEST_FILE("versionedbase.qml")); + VERIFY_ERRORS(0); + MySubclass *object = qobject_cast<MySubclass*>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->prop1(), 10.0); + QCOMPARE(object->prop2(), 10.0); + + delete object; + } +} + +void tst_qqmllanguage::revisionOverloads() +{ + { + QQmlComponent component(&engine, TEST_FILE("allowedRevisionOverloads.qml")); + VERIFY_ERRORS(0); + } + { + QQmlComponent component(&engine, TEST_FILE("disallowedRevisionOverloads.qml")); + QEXPECT_FAIL("", "QTBUG-13849", Abort); + QVERIFY(0); + VERIFY_ERRORS("disallowedRevisionOverloads.errors.txt"); + } +} + +void tst_qqmllanguage::initTestCase() +{ + QString testdataDir = QFileInfo(QFINDTESTDATA("data")).absolutePath(); + QVERIFY2(QDir::setCurrent(testdataDir), qPrintable("Could not chdir to " + testdataDir)); + + registerTypes(); + + // Registering the TestType class in other modules should have no adverse effects + qmlRegisterType<TestType>("com.nokia.TestPre", 1, 0, "Test"); + + qmlRegisterType<TestType>("com.nokia.Test", 0, 0, "TestTP"); + qmlRegisterType<TestType>("com.nokia.Test", 1, 0, "Test"); + qmlRegisterType<TestType>("com.nokia.Test", 1, 5, "Test"); + qmlRegisterType<TestType2>("com.nokia.Test", 1, 8, "Test"); + qmlRegisterType<TestType>("com.nokia.Test", 1, 9, "OldTest"); + qmlRegisterType<TestType2>("com.nokia.Test", 1, 12, "Test"); + + // Registering the TestType class in other modules should have no adverse effects + qmlRegisterType<TestType>("com.nokia.TestPost", 1, 0, "Test"); + + // Create locale-specific file + // For POSIX, this will just be data/I18nType.qml, since POSIX is 7-bit + // For iso8859-1 locale, this will just be data/I18nType?????.qml where ????? is 5 8-bit characters + // For utf-8 locale, this will be data/I18nType??????????.qml where ?????????? is 5 8-bit characters, UTF-8 encoded + QFile in(TEST_FILE(QLatin1String("I18nType30.qml")).toLocalFile()); + QVERIFY2(in.open(QIODevice::ReadOnly), qPrintable(QString::fromLatin1("Cannot open '%1': %2").arg(in.fileName(), in.errorString()))); + QFile out(TEST_FILE(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml")).toLocalFile()); + QVERIFY2(out.open(QIODevice::WriteOnly), qPrintable(QString::fromLatin1("Cannot open '%1': %2").arg(out.fileName(), out.errorString()))); + out.write(in.readAll()); +} + +void tst_qqmllanguage::aliasPropertyChangeSignals() +{ + { + QQmlComponent component(&engine, TEST_FILE("aliasPropertyChangeSignals.qml")); + + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test").toBool(), true); + + delete o; + } + + // QTCREATORBUG-2769 + { + QQmlComponent component(&engine, TEST_FILE("aliasPropertyChangeSignals.2.qml")); + + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test").toBool(), true); + + delete o; + } +} + +// Tests property initializers +void tst_qqmllanguage::propertyInit() +{ + { + QQmlComponent component(&engine, TEST_FILE("propertyInit.1.qml")); + + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test").toInt(), 1); + + delete o; + } + + { + QQmlComponent component(&engine, TEST_FILE("propertyInit.2.qml")); + + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test").toInt(), 123); + + delete o; + } +} + +// Test that registration order doesn't break type availability +// QTBUG-16878 +void tst_qqmllanguage::registrationOrder() +{ + QQmlComponent component(&engine, TEST_FILE("registrationOrder.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + QVERIFY(o->metaObject() == &MyVersion2Class::staticMetaObject); + delete o; +} + +void tst_qqmllanguage::readonly() +{ + QQmlComponent component(&engine, TEST_FILE("readonly.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toInt(), 10); + QCOMPARE(o->property("test2").toInt(), 18); + QCOMPARE(o->property("test3").toInt(), 13); + + o->setProperty("testData", 13); + + QCOMPARE(o->property("test1").toInt(), 10); + QCOMPARE(o->property("test2").toInt(), 22); + QCOMPARE(o->property("test3").toInt(), 13); + + o->setProperty("testData2", 2); + + QCOMPARE(o->property("test1").toInt(), 10); + QCOMPARE(o->property("test2").toInt(), 22); + QCOMPARE(o->property("test3").toInt(), 2); + + o->setProperty("test1", 11); + o->setProperty("test2", 11); + o->setProperty("test3", 11); + + QCOMPARE(o->property("test1").toInt(), 10); + QCOMPARE(o->property("test2").toInt(), 22); + QCOMPARE(o->property("test3").toInt(), 2); + + delete o; +} + +// QTBUG-18268 +void tst_qqmllanguage::remoteLoadCrash() +{ + TestHTTPServer server(14448); + server.serveDirectory(testdata()); + + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0; Text {}", QUrl("http://127.0.0.1:14448/remoteLoadCrash.qml")); + while (component.isLoading()) + QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents, 50); + + QObject *o = component.create(); + delete o; +} + +QTEST_MAIN(tst_qqmllanguage) + +#include "tst_qqmllanguage.moc" |