summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmllanguage
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qmllanguage')
-rw-r--r--tests/auto/declarative/qmllanguage/data/Alias.qml8
-rw-r--r--tests/auto/declarative/qmllanguage/data/MyComponent.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/MyContainerComponent.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/alias.1.qml8
-rw-r--r--tests/auto/declarative/qmllanguage/data/alias.2.qml8
-rw-r--r--tests/auto/declarative/qmllanguage/data/alias.3.qml10
-rw-r--r--tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml26
-rw-r--r--tests/auto/declarative/qmllanguage/data/assignLiteralSignalProperty.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/assignObjectToSignal.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/assignObjectToVariant.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/assignQmlComponent.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/assignSignal.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/assignTypeExtremes.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/attachedProperties.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/autoComponentCreation.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/cppnamespace.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/customParserTypes.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/customVariantTypes.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/duplicateIDs.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/duplicateIDs.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/dynamicObject.1.qml8
-rw-r--r--tests/auto/declarative/qmllanguage/data/dynamicProperties.qml13
-rw-r--r--tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml7
-rw-r--r--tests/auto/declarative/qmllanguage/data/empty.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/empty.qml0
-rw-r--r--tests/auto/declarative/qmllanguage/data/failingComponent.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/failingComponentTest.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/fakeDotProperty.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/finalOverride.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/finalOverride.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/idProperty.qml8
-rw-r--r--tests/auto/declarative/qmllanguage/data/importNamespaceConflict.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/importNamespaceConflict.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.qml7
-rw-r--r--tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.qml3
-rw-r--r--tests/auto/declarative/qmllanguage/data/inlineQmlComponents.qml10
-rw-r--r--tests/auto/declarative/qmllanguage/data/interfaceProperty.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/interfaceQList.qml7
-rw-r--r--tests/auto/declarative/qmllanguage/data/interfaceQmlList.qml7
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.2.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.2.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.3.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.3.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.4.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.4.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.5.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.5.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.6.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.6.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidID.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/qmldir3
-rw-r--r--tests/auto/declarative/qmllanguage/data/listAssignment.1.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/listAssignment.1.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/listAssignment.2.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/listAssignment.2.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/listAssignment.3.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/listAssignment.3.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml38
-rw-r--r--tests/auto/declarative/qmllanguage/data/missingObject.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/missingObject.qml1
-rw-r--r--tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/missingSignal.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/nullDotProperty.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/nullDotProperty.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/propertyValueSource.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/readOnly.1.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/readOnly.1.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/readOnly.2.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/readOnly.2.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/rootAsQmlComponent.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/simpleBindings.qml18
-rw-r--r--tests/auto/declarative/qmllanguage/data/simpleContainer.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/simpleObject.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/data/subdir/Test.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/data/unregisteredObject.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/unregisteredObject.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/data/unsupportedProperty.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/unsupportedProperty.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/valueTypes.qml13
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.1.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.1.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.10.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.10.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.11.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.11.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.12.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.12.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.13.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.13.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.14.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.14.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.2.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.2.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.3.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.3.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.4.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.4.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.5.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.5.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.6.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.6.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.7.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.7.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.8.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.8.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.9.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.9.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/qmllanguage.pro9
-rw-r--r--tests/auto/declarative/qmllanguage/testtypes.cpp10
-rw-r--r--tests/auto/declarative/qmllanguage/testtypes.h433
-rw-r--r--tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp863
131 files changed, 1837 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmllanguage/data/Alias.qml b/tests/auto/declarative/qmllanguage/data/Alias.qml
new file mode 100644
index 0000000..8264e0d
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/Alias.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+Object {
+ id: Root
+ property int value: 1892
+ property alias aliasValue: Root.value
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/MyComponent.qml b/tests/auto/declarative/qmllanguage/data/MyComponent.qml
new file mode 100644
index 0000000..1a23277
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/MyComponent.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyQmlObject {
+ property real x;
+ property real y;
+}
diff --git a/tests/auto/declarative/qmllanguage/data/MyContainerComponent.qml b/tests/auto/declarative/qmllanguage/data/MyContainerComponent.qml
new file mode 100644
index 0000000..61f54c5
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/MyContainerComponent.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyContainer {
+ property int x
+}
diff --git a/tests/auto/declarative/qmllanguage/data/alias.1.qml b/tests/auto/declarative/qmllanguage/data/alias.1.qml
new file mode 100644
index 0000000..492d99a
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/alias.1.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import Qt 4.6
+
+Object {
+ id: Root
+ property int value: 10
+ property alias valueAlias: Root.value
+}
diff --git a/tests/auto/declarative/qmllanguage/data/alias.2.qml b/tests/auto/declarative/qmllanguage/data/alias.2.qml
new file mode 100644
index 0000000..aa4d103
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/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/declarative/qmllanguage/data/alias.3.qml b/tests/auto/declarative/qmllanguage/data/alias.3.qml
new file mode 100644
index 0000000..e25fbae
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/alias.3.qml
@@ -0,0 +1,10 @@
+import Qt 4.6
+
+Object {
+ property var other
+ other: Alias { id: MyAliasObject }
+
+ property alias value: MyAliasObject.aliasValue
+ property alias value2: MyAliasObject.value
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml b/tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml
new file mode 100644
index 0000000..cef9f8d
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml
@@ -0,0 +1,26 @@
+import Test 1.0
+MyTypeObject {
+ flagProperty: "FlagVal1 | FlagVal3"
+ enumProperty: "EnumVal2"
+ stringProperty: "Hello World!"
+ uintProperty: 10
+ intProperty: -19
+ realProperty: 23.2
+ doubleProperty: -19.7
+ colorProperty: "red"
+ dateProperty: "1982-11-25"
+ timeProperty: "11:11:31"
+ timeProperty: "11:11:32"
+ 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!"
+
+ objectProperty: MyTypeObject { intProperty: 8 }
+}
diff --git a/tests/auto/declarative/qmllanguage/data/assignLiteralSignalProperty.qml b/tests/auto/declarative/qmllanguage/data/assignLiteralSignalProperty.qml
new file mode 100644
index 0000000..399fcea
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/assignLiteralSignalProperty.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ onLiteralSignal: 10
+}
diff --git a/tests/auto/declarative/qmllanguage/data/assignObjectToSignal.qml b/tests/auto/declarative/qmllanguage/data/assignObjectToSignal.qml
new file mode 100644
index 0000000..789cc66
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/assignObjectToSignal.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ onBasicSignal: MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmllanguage/data/assignObjectToVariant.qml b/tests/auto/declarative/qmllanguage/data/assignObjectToVariant.qml
new file mode 100644
index 0000000..28c68c4
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/assignObjectToVariant.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+import Qt 4.6
+Object {
+ property var a;
+ a: MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmllanguage/data/assignQmlComponent.qml b/tests/auto/declarative/qmllanguage/data/assignQmlComponent.qml
new file mode 100644
index 0000000..20bdc55
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/assignQmlComponent.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyContainer {
+ MyComponent { x: 10; y: 11; }
+}
diff --git a/tests/auto/declarative/qmllanguage/data/assignSignal.qml b/tests/auto/declarative/qmllanguage/data/assignSignal.qml
new file mode 100644
index 0000000..3abc04d
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/assignSignal.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ onBasicSignal: basicSlot()
+ onBasicParameterizedSignal: basicSlot(parameter)
+}
diff --git a/tests/auto/declarative/qmllanguage/data/assignTypeExtremes.qml b/tests/auto/declarative/qmllanguage/data/assignTypeExtremes.qml
new file mode 100644
index 0000000..60ede52
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/assignTypeExtremes.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ uintProperty: 4000000000
+ intProperty: -2000000000
+}
diff --git a/tests/auto/declarative/qmllanguage/data/attachedProperties.qml b/tests/auto/declarative/qmllanguage/data/attachedProperties.qml
new file mode 100644
index 0000000..8343754
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/attachedProperties.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+import Qt 4.6
+Object {
+ MyQmlObject.value: 10
+}
diff --git a/tests/auto/declarative/qmllanguage/data/autoComponentCreation.qml b/tests/auto/declarative/qmllanguage/data/autoComponentCreation.qml
new file mode 100644
index 0000000..5d00144
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/autoComponentCreation.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyTypeObject {
+ componentProperty : MyTypeObject { realProperty: 9 }
+}
diff --git a/tests/auto/declarative/qmllanguage/data/cppnamespace.qml b/tests/auto/declarative/qmllanguage/data/cppnamespace.qml
new file mode 100644
index 0000000..e1daf3b
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/cppnamespace.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+
+MyNamespacedType {
+}
diff --git a/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt b/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt
new file mode 100644
index 0000000..d28c0bd
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt
@@ -0,0 +1 @@
+4:19:Cannot use reserved "id" property in ListModel
diff --git a/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.qml b/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.qml
new file mode 100644
index 0000000..e607768
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.qml
@@ -0,0 +1,5 @@
+import Qt 4.6
+ListModel {
+ ListElement { a: 10 }
+ ListElement { id: Foo; a: 12 }
+}
diff --git a/tests/auto/declarative/qmllanguage/data/customParserTypes.qml b/tests/auto/declarative/qmllanguage/data/customParserTypes.qml
new file mode 100644
index 0000000..cf2f272
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/customParserTypes.qml
@@ -0,0 +1,5 @@
+import Qt 4.6
+ListModel {
+ ListElement { a: 10 }
+ ListElement { a: 12 }
+}
diff --git a/tests/auto/declarative/qmllanguage/data/customVariantTypes.qml b/tests/auto/declarative/qmllanguage/data/customVariantTypes.qml
new file mode 100644
index 0000000..0263ed2
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/customVariantTypes.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ customType: "10"
+}
diff --git a/tests/auto/declarative/qmllanguage/data/duplicateIDs.errors.txt b/tests/auto/declarative/qmllanguage/data/duplicateIDs.errors.txt
new file mode 100644
index 0000000..66241cf
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/duplicateIDs.errors.txt
@@ -0,0 +1 @@
+4:19:id is not unique
diff --git a/tests/auto/declarative/qmllanguage/data/duplicateIDs.qml b/tests/auto/declarative/qmllanguage/data/duplicateIDs.qml
new file mode 100644
index 0000000..9605b5b
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/duplicateIDs.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyContainer {
+ MyQmlObject { id: MyID }
+ MyQmlObject { id: MyID }
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/dynamicObject.1.qml b/tests/auto/declarative/qmllanguage/data/dynamicObject.1.qml
new file mode 100644
index 0000000..85d1052
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/dynamicObject.1.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import Qt 4.6
+PropertyChanges {
+ propa: a + 10
+ propb: Math.min(a, 10)
+ propc: MyPropertyValueSource {}
+ onPropA: a
+}
diff --git a/tests/auto/declarative/qmllanguage/data/dynamicProperties.qml b/tests/auto/declarative/qmllanguage/data/dynamicProperties.qml
new file mode 100644
index 0000000..f93e446
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/dynamicProperties.qml
@@ -0,0 +1,13 @@
+import Test 1.0
+import Qt 4.6
+Object {
+ 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 date dateProperty: "1945-09-02"
+ property var varProperty: "Hello World!"
+ property variant variantProperty: 12
+}
diff --git a/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml b/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml
new file mode 100644
index 0000000..b0ca970
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml
@@ -0,0 +1,7 @@
+import Qt 4.6
+Object {
+ signal signal1
+ function slot1() {}
+ signal signal2
+ function slot2() {}
+}
diff --git a/tests/auto/declarative/qmllanguage/data/empty.errors.txt b/tests/auto/declarative/qmllanguage/data/empty.errors.txt
new file mode 100644
index 0000000..d416e76
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/empty.errors.txt
@@ -0,0 +1,2 @@
+0:0:Expected token `numeric literal'
+0:0:Expected a qualified name id
diff --git a/tests/auto/declarative/qmllanguage/data/empty.qml b/tests/auto/declarative/qmllanguage/data/empty.qml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/empty.qml
diff --git a/tests/auto/declarative/qmllanguage/data/failingComponent.errors.txt b/tests/auto/declarative/qmllanguage/data/failingComponent.errors.txt
new file mode 100644
index 0000000..0cf0ef3
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/failingComponent.errors.txt
@@ -0,0 +1 @@
+3:5:Type FailingComponent unavailable
diff --git a/tests/auto/declarative/qmllanguage/data/failingComponentTest.qml b/tests/auto/declarative/qmllanguage/data/failingComponentTest.qml
new file mode 100644
index 0000000..74a6acf
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/failingComponentTest.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyContainer {
+ FailingComponent {}
+}
diff --git a/tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt b/tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt
new file mode 100644
index 0000000..e56ad3a
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt
@@ -0,0 +1 @@
+3:5:Invalid property access
diff --git a/tests/auto/declarative/qmllanguage/data/fakeDotProperty.qml b/tests/auto/declarative/qmllanguage/data/fakeDotProperty.qml
new file mode 100644
index 0000000..d971eee
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/fakeDotProperty.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ value.something: "hello"
+}
diff --git a/tests/auto/declarative/qmllanguage/data/finalOverride.errors.txt b/tests/auto/declarative/qmllanguage/data/finalOverride.errors.txt
new file mode 100644
index 0000000..49e06cb
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/finalOverride.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot override FINAL property
diff --git a/tests/auto/declarative/qmllanguage/data/finalOverride.qml b/tests/auto/declarative/qmllanguage/data/finalOverride.qml
new file mode 100644
index 0000000..a84393a
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/finalOverride.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ property int value: 10
+}
diff --git a/tests/auto/declarative/qmllanguage/data/idProperty.qml b/tests/auto/declarative/qmllanguage/data/idProperty.qml
new file mode 100644
index 0000000..a413c0b
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/idProperty.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+MyContainer {
+ property var object : MyObjectId
+
+ MyTypeObject {
+ id: "MyObjectId"
+ }
+}
diff --git a/tests/auto/declarative/qmllanguage/data/importNamespaceConflict.errors.txt b/tests/auto/declarative/qmllanguage/data/importNamespaceConflict.errors.txt
new file mode 100644
index 0000000..231998d
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/importNamespaceConflict.errors.txt
@@ -0,0 +1 @@
+4:1:Namespace Rectangle cannot be used as a type
diff --git a/tests/auto/declarative/qmllanguage/data/importNamespaceConflict.qml b/tests/auto/declarative/qmllanguage/data/importNamespaceConflict.qml
new file mode 100644
index 0000000..cd112af
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/importNamespaceConflict.qml
@@ -0,0 +1,4 @@
+import Test 1.0 as Rectangle
+import Qt 4.6
+
+Rectangle { }
diff --git a/tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.errors.txt b/tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.errors.txt
new file mode 100644
index 0000000..2235cbc
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.errors.txt
@@ -0,0 +1 @@
+SHOULD GIVE AN ERROR ABOUT MISSING VERSION
diff --git a/tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.qml b/tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.qml
new file mode 100644
index 0000000..23ed566
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.qml
@@ -0,0 +1,7 @@
+import Test as S
+
+S.MyQmlObject {
+ property real x;
+ property real y;
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.errors.txt b/tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.errors.txt
new file mode 100644
index 0000000..2235cbc
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.errors.txt
@@ -0,0 +1 @@
+SHOULD GIVE AN ERROR ABOUT MISSING VERSION
diff --git a/tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.qml b/tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.qml
new file mode 100644
index 0000000..97ec222
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.qml
@@ -0,0 +1,3 @@
+import com.nokia.installedtest as T
+
+T.InstalledTest {}
diff --git a/tests/auto/declarative/qmllanguage/data/inlineQmlComponents.qml b/tests/auto/declarative/qmllanguage/data/inlineQmlComponents.qml
new file mode 100644
index 0000000..79ceda6
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/inlineQmlComponents.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+import Qt 4.6
+MyContainer {
+ Component {
+ id: MyComponent
+ MyQmlObject {
+ value: 11
+ }
+ }
+}
diff --git a/tests/auto/declarative/qmllanguage/data/interfaceProperty.qml b/tests/auto/declarative/qmllanguage/data/interfaceProperty.qml
new file mode 100644
index 0000000..70879ff
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/interfaceProperty.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+import Qt 4.6
+MyQmlObject {
+ interfaceProperty: MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmllanguage/data/interfaceQList.qml b/tests/auto/declarative/qmllanguage/data/interfaceQList.qml
new file mode 100644
index 0000000..c87dfae
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/interfaceQList.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+MyContainer {
+ qlistInterfaces: [
+ MyQmlObject {},
+ MyQmlObject {}
+ ]
+}
diff --git a/tests/auto/declarative/qmllanguage/data/interfaceQmlList.qml b/tests/auto/declarative/qmllanguage/data/interfaceQmlList.qml
new file mode 100644
index 0000000..8392bea
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/interfaceQmlList.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+MyContainer {
+ qmllistInterfaces: [
+ MyQmlObject {},
+ MyQmlObject {}
+ ]
+}
diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.2.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidID.2.errors.txt
new file mode 100644
index 0000000..56e3eeb
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidID.2.errors.txt
@@ -0,0 +1,2 @@
+3:5:"" is not a valid object id
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.2.qml b/tests/auto/declarative/qmllanguage/data/invalidID.2.qml
new file mode 100644
index 0000000..4fb3b29
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidID.2.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: ""
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.3.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidID.3.errors.txt
new file mode 100644
index 0000000..bb811cf
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidID.3.errors.txt
@@ -0,0 +1 @@
+3:5:Invalid use of id property
diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.3.qml b/tests/auto/declarative/qmllanguage/data/invalidID.3.qml
new file mode 100644
index 0000000..6684172
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidID.3.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id.other: 10
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.4.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidID.4.errors.txt
new file mode 100644
index 0000000..cfe8756
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidID.4.errors.txt
@@ -0,0 +1 @@
+4:5:Invalid use of id property
diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.4.qml b/tests/auto/declarative/qmllanguage/data/invalidID.4.qml
new file mode 100644
index 0000000..1f15fce
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidID.4.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyQmlObject {
+ id: Hello
+ id: World
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.5.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidID.5.errors.txt
new file mode 100644
index 0000000..b0a63a0
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidID.5.errors.txt
@@ -0,0 +1 @@
+4:9:id conflicts with namespace prefix
diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.5.qml b/tests/auto/declarative/qmllanguage/data/invalidID.5.qml
new file mode 100644
index 0000000..0545b0d
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/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/declarative/qmllanguage/data/invalidID.6.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidID.6.errors.txt
new file mode 100644
index 0000000..861e3d7
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidID.6.errors.txt
@@ -0,0 +1 @@
+3:9:id conflicts with type name
diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.6.qml b/tests/auto/declarative/qmllanguage/data/invalidID.6.qml
new file mode 100644
index 0000000..ea34007
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidID.6.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: MyQmlObject
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidID.errors.txt
new file mode 100644
index 0000000..1ca678c
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidID.errors.txt
@@ -0,0 +1 @@
+3:5:"1" is not a valid object id
diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.qml b/tests/auto/declarative/qmllanguage/data/invalidID.qml
new file mode 100644
index 0000000..04db3eb
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidID.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ id: 1
+}
diff --git a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest.qml b/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest.qml
new file mode 100644
index 0000000..d8a22a8
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest.qml
@@ -0,0 +1,2 @@
+import Qt 4.6
+Rectangle {}
diff --git a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml b/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml
new file mode 100644
index 0000000..a0706ad
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml
@@ -0,0 +1,2 @@
+import Qt 4.6
+Text {}
diff --git a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/qmldir b/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/qmldir
new file mode 100644
index 0000000..ba0b42a
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/qmldir
@@ -0,0 +1,3 @@
+InstalledTest 1.0-3 InstalledTest.qml
+InstalledTest 1.4 InstalledTest2.qml
+Rectangle 1.5 InstalledTest2.qml
diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.1.errors.txt b/tests/auto/declarative/qmllanguage/data/listAssignment.1.errors.txt
new file mode 100644
index 0000000..d68d487
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/listAssignment.1.errors.txt
@@ -0,0 +1 @@
+3:24:Cannot assign primitives to lists
diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.1.qml b/tests/auto/declarative/qmllanguage/data/listAssignment.1.qml
new file mode 100644
index 0000000..4240425
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/listAssignment.1.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyContainer {
+ qmllistInterfaces: 1
+}
diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.2.errors.txt b/tests/auto/declarative/qmllanguage/data/listAssignment.2.errors.txt
new file mode 100644
index 0000000..8b40aa3
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/listAssignment.2.errors.txt
@@ -0,0 +1,2 @@
+3:15:Cannot assign primitives to lists
+
diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.2.qml b/tests/auto/declarative/qmllanguage/data/listAssignment.2.qml
new file mode 100644
index 0000000..e3baadb
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/listAssignment.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyContainer {
+ children: 2
+}
diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.3.errors.txt b/tests/auto/declarative/qmllanguage/data/listAssignment.3.errors.txt
new file mode 100644
index 0000000..8c7b7e9
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/listAssignment.3.errors.txt
@@ -0,0 +1 @@
+4:15:Can only assign one binding to lists
diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.3.qml b/tests/auto/declarative/qmllanguage/data/listAssignment.3.qml
new file mode 100644
index 0000000..00c4c6b
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/listAssignment.3.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyContainer {
+ children: childBinding.expression
+ children: childBinding2.expression
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml b/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml
new file mode 100644
index 0000000..fa2e831
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml
@@ -0,0 +1,38 @@
+import Qt 4.6
+
+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 }
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: FruitModel.remove(index)
+ }
+ }
+ }
+
+ ListView {
+ model: FruitModel
+ delegate: FruitDelegate
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/declarative/qmllanguage/data/missingObject.errors.txt b/tests/auto/declarative/qmllanguage/data/missingObject.errors.txt
new file mode 100644
index 0000000..b31b562
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/missingObject.errors.txt
@@ -0,0 +1 @@
+1:10:Expected token `{'
diff --git a/tests/auto/declarative/qmllanguage/data/missingObject.qml b/tests/auto/declarative/qmllanguage/data/missingObject.qml
new file mode 100644
index 0000000..2f17045
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/missingObject.qml
@@ -0,0 +1 @@
+something: 24
diff --git a/tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt b/tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt
new file mode 100644
index 0000000..e243ae5
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt
@@ -0,0 +1 @@
+4:5:Cannot assign to non-existant property "onClicked"
diff --git a/tests/auto/declarative/qmllanguage/data/missingSignal.qml b/tests/auto/declarative/qmllanguage/data/missingSignal.qml
new file mode 100644
index 0000000..fd489ca
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/missingSignal.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+import Qt 4.6
+Object {
+ onClicked: print("Hello world!")
+}
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt
new file mode 100644
index 0000000..cfc6fc8
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt
@@ -0,0 +1 @@
+2:15:Cannot assign to non-existant property "something"
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.qml b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.qml
new file mode 100644
index 0000000..df7406c
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.qml
@@ -0,0 +1,2 @@
+import Test 1.0
+MyQmlObject { something: 24 }
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt
new file mode 100644
index 0000000..8b13585
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existant property "something"
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.qml b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.qml
new file mode 100644
index 0000000..06ccd37
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ something: 24
+}
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt
new file mode 100644
index 0000000..8b13585
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existant property "something"
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.qml b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.qml
new file mode 100644
index 0000000..5b08608
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ something: 1 + 1
+}
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt
new file mode 100644
index 0000000..8b13585
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existant property "something"
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.qml b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.qml
new file mode 100644
index 0000000..6579191
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ something: ;
+}
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.errors.txt b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.errors.txt
new file mode 100644
index 0000000..c07f2b9
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.errors.txt
@@ -0,0 +1 @@
+3:5:Expected a qualified name id
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.qml b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.qml
new file mode 100644
index 0000000..37af057
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ 24
+}
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt
new file mode 100644
index 0000000..c02d7bd
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existant default property
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.qml b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.qml
new file mode 100644
index 0000000..5cd55d0
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmllanguage/data/nullDotProperty.errors.txt b/tests/auto/declarative/qmllanguage/data/nullDotProperty.errors.txt
new file mode 100644
index 0000000..07a4094
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nullDotProperty.errors.txt
@@ -0,0 +1 @@
+3:-1:Cannot set properties on obj as it is null
diff --git a/tests/auto/declarative/qmllanguage/data/nullDotProperty.qml b/tests/auto/declarative/qmllanguage/data/nullDotProperty.qml
new file mode 100644
index 0000000..4e36779
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/nullDotProperty.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyDotPropertyObject {
+ obj.value: 1
+}
diff --git a/tests/auto/declarative/qmllanguage/data/propertyValueSource.qml b/tests/auto/declarative/qmllanguage/data/propertyValueSource.qml
new file mode 100644
index 0000000..ad71fcf
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/propertyValueSource.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyTypeObject {
+ intProperty : MyPropertyValueSource {}
+}
diff --git a/tests/auto/declarative/qmllanguage/data/readOnly.1.errors.txt b/tests/auto/declarative/qmllanguage/data/readOnly.1.errors.txt
new file mode 100644
index 0000000..b8c3404
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/readOnly.1.errors.txt
@@ -0,0 +1 @@
+3:21:Invalid property assignment: "readOnlyString" is a read-only property
diff --git a/tests/auto/declarative/qmllanguage/data/readOnly.1.qml b/tests/auto/declarative/qmllanguage/data/readOnly.1.qml
new file mode 100644
index 0000000..60757bd
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/readOnly.1.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ readOnlyString: "Hello World"
+}
diff --git a/tests/auto/declarative/qmllanguage/data/readOnly.2.errors.txt b/tests/auto/declarative/qmllanguage/data/readOnly.2.errors.txt
new file mode 100644
index 0000000..d857a04
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/readOnly.2.errors.txt
@@ -0,0 +1 @@
+3:5:Invalid property assignment: "readOnlyString" is a read-only property
diff --git a/tests/auto/declarative/qmllanguage/data/readOnly.2.qml b/tests/auto/declarative/qmllanguage/data/readOnly.2.qml
new file mode 100644
index 0000000..8f1633c
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/readOnly.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ readOnlyString: "Hello" + "World"
+}
diff --git a/tests/auto/declarative/qmllanguage/data/rootAsQmlComponent.qml b/tests/auto/declarative/qmllanguage/data/rootAsQmlComponent.qml
new file mode 100644
index 0000000..8d72cd3
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/rootAsQmlComponent.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyContainerComponent {
+ x: 11
+ MyQmlObject {}
+ MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmllanguage/data/simpleBindings.qml b/tests/auto/declarative/qmllanguage/data/simpleBindings.qml
new file mode 100644
index 0000000..74867b3
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/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/declarative/qmllanguage/data/simpleContainer.qml b/tests/auto/declarative/qmllanguage/data/simpleContainer.qml
new file mode 100644
index 0000000..c3a795f
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/simpleContainer.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyContainer {
+ MyQmlObject {}
+ MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmllanguage/data/simpleObject.qml b/tests/auto/declarative/qmllanguage/data/simpleObject.qml
new file mode 100644
index 0000000..30c7823
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/simpleObject.qml
@@ -0,0 +1,2 @@
+import Test 1.0
+MyQmlObject {}
diff --git a/tests/auto/declarative/qmllanguage/data/subdir/Test.qml b/tests/auto/declarative/qmllanguage/data/subdir/Test.qml
new file mode 100644
index 0000000..c4d5905
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/subdir/Test.qml
@@ -0,0 +1,2 @@
+import Qt 4.6
+Rectangle { }
diff --git a/tests/auto/declarative/qmllanguage/data/unregisteredObject.errors.txt b/tests/auto/declarative/qmllanguage/data/unregisteredObject.errors.txt
new file mode 100644
index 0000000..bc4f7f4
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/unregisteredObject.errors.txt
@@ -0,0 +1 @@
+2:1:Type UnregisteredObject unavailable
diff --git a/tests/auto/declarative/qmllanguage/data/unregisteredObject.qml b/tests/auto/declarative/qmllanguage/data/unregisteredObject.qml
new file mode 100644
index 0000000..9498e31
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/unregisteredObject.qml
@@ -0,0 +1,2 @@
+import Test 1.0
+UnregisteredObject {}
diff --git a/tests/auto/declarative/qmllanguage/data/unsupportedProperty.errors.txt b/tests/auto/declarative/qmllanguage/data/unsupportedProperty.errors.txt
new file mode 100644
index 0000000..3a90a7d
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/unsupportedProperty.errors.txt
@@ -0,0 +1 @@
+3:13:Invalid property assignment: unknown type QVariant::QMatrix
diff --git a/tests/auto/declarative/qmllanguage/data/unsupportedProperty.qml b/tests/auto/declarative/qmllanguage/data/unsupportedProperty.qml
new file mode 100644
index 0000000..9f19680
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/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/declarative/qmllanguage/data/valueTypes.qml b/tests/auto/declarative/qmllanguage/data/valueTypes.qml
new file mode 100644
index 0000000..bf325a7
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/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/declarative/qmllanguage/data/wrongType.1.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.1.errors.txt
new file mode 100644
index 0000000..ba7a076
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.1.errors.txt
@@ -0,0 +1 @@
+3:12:Invalid property assignment: int expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.1.qml b/tests/auto/declarative/qmllanguage/data/wrongType.1.qml
new file mode 100644
index 0000000..289d37f
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.1.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ value: "hello"
+}
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.10.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.10.errors.txt
new file mode 100644
index 0000000..ae75b52
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.10.errors.txt
@@ -0,0 +1 @@
+3:23:Invalid property assignment: datetime expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.10.qml b/tests/auto/declarative/qmllanguage/data/wrongType.10.qml
new file mode 100644
index 0000000..2cf0e50
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.10.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ dateTimeProperty: 12
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.11.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.11.errors.txt
new file mode 100644
index 0000000..23a4cda
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.11.errors.txt
@@ -0,0 +1 @@
+3:20:Invalid property assignment: point expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.11.qml b/tests/auto/declarative/qmllanguage/data/wrongType.11.qml
new file mode 100644
index 0000000..ae77ba1
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.11.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ pointProperty: "apples"
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.12.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.12.errors.txt
new file mode 100644
index 0000000..3092100
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.12.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: size expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.12.qml b/tests/auto/declarative/qmllanguage/data/wrongType.12.qml
new file mode 100644
index 0000000..b7a366f
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.12.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ sizeProperty: "red"
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.13.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.13.errors.txt
new file mode 100644
index 0000000..ba7a076
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.13.errors.txt
@@ -0,0 +1 @@
+3:12:Invalid property assignment: int expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.13.qml b/tests/auto/declarative/qmllanguage/data/wrongType.13.qml
new file mode 100644
index 0000000..477aff1
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.13.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ value: "12"
+}
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.14.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.14.errors.txt
new file mode 100644
index 0000000..d621fdd
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.14.errors.txt
@@ -0,0 +1 @@
+3:21:Invalid property assignment: string expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.14.qml b/tests/auto/declarative/qmllanguage/data/wrongType.14.qml
new file mode 100644
index 0000000..672d693
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.14.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ stringProperty: 10
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.2.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.2.errors.txt
new file mode 100644
index 0000000..9ff9f25
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.2.errors.txt
@@ -0,0 +1 @@
+3:14:Invalid property assignment: boolean expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.2.qml b/tests/auto/declarative/qmllanguage/data/wrongType.2.qml
new file mode 100644
index 0000000..34b74f7
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ enabled: 5
+}
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.3.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.3.errors.txt
new file mode 100644
index 0000000..6d971c6
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.3.errors.txt
@@ -0,0 +1 @@
+3:11:Invalid property assignment: rect expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.3.qml b/tests/auto/declarative/qmllanguage/data/wrongType.3.qml
new file mode 100644
index 0000000..384181a
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.3.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ rect: "5,5x10"
+}
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.4.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.4.errors.txt
new file mode 100644
index 0000000..ef34d0e
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.4.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: unknown enumeration
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.4.qml b/tests/auto/declarative/qmllanguage/data/wrongType.4.qml
new file mode 100644
index 0000000..0787bf5
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.4.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyTypeObject {
+ enumProperty: "InvalidEnumName"
+}
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.5.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.5.errors.txt
new file mode 100644
index 0000000..cab10bd
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.5.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: unsigned int expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.5.qml b/tests/auto/declarative/qmllanguage/data/wrongType.5.qml
new file mode 100644
index 0000000..c50ae9a
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.5.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ uintProperty: -13
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.6.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.6.errors.txt
new file mode 100644
index 0000000..d0a0b00
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.6.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: double expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.6.qml b/tests/auto/declarative/qmllanguage/data/wrongType.6.qml
new file mode 100644
index 0000000..da10b78
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.6.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ realProperty: "Hello"
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.7.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.7.errors.txt
new file mode 100644
index 0000000..614346b
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.7.errors.txt
@@ -0,0 +1 @@
+3:20:Invalid property assignment: color expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.7.qml b/tests/auto/declarative/qmllanguage/data/wrongType.7.qml
new file mode 100644
index 0000000..ddc3835
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.7.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ colorProperty: 12
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.8.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.8.errors.txt
new file mode 100644
index 0000000..1773c00
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.8.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: date expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.8.qml b/tests/auto/declarative/qmllanguage/data/wrongType.8.qml
new file mode 100644
index 0000000..a5f6756
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.8.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ dateProperty: 12
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.9.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.9.errors.txt
new file mode 100644
index 0000000..8630975
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.9.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: time expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.9.qml b/tests/auto/declarative/qmllanguage/data/wrongType.9.qml
new file mode 100644
index 0000000..a3db732
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.9.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ timeProperty: 12
+}
+
diff --git a/tests/auto/declarative/qmllanguage/qmllanguage.pro b/tests/auto/declarative/qmllanguage/qmllanguage.pro
new file mode 100644
index 0000000..4e4be9c
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/qmllanguage.pro
@@ -0,0 +1,9 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qmllanguage.cpp \
+ testtypes.cpp
+HEADERS += testtypes.h
+macx:CONFIG -= app_bundle
+
+# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
+# LIBS += -lgcov
diff --git a/tests/auto/declarative/qmllanguage/testtypes.cpp b/tests/auto/declarative/qmllanguage/testtypes.cpp
new file mode 100644
index 0000000..c11e195
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/testtypes.cpp
@@ -0,0 +1,10 @@
+#include "testtypes.h"
+
+QML_DEFINE_INTERFACE(MyInterface);
+QML_DEFINE_TYPE(Test,1,0,0,MyQmlObject,MyQmlObject);
+QML_DEFINE_TYPE(Test,1,0,0,MyTypeObject,MyTypeObject);
+QML_DEFINE_TYPE(Test,1,0,0,MyContainer,MyContainer);
+QML_DEFINE_TYPE(Test,1,0,0,MyPropertyValueSource,MyPropertyValueSource);
+QML_DEFINE_TYPE(Test,1,0,0,MyDotPropertyObject,MyDotPropertyObject);
+QML_DEFINE_TYPE(Test,1,0,0,MyNamespacedType,MyNamespace::MyNamespacedType);
+
diff --git a/tests/auto/declarative/qmllanguage/testtypes.h b/tests/auto/declarative/qmllanguage/testtypes.h
new file mode 100644
index 0000000..b1da9fb
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/testtypes.h
@@ -0,0 +1,433 @@
+#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 <QtDeclarative/qml.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qmlparserstatus.h>
+#include <QtDeclarative/qmlpropertyvaluesource.h>
+
+class MyInterface
+{
+public:
+ MyInterface() : id(913) {}
+ int id;
+};
+Q_DECLARE_INTERFACE(MyInterface, "com.trolltech.Qt.Test.MyInterface");
+QML_DECLARE_INTERFACE(MyInterface);
+
+struct MyCustomVariantType
+{
+ MyCustomVariantType() : a(0) {}
+ int a;
+};
+Q_DECLARE_METATYPE(MyCustomVariantType);
+
+static QVariant myCustomVariantTypeConverter(const QString &data)
+{
+ MyCustomVariantType rv;
+ rv.a = data.toInt();
+ return QVariant::fromValue(rv);
+}
+
+class MyAttachedObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+public:
+ MyAttachedObject(QObject *parent) : QObject(parent), m_value(0) {}
+
+ int value() const { return m_value; }
+ void setValue(int v) { m_value = v; }
+
+private:
+ int m_value;
+};
+
+class MyQmlObject : public QObject, public MyInterface, public QmlParserStatus
+{
+ 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_INTERFACES(MyInterface QmlParserStatus)
+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; }
+public slots:
+ void basicSlot() { qWarning("MyQmlObject::basicSlot"); }
+ void basicSlot(int v) { qWarning("MyQmlObject::basicSlot(%d)", v); }
+
+signals:
+ void basicSignal();
+ void basicParameterizedSignal(int parameter);
+
+private:
+ friend class tst_qmllanguage;
+ int m_value;
+ MyInterface *m_interface;
+ MyQmlObject *m_qmlobject;
+ MyCustomVariantType m_custom;
+};
+QML_DECLARE_TYPE(MyQmlObject);
+
+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(QmlComponent *componentProperty READ componentProperty WRITE setComponentProperty);
+ Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty);
+ Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty);
+ 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(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);
+
+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;
+ }
+
+ QmlComponent *componentPropertyValue;
+ QmlComponent *componentProperty() const {
+ return componentPropertyValue;
+ }
+ void setComponentProperty(QmlComponent *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;
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ void doAction() { emit action(); }
+signals:
+ void action();
+ void rectPropertyChanged();
+};
+Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags)
+QML_DECLARE_TYPE(MyTypeObject);
+
+class MyContainer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QList<QObject*>* children READ children)
+ Q_PROPERTY(QList<MyInterface*>* qlistInterfaces READ qlistInterfaces)
+ Q_PROPERTY(QmlList<MyInterface*>* qmllistInterfaces READ qmllistInterfaces)
+ Q_CLASSINFO("DefaultProperty", "children");
+public:
+ MyContainer() {}
+
+ QList<QObject*> *children() { return &m_children; }
+ QList<MyInterface *> *qlistInterfaces() { return &m_interfaces; }
+ QmlList<MyInterface *> *qmllistInterfaces() { return &m_qmlinterfaces; }
+ const QmlConcreteList<MyInterface *> &qmllistAccessor() const { return m_qmlinterfaces; }
+
+private:
+ QList<QObject*> m_children;
+ QList<MyInterface *> m_interfaces;
+ QmlConcreteList<MyInterface *> m_qmlinterfaces;
+};
+
+QML_DECLARE_TYPE(MyContainer);
+
+class MyPropertyValueSource : public QObject, public QmlPropertyValueSource
+{
+ Q_OBJECT
+ Q_INTERFACES(QmlPropertyValueSource)
+public:
+ MyPropertyValueSource()
+ : QmlPropertyValueSource() {}
+
+ QmlMetaProperty prop;
+ virtual void setTarget(const QmlMetaProperty &p)
+ {
+ prop = p;
+ }
+};
+QML_DECLARE_TYPE(MyPropertyValueSource);
+
+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;
+};
+
+QML_DECLARE_TYPE(MyDotPropertyObject);
+
+namespace MyNamespace {
+ class MyNamespacedType : public QObject
+ {
+ Q_OBJECT
+ };
+}
+QML_DECLARE_TYPE(MyNamespace::MyNamespacedType);
+
+#endif // TESTTYPES_H
diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
new file mode 100644
index 0000000..1bf98df
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
@@ -0,0 +1,863 @@
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdir.h>
+#include "testtypes.h"
+
+/*
+This test case covers QML language issues. This covers everything that does
+involve evaluating ECMAScript expressions and bindings.
+
+Evaluation of expressions and bindings is covered in qmlecmascript
+*/
+class tst_qmllanguage : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmllanguage() {
+ QmlMetaType::registerCustomStringConverter(qMetaTypeId<MyCustomVariantType>(), myCustomVariantTypeConverter);
+ QFileInfo fileInfo(__FILE__);
+ engine.addImportPath(fileInfo.absoluteDir().filePath(QLatin1String("data/lib")));
+ }
+
+private slots:
+
+ void errors_data();
+ void errors();
+
+ void simpleObject();
+ void simpleContainer();
+ void interfaceProperty();
+ void interfaceQmlList();
+ void interfaceQList();
+ void assignObjectToSignal();
+ void assignObjectToVariant();
+ void assignLiteralSignalProperty();
+ void assignQmlComponent();
+ void assignBasicTypes();
+ void assignTypeExtremes();
+ void customParserTypes();
+ void rootAsQmlComponent();
+ void inlineQmlComponents();
+ void idProperty();
+ void assignSignal();
+ void dynamicProperties();
+ void dynamicSignalsAndSlots();
+ void simpleBindings();
+ void autoComponentCreation();
+ void propertyValueSource();
+ void attachedProperties();
+ void dynamicObjects();
+ void customVariantTypes();
+ void valueTypes();
+ void cppnamespace();
+ void aliasProperties();
+
+ void importsBuiltin_data();
+ void importsBuiltin();
+ void importsLocal_data();
+ void importsLocal();
+ void importsInstalled_data();
+ void importsInstalled();
+ void importsOrder_data();
+ void importsOrder();
+
+ // regression tests for crashes
+ void crash1();
+
+private:
+ QmlEngine engine;
+ void testType(const QString& qml, const QString& type);
+};
+
+#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 { \
+ QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \
+ QVERIFY(file.open(QIODevice::ReadOnly)); \
+ QByteArray data = file.readAll(); \
+ QList<QByteArray> expected = data.split('\n'); \
+ expected.removeAll(QByteArray("")); \
+ QList<QmlError> errors = component.errors(); \
+ QList<QByteArray> actual; \
+ for (int ii = 0; ii < errors.count(); ++ii) { \
+ const QmlError &error = errors.at(ii); \
+ QByteArray errorStr = QByteArray::number(error.line()) + ":" + \
+ QByteArray::number(error.column()) + ":" + \
+ error.description().toUtf8(); \
+ actual << errorStr; \
+ } \
+ if (qgetenv("DEBUG") != "" && expected != actual) \
+ qWarning() << "Expected:" << expected << "Actual:" << actual; \
+ QCOMPARE(expected, actual); \
+ }
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ QFileInfo fileInfo(__FILE__);
+ return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(QLatin1String("data/") + filename));
+}
+
+inline QUrl TEST_FILE(const char *filename)
+{
+ return TEST_FILE(QLatin1String(filename));
+}
+
+void tst_qmllanguage::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("readOnly.1") << "readOnly.1.qml" << "readOnly.1.errors.txt" << false;
+ QTest::newRow("readOnly.2") << "readOnly.2.qml" << "readOnly.2.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("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("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("customParserIdNotAllowed") << "customParserIdNotAllowed.qml" << "customParserIdNotAllowed.errors.txt" << false;
+}
+
+void tst_qmllanguage::errors()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+ QFETCH(bool, create);
+
+ QmlComponent component(&engine, TEST_FILE(file));
+
+ if(create) {
+ QObject *object = component.create();
+ QVERIFY(object == 0);
+ }
+
+ VERIFY_ERRORS(errorFile.toLatin1().constData());
+}
+
+void tst_qmllanguage::simpleObject()
+{
+ QmlComponent component(&engine, TEST_FILE("simpleObject.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+void tst_qmllanguage::simpleContainer()
+{
+ QmlComponent component(&engine, TEST_FILE("simpleContainer.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *container= qobject_cast<MyContainer*>(component.create());
+ QVERIFY(container != 0);
+ QCOMPARE(container->children()->count(),2);
+}
+
+void tst_qmllanguage::interfaceProperty()
+{
+ QmlComponent 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_qmllanguage::interfaceQmlList()
+{
+ QmlComponent component(&engine, TEST_FILE("interfaceQmlList.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *container= qobject_cast<MyContainer*>(component.create());
+ QVERIFY(container != 0);
+ QVERIFY(container->qmllistAccessor().count() == 2);
+ for(int ii = 0; ii < 2; ++ii)
+ QVERIFY(container->qmllistAccessor().at(ii)->id == 913);
+}
+
+void tst_qmllanguage::interfaceQList()
+{
+ QmlComponent component(&engine, TEST_FILE("interfaceQList.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *container= qobject_cast<MyContainer*>(component.create());
+ QVERIFY(container != 0);
+ QVERIFY(container->qlistInterfaces()->count() == 2);
+ for(int ii = 0; ii < 2; ++ii)
+ QVERIFY(container->qlistInterfaces()->at(ii)->id == 913);
+}
+
+void tst_qmllanguage::assignObjectToSignal()
+{
+ QmlComponent 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_qmllanguage::assignObjectToVariant()
+{
+ QmlComponent 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_qmllanguage::assignLiteralSignalProperty()
+{
+ QmlComponent 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_qmllanguage::assignQmlComponent()
+{
+ QmlComponent component(&engine, TEST_FILE("assignQmlComponent.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *object = qobject_cast<MyContainer *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->children()->count() == 1);
+ QObject *child = object->children()->at(0);
+ QCOMPARE(child->property("x"), QVariant(10));
+ QCOMPARE(child->property("y"), QVariant(11));
+}
+
+// Test literal assignment to all the basic types
+void tst_qmllanguage::assignBasicTypes()
+{
+ QmlComponent 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(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((float)-10.1, (float)12.3));
+ QCOMPARE(object->sizeProperty(), QSize(99, 13));
+ QCOMPARE(object->sizeFProperty(), QSizeF((float)0.1, (float)0.2));
+ QCOMPARE(object->rectProperty(), QRect(9, 7, 100, 200));
+ QCOMPARE(object->rectFProperty(), QRectF((float)1000.1, (float)-10.9, (float)400, (float)90.99));
+ QCOMPARE(object->boolProperty(), true);
+ QCOMPARE(object->variantProperty(), QVariant("Hello World!"));
+ 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_qmllanguage::assignTypeExtremes()
+{
+ QmlComponent 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);
+}
+
+// Tests that custom parser types can be instantiated
+void tst_qmllanguage::customParserTypes()
+{
+ QmlComponent 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_qmllanguage::rootAsQmlComponent()
+{
+ QmlComponent 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->children()->count(), 2);
+}
+
+// Tests that components can be specified inline
+void tst_qmllanguage::inlineQmlComponents()
+{
+ QmlComponent component(&engine, TEST_FILE("inlineQmlComponents.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *object = qobject_cast<MyContainer *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->children()->count(), 1);
+ QmlComponent *comp = qobject_cast<QmlComponent *>(object->children()->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_qmllanguage::idProperty()
+{
+ QmlComponent component(&engine, TEST_FILE("idProperty.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *object = qobject_cast<MyContainer *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->children()->count(), 1);
+ MyTypeObject *child =
+ qobject_cast<MyTypeObject *>(object->children()->at(0));
+ QVERIFY(child != 0);
+ QCOMPARE(child->id(), QString("MyObjectId"));
+ QCOMPARE(object->property("object"), QVariant::fromValue((QObject *)child));
+}
+
+// Tests that signals can be assigned to
+void tst_qmllanguage::assignSignal()
+{
+ QmlComponent 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::basicSlot(9)");
+ emit object->basicParameterizedSignal(9);
+}
+
+// Tests the creation and assignment of dynamic properties
+void tst_qmllanguage::dynamicProperties()
+{
+ QmlComponent 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("colorProperty"), QVariant(QColor("red")));
+ QCOMPARE(object->property("dateProperty"), QVariant(QDate(1945, 9, 2)));
+ QCOMPARE(object->property("varProperty"), QVariant("Hello World!"));
+ QCOMPARE(object->property("variantProperty"), QVariant(12));
+}
+
+// Tests the declaration of dynamic signals and slots
+void tst_qmllanguage::dynamicSignalsAndSlots()
+{
+ QmlComponent 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);
+}
+
+void tst_qmllanguage::simpleBindings()
+{
+ QmlComponent 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_qmllanguage::autoComponentCreation()
+{
+ QmlComponent 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_qmllanguage::propertyValueSource()
+{
+ QmlComponent 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) {
+ QmlType *type = QmlMetaType::qmlType(child->metaObject());
+ if (type && type->propertyValueSourceCast() != -1)
+ valueSources.append(child);
+ }
+
+ QCOMPARE(valueSources.count(), 1);
+ MyPropertyValueSource *valueSource =
+ qobject_cast<MyPropertyValueSource *>(valueSources.at(0));
+ QVERIFY(valueSource != 0);
+ QCOMPARE(valueSource->prop.object(), object);
+ QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty")));
+}
+
+void tst_qmllanguage::attachedProperties()
+{
+ QmlComponent 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));
+}
+
+// Tests non-static object properties
+void tst_qmllanguage::dynamicObjects()
+{
+ QmlComponent 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_qmllanguage::customVariantTypes()
+{
+ QmlComponent 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_qmllanguage::valueTypes()
+{
+ QmlComponent component(&engine, TEST_FILE("valueTypes.qml"));
+ VERIFY_ERRORS(0);
+ 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);
+
+ QmlMetaProperty p = QmlMetaProperty::createProperty(object, "rectProperty.x");
+ QCOMPARE(p.read(), QVariant(12));
+ p.write(13);
+ QCOMPARE(p.read(), QVariant(13));
+
+ quint32 r = p.save();
+ QmlMetaProperty p2;
+ p2.restore(r, object);
+ QCOMPARE(p2.read(), QVariant(13));
+}
+
+void tst_qmllanguage::cppnamespace()
+{
+ QmlComponent component(&engine, TEST_FILE("cppnamespace.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qmllanguage::aliasProperties()
+{
+ // Simple "int" alias
+ {
+ QmlComponent 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 throught alias
+ object->setProperty("valueAlias", QVariant(19));
+ QCOMPARE(object->property("valueAlias").toInt(), 19);
+ QCOMPARE(object->property("value").toInt(), 19);
+
+ delete object;
+ }
+
+ // Complex object alias
+ {
+ QmlComponent 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
+ {
+ QmlComponent 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;
+ }
+
+}
+
+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) {}
+};
+
+// Check that first child of qml is of given type. Empty type insists on error.
+void tst_qmllanguage::testType(const QString& qml, const QString& type)
+{
+ QmlComponent component(&engine, qml.toUtf8(), TEST_FILE("empty.qml")); // just a file for relative local imports
+
+ if (type.isEmpty()) {
+ QVERIFY(component.isError());
+ } else {
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(QString(object->metaObject()->className()), type);
+ }
+}
+
+QML_DECLARE_TYPE(TestType)
+QML_DECLARE_TYPE(TestType2)
+
+QML_DEFINE_TYPE(com.nokia.Test, 1, 0, 3, Test, TestType)
+QML_DEFINE_TYPE(com.nokia.Test, 1, 5, 7, Test, TestType)
+QML_DEFINE_TYPE(com.nokia.Test, 1, 8, 9, Test, TestType2)
+QML_DEFINE_TYPE(com.nokia.Test, 1, 12, 13, Test, TestType2)
+QML_DEFINE_TYPE(com.nokia.Test, 1, 9, 11, OldTest, TestType)
+
+void tst_qmllanguage::importsBuiltin_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+
+ // import built-ins
+ QTest::newRow("missing import")
+ << "Test {}"
+ << "";
+ QTest::newRow("not in version 0.0")
+ << "import com.nokia.Test 0.0\n"
+ "Test {}"
+ << "";
+ 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"
+ "Test {}"
+ << "";
+ 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 {}"
+ << "";
+ 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("not in version 1.4")
+ << "import com.nokia.Test 1.4\n"
+ "Test {}"
+ << "";
+ 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("not in version 1.10")
+ << "import com.nokia.Test 1.10\n"
+ "Test {}"
+ << "";
+ QTest::newRow("back 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("no old in version 1.12")
+ << "import com.nokia.Test 1.12\n"
+ "OldTest {}"
+ << "";
+ QTest::newRow("multiversion 1")
+ << "import com.nokia.Test 1.11\n"
+ "import com.nokia.Test 1.12\n"
+ "Test {}"
+ << "TestType2";
+ QTest::newRow("multiversion 2")
+ << "import com.nokia.Test 1.11\n"
+ "import com.nokia.Test 1.12\n"
+ "OldTest {}"
+ << "TestType";
+ 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";
+ QTest::newRow("qualified multiversion 5")
+ << "import com.nokia.Test 1.0 as T0\n"
+ "import com.nokia.Test 1.10 as T10\n"
+ "T10.Test {}"
+ << "";
+}
+
+void tst_qmllanguage::importsBuiltin()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ testType(qml,type);
+}
+
+void tst_qmllanguage::importsLocal_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+
+ // import locals
+ QTest::newRow("local import")
+ << "import \"subdir\"\n"
+ "Test {}"
+ << "QFxRect";
+ QTest::newRow("local import as")
+ << "import \"subdir\" as T\n"
+ "T.Test {}"
+ << "QFxRect";
+ QTest::newRow("wrong local import as")
+ << "import \"subdir\" as T\n"
+ "Test {}"
+ << "";
+ QTest::newRow("library precedence over local import")
+ << "import \"subdir\"\n"
+ "import com.nokia.Test 1.0\n"
+ "Test {}"
+ << "TestType";
+}
+
+void tst_qmllanguage::importsLocal()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ testType(qml,type);
+}
+
+void tst_qmllanguage::importsInstalled_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+
+ // import installed
+ QTest::newRow("installed import")
+ << "import com.nokia.installedtest 1.0\n"
+ "InstalledTest {}"
+ << "QFxRect";
+ QTest::newRow("installed import")
+ << "import com.nokia.installedtest 1.4\n"
+ "InstalledTest {}"
+ << "QFxText";
+}
+
+void tst_qmllanguage::importsInstalled()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ testType(qml,type);
+}
+
+
+void tst_qmllanguage::importsOrder_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+
+ QTest::newRow("installed import overrides 1") <<
+ "import com.nokia.installedtest 1.0\n"
+ "import com.nokia.installedtest 1.4\n"
+ "InstalledTest {}"
+ << "QFxText";
+ QTest::newRow("installed import overrides 2") <<
+ "import com.nokia.installedtest 1.4\n"
+ "import com.nokia.installedtest 1.0\n"
+ "InstalledTest {}"
+ << "QFxRect";
+ 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 {}"
+ << "QFxText";
+ 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 {}"
+ << "QFxRect";
+
+ QTest::newRow("installed import versus builtin 1") <<
+ "import com.nokia.installedtest 1.5\n"
+ "import Qt 4.6\n"
+ "Rectangle {}"
+ << "QFxRect";
+ QTest::newRow("installed import versus builtin 2") <<
+ "import Qt 4.6\n"
+ "import com.nokia.installedtest 1.5\n"
+ "Rectangle {}"
+ << "QFxText";
+ QTest::newRow("namespaces cannot be overridden by types 1") <<
+ "import Qt 4.6 as Rectangle\n"
+ "import com.nokia.installedtest 1.5\n"
+ "Rectangle {}"
+ << "";
+ QTest::newRow("namespaces cannot be overridden by types 2") <<
+ "import Qt 4.6 as Rectangle\n"
+ "import com.nokia.installedtest 1.5\n"
+ "Rectangle.Image {}"
+ << "QFxImage";
+}
+
+void tst_qmllanguage::importsOrder()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ testType(qml,type);
+}
+
+void tst_qmllanguage::crash1()
+{
+ QmlComponent component(&engine, "Component {}");
+}
+
+QTEST_MAIN(tst_qmllanguage)
+
+#include "tst_qmllanguage.moc"