summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r--tests/auto/declarative/anchors/data/anchors.qml27
-rw-r--r--tests/auto/declarative/anchors/tst_anchors.cpp16
-rw-r--r--tests/auto/declarative/animations/data/badproperty1.qml2
-rw-r--r--tests/auto/declarative/animations/data/badtype4.qml4
-rw-r--r--tests/auto/declarative/animations/data/dotproperty.qml4
-rw-r--r--tests/auto/declarative/animations/data/mixedtype1.qml2
-rw-r--r--tests/auto/declarative/animations/data/mixedtype2.qml2
-rw-r--r--tests/auto/declarative/animations/data/properties.qml14
-rw-r--r--tests/auto/declarative/animations/data/properties2.qml14
-rw-r--r--tests/auto/declarative/animations/data/properties3.qml14
-rw-r--r--tests/auto/declarative/animations/data/properties4.qml14
-rw-r--r--tests/auto/declarative/animations/data/properties5.qml14
-rw-r--r--tests/auto/declarative/animations/data/propertiesTransition.qml29
-rw-r--r--tests/auto/declarative/animations/data/propertiesTransition2.qml29
-rw-r--r--tests/auto/declarative/animations/data/propertiesTransition3.qml29
-rw-r--r--tests/auto/declarative/animations/data/propertiesTransition4.qml29
-rw-r--r--tests/auto/declarative/animations/data/propertiesTransition5.qml29
-rw-r--r--tests/auto/declarative/animations/data/propertiesTransition6.qml29
-rw-r--r--tests/auto/declarative/animations/tst_animations.cpp144
-rw-r--r--tests/auto/declarative/behaviors/data/nonSelecting.qml2
-rw-r--r--tests/auto/declarative/behaviors/data/nonSelecting2.qml26
-rw-r--r--tests/auto/declarative/behaviors/tst_behaviors.cpp27
-rw-r--r--tests/auto/declarative/declarative.pro3
-rw-r--r--tests/auto/declarative/layouts/data/grid-animated.qml6
-rw-r--r--tests/auto/declarative/layouts/data/horizontal-animated.qml6
-rw-r--r--tests/auto/declarative/layouts/data/vertical-animated.qml6
-rw-r--r--tests/auto/declarative/qmlgraphicsitem/data/keys.qml15
-rw-r--r--tests/auto/declarative/qmlgraphicsitem/qmlgraphicsitem.pro7
-rw-r--r--tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp237
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/data/listview-enforcerange.qml (renamed from tests/auto/declarative/listview/data/listview-enforcerange.qml)0
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/data/listview-sections.qml (renamed from tests/auto/declarative/listview/data/listview-sections.qml)0
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/data/listview.qml (renamed from tests/auto/declarative/listview/data/listview.qml)0
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/qmlgraphicslistview.pro (renamed from tests/auto/declarative/listview/listview.pro)2
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp (renamed from tests/auto/declarative/listview/tst_listview.cpp)2
-rw-r--r--tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml1
-rw-r--r--tests/auto/declarative/qmllanguage/data/attachedProperties.qml3
-rw-r--r--tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.qml7
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.qml7
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.qml8
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.qml7
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.qml7
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.qml7
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.qml7
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.1.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.2.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.15.errors.txt1
-rw-r--r--tests/auto/declarative/qmllanguage/data/wrongType.15.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/testtypes.h19
-rw-r--r--tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp36
-rw-r--r--tests/auto/declarative/qmltimer/tst_qmltimer.cpp10
-rw-r--r--tests/auto/declarative/visual/bindinganimation/bindinganimation.qml2
-rw-r--r--tests/auto/declarative/visual/easing/easing.qml2
82 files changed, 961 insertions, 36 deletions
diff --git a/tests/auto/declarative/anchors/data/anchors.qml b/tests/auto/declarative/anchors/data/anchors.qml
index 377dd2d..765e5b6 100644
--- a/tests/auto/declarative/anchors/data/anchors.qml
+++ b/tests/auto/declarative/anchors/data/anchors.qml
@@ -114,4 +114,31 @@ Rectangle {
y: 70; width: 10; height: 10
anchors.horizontalCenter: parent.left
}
+ Rectangle {
+ id: Rect22; objectName: "Rect22"
+ width: 10; height: 10
+ anchors.centerIn: MasterRect
+ }
+ Rectangle {
+ id: Rect23; objectName: "Rect23"
+ anchors.left: MasterRect.left
+ anchors.leftMargin: 5
+ anchors.right: MasterRect.right
+ anchors.rightMargin: 5
+ anchors.top: MasterRect.top
+ anchors.topMargin: 5
+ anchors.bottom: MasterRect.bottom
+ anchors.bottomMargin: 5
+ }
+ Text {
+ id: text1; objectName: "text1"
+ y: 200;
+ text: "Hello"
+ }
+ Text {
+ id: text2; objectName: "text2"
+ anchors.baseline: text1.baseline
+ anchors.left: text1.right
+ text: "World"
+ }
}
diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp
index 8abf04f..c3a857c 100644
--- a/tests/auto/declarative/anchors/tst_anchors.cpp
+++ b/tests/auto/declarative/anchors/tst_anchors.cpp
@@ -43,6 +43,7 @@
#include <QtDeclarative/qmlcomponent.h>
#include <QtDeclarative/qmlview.h>
#include <private/qmlgraphicsrectangle_p.h>
+#include <private/qmlgraphicstext_p.h>
#include <QtDeclarative/private/qmlgraphicsanchors_p_p.h>
@@ -131,6 +132,21 @@ void tst_anchors::basicAnchors()
QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect20"))->x(), 235.0);
QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect21"))->x(), -5.0);
+ //centerIn
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect22"))->x(), 69.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect22"))->y(), 5.0);
+
+ //margins
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect23"))->x(), 31.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect23"))->y(), 5.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect23"))->width(), 86.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect23"))->height(), 10.0);
+
+ //baseline
+ QmlGraphicsText *text1 = findItem<QmlGraphicsText>(view->root(), QLatin1String("text1"));
+ QmlGraphicsText *text2 = findItem<QmlGraphicsText>(view->root(), QLatin1String("text2"));
+ QCOMPARE(text1->y(), text2->y());
+
delete view;
}
diff --git a/tests/auto/declarative/animations/data/badproperty1.qml b/tests/auto/declarative/animations/data/badproperty1.qml
index 78da34a..df1a98d 100644
--- a/tests/auto/declarative/animations/data/badproperty1.qml
+++ b/tests/auto/declarative/animations/data/badproperty1.qml
@@ -19,6 +19,6 @@ Rectangle {
PropertyChanges { target: MyRect; border.color: "blue" }
}
transitions: Transition {
- ColorAnimation { target: MyRect; to: "red"; properties: "pen.colr"; duration: 1000 }
+ ColorAnimation { target: MyRect; to: "red"; property: "pen.colr"; duration: 1000 }
}
}
diff --git a/tests/auto/declarative/animations/data/badtype4.qml b/tests/auto/declarative/animations/data/badtype4.qml
index 0c0a636..5db6c17 100644
--- a/tests/auto/declarative/animations/data/badtype4.qml
+++ b/tests/auto/declarative/animations/data/badtype4.qml
@@ -20,7 +20,7 @@ Rectangle {
}
transitions: Transition {
//comment out each in turn to make sure each only animates the relevant property
- ColorAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color
- NumberAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color
+ ColorAnimation { matchProperties: "x,color"; duration: 1000 } //x is real, color is color
+ NumberAnimation { matchProperties: "x,color"; duration: 1000 } //x is real, color is color
}
}
diff --git a/tests/auto/declarative/animations/data/dotproperty.qml b/tests/auto/declarative/animations/data/dotproperty.qml
index ee076c2..3ddb002 100644
--- a/tests/auto/declarative/animations/data/dotproperty.qml
+++ b/tests/auto/declarative/animations/data/dotproperty.qml
@@ -16,9 +16,9 @@ Rectangle {
}
states: State {
name: "state1"
- PropertyChanges { target: MyRect; pen.color: "blue" }
+ PropertyChanges { target: MyRect; border.color: "blue" }
}
transitions: Transition {
- ColorAnimation { properties: "pen.color"; duration: 1000 }
+ ColorAnimation { matchProperties: "border.color"; duration: 1000 }
}
}
diff --git a/tests/auto/declarative/animations/data/mixedtype1.qml b/tests/auto/declarative/animations/data/mixedtype1.qml
index ed50582..5ecf14f 100644
--- a/tests/auto/declarative/animations/data/mixedtype1.qml
+++ b/tests/auto/declarative/animations/data/mixedtype1.qml
@@ -19,6 +19,6 @@ Rectangle {
PropertyChanges { target: MyRect; x: 200; border.width: 10 }
}
transitions: Transition {
- PropertyAnimation { properties: "x,border.width"; duration: 1000 } //x is real, border.width is int
+ PropertyAnimation { matchProperties: "x,border.width"; duration: 1000 } //x is real, border.width is int
}
}
diff --git a/tests/auto/declarative/animations/data/mixedtype2.qml b/tests/auto/declarative/animations/data/mixedtype2.qml
index 4854c2e..645f1d0 100644
--- a/tests/auto/declarative/animations/data/mixedtype2.qml
+++ b/tests/auto/declarative/animations/data/mixedtype2.qml
@@ -19,6 +19,6 @@ Rectangle {
PropertyChanges { target: MyRect; x: 200; color: "blue" }
}
transitions: Transition {
- PropertyAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color
+ PropertyAnimation { matchProperties: "x,color"; duration: 1000 } //x is real, color is color
}
}
diff --git a/tests/auto/declarative/animations/data/properties.qml b/tests/auto/declarative/animations/data/properties.qml
new file mode 100644
index 0000000..a8023b4
--- /dev/null
+++ b/tests/auto/declarative/animations/data/properties.qml
@@ -0,0 +1,14 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ x: NumberAnimation { to: 200; running: true; }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/properties2.qml b/tests/auto/declarative/animations/data/properties2.qml
new file mode 100644
index 0000000..aab7661
--- /dev/null
+++ b/tests/auto/declarative/animations/data/properties2.qml
@@ -0,0 +1,14 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ x: NumberAnimation { matchTargets: theRect; matchProperties: "x"; to: 200; running: true }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/properties3.qml b/tests/auto/declarative/animations/data/properties3.qml
new file mode 100644
index 0000000..fd21a85
--- /dev/null
+++ b/tests/auto/declarative/animations/data/properties3.qml
@@ -0,0 +1,14 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ x: NumberAnimation { target: theRect; property: "x"; to: 300; running: true }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/properties4.qml b/tests/auto/declarative/animations/data/properties4.qml
new file mode 100644
index 0000000..e23651c
--- /dev/null
+++ b/tests/auto/declarative/animations/data/properties4.qml
@@ -0,0 +1,14 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ x: NumberAnimation { target: theRect; property: "y"; to: 200; running: true }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/properties5.qml b/tests/auto/declarative/animations/data/properties5.qml
new file mode 100644
index 0000000..25c9866
--- /dev/null
+++ b/tests/auto/declarative/animations/data/properties5.qml
@@ -0,0 +1,14 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ x: NumberAnimation { matchTargets: theRect; matchProperties: "y"; to: 200; running: true }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/propertiesTransition.qml b/tests/auto/declarative/animations/data/propertiesTransition.qml
new file mode 100644
index 0000000..75603b9
--- /dev/null
+++ b/tests/auto/declarative/animations/data/propertiesTransition.qml
@@ -0,0 +1,29 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { matchTargets: theRect; matchProperties: "x" }
+ }
+
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/declarative/animations/data/propertiesTransition2.qml b/tests/auto/declarative/animations/data/propertiesTransition2.qml
new file mode 100644
index 0000000..ae59157
--- /dev/null
+++ b/tests/auto/declarative/animations/data/propertiesTransition2.qml
@@ -0,0 +1,29 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { target: theRect; property: "y"; to: 200 }
+ }
+
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/declarative/animations/data/propertiesTransition3.qml b/tests/auto/declarative/animations/data/propertiesTransition3.qml
new file mode 100644
index 0000000..eedba7b
--- /dev/null
+++ b/tests/auto/declarative/animations/data/propertiesTransition3.qml
@@ -0,0 +1,29 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { matchTargets: theRect; matchProperties: "y" }
+ }
+
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/declarative/animations/data/propertiesTransition4.qml b/tests/auto/declarative/animations/data/propertiesTransition4.qml
new file mode 100644
index 0000000..301f796
--- /dev/null
+++ b/tests/auto/declarative/animations/data/propertiesTransition4.qml
@@ -0,0 +1,29 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { target: theRect; matchProperties: "x" }
+ }
+
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/declarative/animations/data/propertiesTransition5.qml b/tests/auto/declarative/animations/data/propertiesTransition5.qml
new file mode 100644
index 0000000..565c519
--- /dev/null
+++ b/tests/auto/declarative/animations/data/propertiesTransition5.qml
@@ -0,0 +1,29 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { matchTargets: theRect; property: "x" }
+ }
+
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/declarative/animations/data/propertiesTransition6.qml b/tests/auto/declarative/animations/data/propertiesTransition6.qml
new file mode 100644
index 0000000..b541dab
--- /dev/null
+++ b/tests/auto/declarative/animations/data/propertiesTransition6.qml
@@ -0,0 +1,29 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { matchTargets: theItem; matchProperties: "x" }
+ }
+
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp
index ca383bb..a4402cb 100644
--- a/tests/auto/declarative/animations/tst_animations.cpp
+++ b/tests/auto/declarative/animations/tst_animations.cpp
@@ -59,6 +59,8 @@ private slots:
void badTypes();
void badProperties();
void mixedTypes();
+ void properties();
+ void propertiesTransition();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -198,11 +200,12 @@ void tst_animations::badProperties()
{
QmlEngine engine;
QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badproperty1.qml"));
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlColorAnimation (file://" SRCDIR "/data/badproperty1.qml:22:9) Cannot animate non-existant property \"pen.colr\"");
QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
QVERIFY(rect);
- QTest::ignoreMessage(QtWarningMsg, "QML QmlColorAnimation (file://" SRCDIR "/data/badproperty1.qml:22:9) Cannot animate non-existant property \"pen.colr\"");
- rect->setState("state1");
+ //### should we warn here are well?
+ //rect->setState("state1");
}
}
@@ -244,6 +247,143 @@ void tst_animations::mixedTypes()
}
}
+void tst_animations::properties()
+{
+ const int waitDuration = 300;
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/properties.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(200));
+ }
+
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/properties2.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(200));
+ }
+
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/properties3.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(300));
+ }
+
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/properties4.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->y(),qreal(200));
+ QTIMED_COMPARE(myRect->x(),qreal(100));
+ }
+
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/properties5.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(100));
+ QTIMED_COMPARE(myRect->y(),qreal(100));
+ }
+}
+
+void tst_animations::propertiesTransition()
+{
+ const int waitDuration = 300;
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/propertiesTransition.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ rect->setState("moved");
+ QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(200));
+ }
+
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/propertiesTransition2.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect");
+ QVERIFY(myRect);
+ rect->setState("moved");
+ QCOMPARE(myRect->x(),qreal(200));
+ QCOMPARE(myRect->y(),qreal(100));
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->y(),qreal(200));
+ }
+
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/propertiesTransition3.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlNumberAnimation (file:///home/brasser/depot/kinetic-declarativeui/qt/tests/auto/declarative/animations/data/propertiesTransition4.qml:22:9) targets/properties/exclude and target/property are mutually exclusive.");
+ rect->setState("moved");
+ QCOMPARE(myRect->x(),qreal(200));
+ }
+
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/propertiesTransition4.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlNumberAnimation (file:///home/brasser/depot/kinetic-declarativeui/qt/tests/auto/declarative/animations/data/propertiesTransition5.qml:22:9) targets/properties/exclude and target/property are mutually exclusive.");
+ rect->setState("moved");
+ QCOMPARE(myRect->x(),qreal(200));
+ }
+
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/propertiesTransition5.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ //### should output warning at some point -- theItem doesn't exist
+ QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect");
+ QVERIFY(myRect);
+ rect->setState("moved");
+ QCOMPARE(myRect->x(),qreal(200));
+ }
+}
+
QTEST_MAIN(tst_animations)
#include "tst_animations.moc"
diff --git a/tests/auto/declarative/behaviors/data/nonSelecting.qml b/tests/auto/declarative/behaviors/data/nonSelecting.qml
index ae9a9f5..ba36d93 100644
--- a/tests/auto/declarative/behaviors/data/nonSelecting.qml
+++ b/tests/auto/declarative/behaviors/data/nonSelecting.qml
@@ -8,7 +8,7 @@ Rectangle {
width: 100; height: 100; color: "green"
x: Behavior {
objectName: "MyBehavior";
- NumberAnimation { target: rect; property: "y"; duration: 200; }
+ NumberAnimation { target: rect; property: "x"; duration: 200; }
}
}
MouseRegion {
diff --git a/tests/auto/declarative/behaviors/data/nonSelecting2.qml b/tests/auto/declarative/behaviors/data/nonSelecting2.qml
new file mode 100644
index 0000000..e9849eb
--- /dev/null
+++ b/tests/auto/declarative/behaviors/data/nonSelecting2.qml
@@ -0,0 +1,26 @@
+import Qt 4.6
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ x: Behavior {
+ objectName: "MyBehavior";
+ NumberAnimation { matchTargets: rect; matchProperties: "y"; duration: 200; }
+ }
+ }
+ MouseRegion {
+ id: clicker
+ anchors.fill: parent
+ }
+ states: State {
+ name: "moved"
+ when: clicker.pressed
+ PropertyChanges {
+ target: rect
+ x: 200
+ }
+ }
+}
diff --git a/tests/auto/declarative/behaviors/tst_behaviors.cpp b/tests/auto/declarative/behaviors/tst_behaviors.cpp
index da910d9..6343968 100644
--- a/tests/auto/declarative/behaviors/tst_behaviors.cpp
+++ b/tests/auto/declarative/behaviors/tst_behaviors.cpp
@@ -208,14 +208,27 @@ void tst_behaviors::emptyBehavior()
void tst_behaviors::nonSelectingBehavior()
{
- QmlEngine engine;
- QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/nonSelecting.qml"));
- QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
- QVERIFY(rect);
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/nonSelecting.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
- rect->setState("moved");
- qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x();
- QCOMPARE(x, qreal(200)); //should change immediately
+ rect->setState("moved");
+ qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x();
+ QCOMPARE(x, qreal(200)); //should change immediately
+ }
+
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/nonSelecting2.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ rect->setState("moved");
+ qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x();
+ QCOMPARE(x, qreal(200)); //should change immediately
+ }
}
void tst_behaviors::reassignedAnimation()
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 6533cfd..64672f6 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -7,7 +7,7 @@ SUBDIRS += \
datetimeformatter \ # Cover
examples \
layouts \ # Cover
- listview \ # Cover
+ qmlgraphicslistview \ # Cover
qmlgraphicsgridview \ # Cover
numberformatter \ # Cover
pathview \ # Cover
@@ -22,6 +22,7 @@ SUBDIRS += \
qmlecmascript \ # Cover
qmlerror \ # Cover
qmlfontloader \ # Cover
+ qmlgraphicsitem \ # Cover
qmlgraphicsborderimage \ # Cover
qmlgraphicsparticles \ # Cover
qmlgraphicstext \ # Cover
diff --git a/tests/auto/declarative/layouts/data/grid-animated.qml b/tests/auto/declarative/layouts/data/grid-animated.qml
index 9edccaf..6b128ce 100644
--- a/tests/auto/declarative/layouts/data/grid-animated.qml
+++ b/tests/auto/declarative/layouts/data/grid-animated.qml
@@ -7,17 +7,17 @@ Item {
columns: 3
add: Transition {
NumberAnimation {
- properties: "x,y"; from: -100
+ matchProperties: "x,y"; from: -100
}
}
remove: Transition {
NumberAnimation {
- properties: "x,y"; to: -100
+ matchProperties: "x,y"; to: -100
}
}
move: Transition {
NumberAnimation {
- properties: "x,y";
+ matchProperties: "x,y";
}
}
Rectangle {
diff --git a/tests/auto/declarative/layouts/data/horizontal-animated.qml b/tests/auto/declarative/layouts/data/horizontal-animated.qml
index f757d18..c29d6df 100644
--- a/tests/auto/declarative/layouts/data/horizontal-animated.qml
+++ b/tests/auto/declarative/layouts/data/horizontal-animated.qml
@@ -6,17 +6,17 @@ Item {
Row {
add: Transition {
NumberAnimation {
- properties: "x"; from: -100
+ matchProperties: "x"; from: -100
}
}
remove: Transition {
NumberAnimation {
- properties: "x"; to: -100
+ matchProperties: "x"; to: -100
}
}
move: Transition {
NumberAnimation {
- properties: "x";
+ matchProperties: "x";
}
}
Rectangle {
diff --git a/tests/auto/declarative/layouts/data/vertical-animated.qml b/tests/auto/declarative/layouts/data/vertical-animated.qml
index f52a78a..fcbc5f7 100644
--- a/tests/auto/declarative/layouts/data/vertical-animated.qml
+++ b/tests/auto/declarative/layouts/data/vertical-animated.qml
@@ -6,17 +6,17 @@ Item {
Column {
add: Transition {
NumberAnimation {
- properties: "y"; from: -100
+ matchProperties: "y"; from: -100
}
}
remove: Transition {
NumberAnimation {
- properties: "y"; to: -100
+ matchProperties: "y"; to: -100
}
}
move: Transition {
NumberAnimation {
- properties: "y";
+ matchProperties: "y";
}
}
Rectangle {
diff --git a/tests/auto/declarative/qmlgraphicsitem/data/keys.qml b/tests/auto/declarative/qmlgraphicsitem/data/keys.qml
new file mode 100644
index 0000000..7c16559
--- /dev/null
+++ b/tests/auto/declarative/qmlgraphicsitem/data/keys.qml
@@ -0,0 +1,15 @@
+import Qt 4.6
+
+Item {
+ focus: true
+ Keys.onPressed: keysTestObject.keyPress(event.key, event.text, event.modifiers)
+ Keys.onReleased: { keysTestObject.keyRelease(event.key, event.text, event.modifiers); event.accepted = true; }
+ Keys.onReturnPressed: keysTestObject.keyPress(event.key, "Return", event.modifiers)
+ Keys.forwardTo: [ item2 ]
+
+ Item {
+ id: item2
+ Keys.onPressed: keysTestObject.forwardedKey(event.key)
+ Keys.onReleased: keysTestObject.forwardedKey(event.key)
+ }
+}
diff --git a/tests/auto/declarative/qmlgraphicsitem/qmlgraphicsitem.pro b/tests/auto/declarative/qmlgraphicsitem/qmlgraphicsitem.pro
new file mode 100644
index 0000000..ddabf9a
--- /dev/null
+++ b/tests/auto/declarative/qmlgraphicsitem/qmlgraphicsitem.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qmlgraphicsitem.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp
new file mode 100644
index 0000000..b3b5374
--- /dev/null
+++ b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qmlcontext.h>
+#include <QtDeclarative/qmlview.h>
+#include <qmlgraphicsitem.h>
+
+class tst_QmlGraphicsItem : public QObject
+
+{
+ Q_OBJECT
+public:
+ tst_QmlGraphicsItem();
+
+private slots:
+ void keys();
+ void keyNavigation();
+
+private:
+ template<typename T>
+ T *findItem(QmlGraphicsItem *parent, const QString &objectName);
+};
+
+class KeysTestObject : public QObject
+{
+ Q_OBJECT
+public:
+ KeysTestObject() : mKey(0), mModifiers(0), mForwardedKey(0) {}
+
+ void reset() {
+ mKey = 0;
+ mText = QString();
+ mModifiers = 0;
+ mForwardedKey = 0;
+ }
+
+public slots:
+ void keyPress(int key, QString text, int modifiers) {
+ mKey = key;
+ mText = text;
+ mModifiers = modifiers;
+ }
+ void keyRelease(int key, QString text, int modifiers) {
+ mKey = key;
+ mText = text;
+ mModifiers = modifiers;
+ }
+ void forwardedKey(int key) {
+ mForwardedKey = key;
+ }
+
+public:
+ int mKey;
+ QString mText;
+ int mModifiers;
+ int mForwardedKey;
+
+private:
+};
+
+
+tst_QmlGraphicsItem::tst_QmlGraphicsItem()
+{
+}
+
+void tst_QmlGraphicsItem::keys()
+{
+ QmlView *canvas = new QmlView(0);
+ canvas->setFixedSize(240,320);
+
+ canvas->setUrl(QUrl("file://" SRCDIR "/data/keys.qml"));
+
+ KeysTestObject *testObject = new KeysTestObject;
+ canvas->rootContext()->setContextProperty("keysTestObject", testObject);
+
+ canvas->execute();
+ canvas->show();
+ qApp->processEvents();
+
+ QEvent wa(QEvent::WindowActivate);
+ QApplication::sendEvent(canvas, &wa);
+ QFocusEvent fe(QEvent::FocusIn);
+ QApplication::sendEvent(canvas, &fe);
+
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_A));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_A));
+ QCOMPARE(testObject->mText, QLatin1String("A"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(!key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::ShiftModifier, "A", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_A));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_A));
+ QCOMPARE(testObject->mText, QLatin1String("A"));
+ QVERIFY(testObject->mModifiers == Qt::ShiftModifier);
+ QVERIFY(key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_Return));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Return));
+ QCOMPARE(testObject->mText, QLatin1String("Return"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(key.isAccepted());
+
+ delete canvas;
+ delete testObject;
+}
+
+void tst_QmlGraphicsItem::keyNavigation()
+{
+ QmlView *canvas = new QmlView(0);
+ canvas->setFixedSize(240,320);
+
+ canvas->setUrl(QUrl("file://" SRCDIR "/data/keynavigation.qml"));
+ canvas->execute();
+ canvas->show();
+ qApp->processEvents();
+
+ QEvent wa(QEvent::WindowActivate);
+ QApplication::sendEvent(canvas, &wa);
+ QFocusEvent fe(QEvent::FocusIn);
+ QApplication::sendEvent(canvas, &fe);
+
+ QmlGraphicsItem *item = findItem<QmlGraphicsItem>(canvas->root(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasFocus());
+
+ // right
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QmlGraphicsItem>(canvas->root(), "item2");
+ QVERIFY(item);
+ QVERIFY(item->hasFocus());
+
+ // down
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QmlGraphicsItem>(canvas->root(), "item4");
+ QVERIFY(item);
+ QVERIFY(item->hasFocus());
+
+ // left
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QmlGraphicsItem>(canvas->root(), "item3");
+ QVERIFY(item);
+ QVERIFY(item->hasFocus());
+
+ // up
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier, "", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QmlGraphicsItem>(canvas->root(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasFocus());
+}
+
+template<typename T>
+T *tst_QmlGraphicsItem::findItem(QmlGraphicsItem *parent, const QString &objectName)
+{
+ const QMetaObject &mo = T::staticMetaObject;
+ //qDebug() << parent->QGraphicsObject::children().count() << "children";
+ for (int i = 0; i < parent->QGraphicsObject::children().count(); ++i) {
+ QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->QGraphicsObject::children().at(i));
+ if(!item)
+ continue;
+ //qDebug() << "try" << item;
+ if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName))
+ return static_cast<T*>(item);
+ item = findItem<T>(item, objectName);
+ if (item)
+ return static_cast<T*>(item);
+ }
+
+ return 0;
+}
+
+
+
+QTEST_MAIN(tst_QmlGraphicsItem)
+
+#include "tst_qmlgraphicsitem.moc"
diff --git a/tests/auto/declarative/listview/data/listview-enforcerange.qml b/tests/auto/declarative/qmlgraphicslistview/data/listview-enforcerange.qml
index 46fddae..46fddae 100644
--- a/tests/auto/declarative/listview/data/listview-enforcerange.qml
+++ b/tests/auto/declarative/qmlgraphicslistview/data/listview-enforcerange.qml
diff --git a/tests/auto/declarative/listview/data/listview-sections.qml b/tests/auto/declarative/qmlgraphicslistview/data/listview-sections.qml
index 56700be..56700be 100644
--- a/tests/auto/declarative/listview/data/listview-sections.qml
+++ b/tests/auto/declarative/qmlgraphicslistview/data/listview-sections.qml
diff --git a/tests/auto/declarative/listview/data/listview.qml b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml
index b7b838b..b7b838b 100644
--- a/tests/auto/declarative/listview/data/listview.qml
+++ b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml
diff --git a/tests/auto/declarative/listview/listview.pro b/tests/auto/declarative/qmlgraphicslistview/qmlgraphicslistview.pro
index 23b0706..f00de39 100644
--- a/tests/auto/declarative/listview/listview.pro
+++ b/tests/auto/declarative/qmlgraphicslistview/qmlgraphicslistview.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
macx:CONFIG -= app_bundle
-SOURCES += tst_listview.cpp
+SOURCES += tst_qmlgraphicslistview.cpp
# Define SRCDIR equal to test's source directory
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/listview/tst_listview.cpp b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
index 5575ace..9f904b8 100644
--- a/tests/auto/declarative/listview/tst_listview.cpp
+++ b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
@@ -850,4 +850,4 @@ QList<T*> tst_QmlGraphicsListView::findItems(QmlGraphicsItem *parent, const QStr
QTEST_MAIN(tst_QmlGraphicsListView)
-#include "tst_listview.moc"
+#include "tst_qmlgraphicslistview.moc"
diff --git a/tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml b/tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml
index 50723a3..c86c96b 100644
--- a/tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml
+++ b/tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml
@@ -23,6 +23,7 @@ MyTypeObject {
boolProperty: true
variantProperty: "Hello World!"
vectorProperty: "10,1,2.2"
+ urlProperty: "main.qml"
objectProperty: MyTypeObject { intProperty: 8 }
}
diff --git a/tests/auto/declarative/qmllanguage/data/attachedProperties.qml b/tests/auto/declarative/qmllanguage/data/attachedProperties.qml
index 8343754..fec96cc 100644
--- a/tests/auto/declarative/qmllanguage/data/attachedProperties.qml
+++ b/tests/auto/declarative/qmllanguage/data/attachedProperties.qml
@@ -1,5 +1,8 @@
import Test 1.0
+import Test 1.0 as Namespace
import Qt 4.6
+
Object {
MyQmlObject.value: 10
+ Namespace.MyQmlObject.value2: 13
}
diff --git a/tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt b/tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt
index e56ad3a..3074823 100644
--- a/tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt
@@ -1 +1 @@
-3:5:Invalid property access
+3:5:Invalid grouped property access
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt
new file mode 100644
index 0000000..68fe671
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt
@@ -0,0 +1 @@
+5:17:Cannot assign to non-existant property "foo"
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.qml b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.qml
new file mode 100644
index 0000000..e99c635
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+import Qt 4.6
+
+Object {
+ MyQmlObject.foo: 10
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt
new file mode 100644
index 0000000..7f630f4
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt
@@ -0,0 +1 @@
+5:15:Non-existant attached object
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.qml b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.qml
new file mode 100644
index 0000000..8f987ce
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.qml
@@ -0,0 +1,6 @@
+import Test 1.0 as Namespace
+import Qt 4.6
+
+Object {
+ Namespace.MadeUpClass.foo: 10
+}
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.errors.txt
new file mode 100644
index 0000000..fee5050
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.errors.txt
@@ -0,0 +1 @@
+5:15:Not an attached property name
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.qml b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.qml
new file mode 100644
index 0000000..18770fc
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.qml
@@ -0,0 +1,7 @@
+import Test 1.0 as Namespace
+import Qt 4.6
+
+Object {
+ Namespace.madeUpClass.foo: 10
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt
new file mode 100644
index 0000000..9f06e07
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt
@@ -0,0 +1 @@
+5:27:Cannot assign to non-existant property "foo"
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.qml b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.qml
new file mode 100644
index 0000000..3c9ae5b
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.qml
@@ -0,0 +1,6 @@
+import Test 1.0 as Namespace
+import Qt 4.6
+
+Object {
+ Namespace.MyQmlObject.foo: 10
+}
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.errors.txt
new file mode 100644
index 0000000..05161c4
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.errors.txt
@@ -0,0 +1 @@
+5:5:Invalid attached object assignment
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.qml b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.qml
new file mode 100644
index 0000000..e9405a4
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import Qt 4.6
+
+Object {
+ MyQmlObject: 10
+}
+
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.errors.txt
new file mode 100644
index 0000000..a208bcf
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.errors.txt
@@ -0,0 +1 @@
+5:15:Invalid attached object assignment
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.qml b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.qml
new file mode 100644
index 0000000..6fbf718
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.qml
@@ -0,0 +1,7 @@
+import Test 1.0 as Namespace
+import Qt 4.6
+
+Object {
+ Namespace.MyQmlObject: 10
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.errors.txt
new file mode 100644
index 0000000..05161c4
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.errors.txt
@@ -0,0 +1 @@
+5:5:Invalid attached object assignment
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.qml b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.qml
new file mode 100644
index 0000000..1827a16
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+import Qt 4.6
+
+Object {
+ MyQmlObject: Object {}
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt
new file mode 100644
index 0000000..e232b23
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt
@@ -0,0 +1 @@
+5:5:Non-existant attached object
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.qml b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.qml
new file mode 100644
index 0000000..5c7f0ec
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+import Qt 4.6
+
+Object {
+ Test.MyQmlObject: Object {}
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt
new file mode 100644
index 0000000..e232b23
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt
@@ -0,0 +1 @@
+5:5:Non-existant attached object
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.qml b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.qml
new file mode 100644
index 0000000..841cc08
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+import Qt 4.6
+
+Object {
+ MyTypeObject.foo: 10
+}
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt
new file mode 100644
index 0000000..7f630f4
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt
@@ -0,0 +1 @@
+5:15:Non-existant attached object
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.qml b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.qml
new file mode 100644
index 0000000..f1b4b96
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.qml
@@ -0,0 +1,6 @@
+import Test 1.0 as Namespace
+import Qt 4.6
+
+Object {
+ Namespace.MyTypeObject.foo: 10
+}
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt
new file mode 100644
index 0000000..e232b23
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt
@@ -0,0 +1 @@
+5:5:Non-existant attached object
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.qml b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.qml
new file mode 100644
index 0000000..99c4a5c
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+import Qt 4.6
+
+Object {
+ MadeUpClass.foo: 10
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.1.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.1.errors.txt
index 7c00ce4..810fd31 100644
--- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.1.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.1.errors.txt
@@ -1 +1 @@
-5:5:Invalid property access
+5:5:Invalid grouped property access
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.2.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.2.errors.txt
index 7c00ce4..810fd31 100644
--- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.2.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.2.errors.txt
@@ -1 +1 @@
-5:5:Invalid property access
+5:5:Invalid grouped property access
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.errors.txt
new file mode 100644
index 0000000..f6d6f29
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.errors.txt
@@ -0,0 +1 @@
+4:5:Invalid grouped property access
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.qml b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.qml
new file mode 100644
index 0000000..0bbfc4f
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyQmlObject {
+ customType.x: 10
+}
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt
new file mode 100644
index 0000000..19934fa
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt
@@ -0,0 +1 @@
+4:5:Cannot assign to non-existant property "foo"
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.qml b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.qml
new file mode 100644
index 0000000..134fef9
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyQmlObject {
+ foo.x: 10
+}
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.errors.txt
new file mode 100644
index 0000000..2c8a970
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.errors.txt
@@ -0,0 +1 @@
+4:18:Property assignment expected
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.qml b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.qml
new file mode 100644
index 0000000..55cefe6
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ rectProperty.x.foo: 100
+}
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.errors.txt
new file mode 100644
index 0000000..8331725
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.errors.txt
@@ -0,0 +1 @@
+5:18:Single property assignment expected
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.qml b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.qml
new file mode 100644
index 0000000..9ec33ab
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ rectProperty.x: 100
+ rectProperty.x: 101
+}
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.errors.txt
new file mode 100644
index 0000000..4a7e383
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.errors.txt
@@ -0,0 +1 @@
+4:-1:Cannot set properties on nullGrouped as it is null
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml
new file mode 100644
index 0000000..b77fb90
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ nullGrouped.script: print(1921)
+}
diff --git a/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt b/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt
new file mode 100644
index 0000000..dfaa218
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt
@@ -0,0 +1 @@
+4:18:Cannot assign to non-existant property "foo"
diff --git a/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.qml b/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.qml
new file mode 100644
index 0000000..9a0fa6a
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ rectProperty.foo: 9
+}
diff --git a/tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.errors.txt b/tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.errors.txt
new file mode 100644
index 0000000..db7d9c0
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.errors.txt
@@ -0,0 +1 @@
+4:18:Unexpected object assignment
diff --git a/tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.qml b/tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.qml
new file mode 100644
index 0000000..9924773
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ rectProperty.x: MyTypeObject {}
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.15.errors.txt b/tests/auto/declarative/qmllanguage/data/wrongType.15.errors.txt
new file mode 100644
index 0000000..44768e3
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.15.errors.txt
@@ -0,0 +1 @@
+3:18:Invalid property assignment: url expected
diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.15.qml b/tests/auto/declarative/qmllanguage/data/wrongType.15.qml
new file mode 100644
index 0000000..633a5ba
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/wrongType.15.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyTypeObject {
+ urlProperty: 12
+}
diff --git a/tests/auto/declarative/qmllanguage/testtypes.h b/tests/auto/declarative/qmllanguage/testtypes.h
index e654faa..b251f87 100644
--- a/tests/auto/declarative/qmllanguage/testtypes.h
+++ b/tests/auto/declarative/qmllanguage/testtypes.h
@@ -80,14 +80,19 @@ class MyAttachedObject : public QObject
{
Q_OBJECT
Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int value2 READ value2 WRITE setValue2)
public:
- MyAttachedObject(QObject *parent) : QObject(parent), m_value(0) {}
+ MyAttachedObject(QObject *parent) : QObject(parent), m_value(0), m_value2(0) {}
int value() const { return m_value; }
void setValue(int v) { m_value = v; }
+ int value2() const { return m_value2; }
+ void setValue2(int v) { m_value2 = v; }
+
private:
int m_value;
+ int m_value2;
};
class MyQmlObject : public QObject, public MyInterface, public QmlParserStatus
@@ -201,9 +206,11 @@ class MyTypeObject : public QObject
Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty);
Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty);
Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty);
+ Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty);
Q_PROPERTY(QmlScriptString scriptProperty READ scriptProperty WRITE setScriptProperty);
Q_PROPERTY(MyGroupedObject *grouped READ grouped CONSTANT);
+ Q_PROPERTY(MyGroupedObject *nullGrouped READ nullGrouped CONSTANT);
public:
MyTypeObject()
@@ -413,6 +420,14 @@ public:
vectorPropertyValue = v;
}
+ QUrl urlPropertyValue;
+ QUrl urlProperty() const {
+ return urlPropertyValue;
+ }
+ void setUrlProperty(const QUrl &v) {
+ urlPropertyValue = v;
+ }
+
QmlScriptString scriptPropertyValue;
QmlScriptString scriptProperty() const {
return scriptPropertyValue;
@@ -424,6 +439,8 @@ public:
MyGroupedObject groupedValue;
MyGroupedObject *grouped() { return &groupedValue; }
+ MyGroupedObject *nullGrouped() { return 0; }
+
void doAction() { emit action(); }
signals:
void action();
diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
index c646583..c23bb2d 100644
--- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
+++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
@@ -141,6 +141,7 @@ private:
QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \
QVERIFY(file.open(QIODevice::ReadOnly)); \
QByteArray data = file.readAll(); \
+ file.close(); \
QList<QByteArray> expected = data.split('\n'); \
expected.removeAll(QByteArray("")); \
QList<QmlError> errors = component.errors(); \
@@ -154,7 +155,16 @@ private:
} \
if (qgetenv("DEBUG") != "" && expected != actual) \
qWarning() << "Expected:" << expected << "Actual:" << actual; \
- QCOMPARE(expected, actual); \
+ if (qgetenv("QMLLANGUAGE_UPDATEERRORS") != "" && expected != actual) {\
+ QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \
+ QVERIFY(file.open(QIODevice::WriteOnly)); \
+ for (int ii = 0; ii < actual.count(); ++ii) { \
+ file.write(actual.at(ii)); file.write("\n"); \
+ } \
+ file.close(); \
+ } else { \
+ QCOMPARE(expected, actual); \
+ } \
}
inline QUrl TEST_FILE(const QString &filename)
@@ -214,6 +224,7 @@ void tst_qmllanguage::errors_data()
QTest::newRow("wrongType (color for size)") << "wrongType.12.qml" << "wrongType.12.errors.txt" << false;
QTest::newRow("wrongType (number string for int)") << "wrongType.13.qml" << "wrongType.13.errors.txt" << false;
QTest::newRow("wrongType (int for string)") << "wrongType.14.qml" << "wrongType.14.errors.txt" << false;
+ QTest::newRow("wrongType (int for url)") << "wrongType.15.qml" << "wrongType.15.errors.txt" << false;
QTest::newRow("readOnly.1") << "readOnly.1.qml" << "readOnly.1.errors.txt" << false;
QTest::newRow("readOnly.2") << "readOnly.2.qml" << "readOnly.2.errors.txt" << false;
@@ -240,8 +251,14 @@ void tst_qmllanguage::errors_data()
QTest::newRow("missingSignal") << "missingSignal.qml" << "missingSignal.errors.txt" << false;
QTest::newRow("finalOverride") << "finalOverride.qml" << "finalOverride.errors.txt" << false;
QTest::newRow("customParserIdNotAllowed") << "customParserIdNotAllowed.qml" << "customParserIdNotAllowed.errors.txt" << false;
+
QTest::newRow("invalidGroupedProperty.1") << "invalidGroupedProperty.1.qml" << "invalidGroupedProperty.1.errors.txt" << false;
QTest::newRow("invalidGroupedProperty.2") << "invalidGroupedProperty.2.qml" << "invalidGroupedProperty.2.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.3") << "invalidGroupedProperty.3.qml" << "invalidGroupedProperty.3.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.4") << "invalidGroupedProperty.4.qml" << "invalidGroupedProperty.4.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.5") << "invalidGroupedProperty.5.qml" << "invalidGroupedProperty.5.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.6") << "invalidGroupedProperty.6.qml" << "invalidGroupedProperty.6.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.7") << "invalidGroupedProperty.7.qml" << "invalidGroupedProperty.7.errors.txt" << true;
QTest::newRow("importNamespaceConflict") << "importNamespaceConflict.qml" << "importNamespaceConflict.errors.txt" << false;
QTest::newRow("importVersionMissing (builtin)") << "importVersionMissingBuiltIn.qml" << "importVersionMissingBuiltIn.errors.txt" << false;
@@ -278,13 +295,28 @@ void tst_qmllanguage::errors_data()
QTest::newRow("Component.5") << "component.5.qml" << "component.5.errors.txt" << false;
QTest::newRow("Component.6") << "component.6.qml" << "component.6.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.1") << "invalidAttachedProperty.1.qml" << "invalidAttachedProperty.1.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.2") << "invalidAttachedProperty.2.qml" << "invalidAttachedProperty.2.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.3") << "invalidAttachedProperty.3.qml" << "invalidAttachedProperty.3.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.4") << "invalidAttachedProperty.4.qml" << "invalidAttachedProperty.4.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.5") << "invalidAttachedProperty.5.qml" << "invalidAttachedProperty.5.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.6") << "invalidAttachedProperty.6.qml" << "invalidAttachedProperty.6.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.7") << "invalidAttachedProperty.7.qml" << "invalidAttachedProperty.7.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.8") << "invalidAttachedProperty.8.qml" << "invalidAttachedProperty.8.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.9") << "invalidAttachedProperty.9.qml" << "invalidAttachedProperty.9.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.10") << "invalidAttachedProperty.10.qml" << "invalidAttachedProperty.10.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.11") << "invalidAttachedProperty.11.qml" << "invalidAttachedProperty.11.errors.txt" << false;
+
QTest::newRow("nestedErrors") << "nestedErrors.qml" << "nestedErrors.errors.txt" << false;
QTest::newRow("defaultGrouped") << "defaultGrouped.qml" << "defaultGrouped.errors.txt" << false;
QTest::newRow("emptySignal") << "emptySignal.qml" << "emptySignal.errors.txt" << false;
QTest::newRow("doubleSignal") << "doubleSignal.qml" << "doubleSignal.errors.txt" << false;
QTest::newRow("invalidRoot") << "invalidRoot.qml" << "invalidRoot.errors.txt" << false;
+ QTest::newRow("missingValueTypeProperty") << "missingValueTypeProperty.qml" << "missingValueTypeProperty.errors.txt" << false;
+ QTest::newRow("objectValueTypeProperty") << "objectValueTypeProperty.qml" << "objectValueTypeProperty.errors.txt" << false;
}
+
void tst_qmllanguage::errors()
{
QFETCH(QString, file);
@@ -420,6 +452,7 @@ void tst_qmllanguage::assignBasicTypes()
QCOMPARE(object->boolProperty(), true);
QCOMPARE(object->variantProperty(), QVariant("Hello World!"));
QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2));
+ QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml")));
QVERIFY(object->objectProperty() != 0);
MyTypeObject *child = qobject_cast<MyTypeObject *>(object->objectProperty());
QVERIFY(child != 0);
@@ -611,6 +644,7 @@ void tst_qmllanguage::attachedProperties()
QObject *attached = qmlAttachedPropertiesObject<MyQmlObject>(object);
QVERIFY(attached != 0);
QCOMPARE(attached->property("value"), QVariant(10));
+ QCOMPARE(attached->property("value2"), QVariant(13));
}
// Tests non-static object properties
diff --git a/tests/auto/declarative/qmltimer/tst_qmltimer.cpp b/tests/auto/declarative/qmltimer/tst_qmltimer.cpp
index 9c5dc30..cf54647 100644
--- a/tests/auto/declarative/qmltimer/tst_qmltimer.cpp
+++ b/tests/auto/declarative/qmltimer/tst_qmltimer.cpp
@@ -91,6 +91,9 @@ void tst_qmltimer::notRepeating()
QmlComponent component(&engine, QByteArray("import Qt 4.6\nTimer { interval: 100; running: true }"), QUrl("file://"));
QmlTimer *timer = qobject_cast<QmlTimer*>(component.create());
QVERIFY(timer != 0);
+ QVERIFY(timer->isRunning());
+ QVERIFY(!timer->isRepeating());
+ QCOMPARE(timer->interval(), 100);
TimerHelper helper;
connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
@@ -107,6 +110,7 @@ void tst_qmltimer::notRepeatingStart()
QmlComponent component(&engine, QByteArray("import Qt 4.6\nTimer { interval: 100 }"), QUrl("file://"));
QmlTimer *timer = qobject_cast<QmlTimer*>(component.create());
QVERIFY(timer != 0);
+ QVERIFY(!timer->isRunning());
TimerHelper helper;
connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
@@ -138,6 +142,11 @@ void tst_qmltimer::repeat()
QTest::qWait(TIMEOUT_TIMEOUT);
QVERIFY(helper.count > oldCount);
+
+ oldCount = helper.count;
+ timer->stop();
+ QTest::qWait(TIMEOUT_TIMEOUT);
+ QVERIFY(helper.count == oldCount);
}
void tst_qmltimer::triggeredOnStart()
@@ -146,6 +155,7 @@ void tst_qmltimer::triggeredOnStart()
QmlComponent component(&engine, QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl("file://"));
QmlTimer *timer = qobject_cast<QmlTimer*>(component.create());
QVERIFY(timer != 0);
+ QVERIFY(timer->triggeredOnStart());
TimerHelper helper;
connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
diff --git a/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml
index 90ef1e5..efbb1b4 100644
--- a/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml
+++ b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml
@@ -28,7 +28,7 @@ Rectangle {
transitions: [
Transition {
NumberAnimation {
- properties: "x"
+ matchProperties: "x"
}
}
]
diff --git a/tests/auto/declarative/visual/easing/easing.qml b/tests/auto/declarative/visual/easing/easing.qml
index f81400b..1e8e907 100644
--- a/tests/auto/declarative/visual/easing/easing.qml
+++ b/tests/auto/declarative/visual/easing/easing.qml
@@ -176,7 +176,7 @@ Rectangle {
to: "to"
reversible: true
NumberAnimation {
- properties: "x"
+ matchProperties: "x"
easing: type
duration: 1000
}