aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qsgitem2/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qsgitem2/data')
-rw-r--r--tests/auto/declarative/qsgitem2/data/childrenProperty.qml14
-rw-r--r--tests/auto/declarative/qsgitem2/data/childrenRect.qml27
-rw-r--r--tests/auto/declarative/qsgitem2/data/childrenRectBug.qml23
-rw-r--r--tests/auto/declarative/qsgitem2/data/childrenRectBug2.qml53
-rw-r--r--tests/auto/declarative/qsgitem2/data/childrenRectBug3.qml15
-rw-r--r--tests/auto/declarative/qsgitem2/data/implicitsize.qml19
-rw-r--r--tests/auto/declarative/qsgitem2/data/keynavigationtest.qml87
-rw-r--r--tests/auto/declarative/qsgitem2/data/keynavigationtest_implicit.qml68
-rw-r--r--tests/auto/declarative/qsgitem2/data/keyspriority.qml9
-rw-r--r--tests/auto/declarative/qsgitem2/data/keystest.qml24
-rw-r--r--tests/auto/declarative/qsgitem2/data/layoutmirroring.qml54
-rw-r--r--tests/auto/declarative/qsgitem2/data/mapCoordinates.qml43
-rw-r--r--tests/auto/declarative/qsgitem2/data/mouseFocus.qml20
-rw-r--r--tests/auto/declarative/qsgitem2/data/propertychanges.qml10
-rw-r--r--tests/auto/declarative/qsgitem2/data/qtbug_16871.qml5
-rw-r--r--tests/auto/declarative/qsgitem2/data/resourcesProperty.qml21
-rw-r--r--tests/auto/declarative/qsgitem2/data/transformCrash.qml13
17 files changed, 505 insertions, 0 deletions
diff --git a/tests/auto/declarative/qsgitem2/data/childrenProperty.qml b/tests/auto/declarative/qsgitem2/data/childrenProperty.qml
new file mode 100644
index 0000000000..85ddbc1446
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/childrenProperty.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property bool test1: root.children.length == 3
+ property bool test2: root.children[0] == item1
+ property bool test3: root.children[1] == item2
+ property bool test4: root.children[2] == item3
+ property bool test5: root.children[3] == null
+
+ children: [ Item { id: item1 }, Item { id: item2 }, Item { id: item3 } ]
+}
+
diff --git a/tests/auto/declarative/qsgitem2/data/childrenRect.qml b/tests/auto/declarative/qsgitem2/data/childrenRect.qml
new file mode 100644
index 0000000000..ebc57aefbe
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/childrenRect.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ property int childCount: 0;
+
+ Item {
+ objectName: "testItem"
+ width: childrenRect.width
+ height: childrenRect.height
+
+ Repeater {
+ id: repeater
+ model: childCount
+ delegate: Rectangle {
+ x: index*10
+ y: index*20
+ width: 10
+ height: 20
+
+ color: "red"
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgitem2/data/childrenRectBug.qml b/tests/auto/declarative/qsgitem2/data/childrenRectBug.qml
new file mode 100644
index 0000000000..86a4f19c5c
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/childrenRectBug.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 200
+
+ Item {
+ objectName: "theItem"
+ anchors.centerIn: parent
+ width: childrenRect.width
+ height: childrenRect.height
+ Rectangle {
+ id: text1
+ anchors.verticalCenter: parent.verticalCenter
+ width: 100; height: 100; color: "green"
+ }
+ Rectangle {
+ anchors.left: text1.right
+ anchors.verticalCenter: parent.verticalCenter
+ width: 100; height: 100; color: "green"
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgitem2/data/childrenRectBug2.qml b/tests/auto/declarative/qsgitem2/data/childrenRectBug2.qml
new file mode 100644
index 0000000000..6e80ed28af
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/childrenRectBug2.qml
@@ -0,0 +1,53 @@
+import QtQuick 2.0
+
+Rectangle {
+ width:360;
+ height: 200
+
+ Item {
+ objectName: "theItem"
+ anchors.centerIn: parent
+ width: childrenRect.width
+ height: childrenRect.height
+ Rectangle {
+ id: header1
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ width: 100; height: 50
+ color: "green"
+ }
+ Rectangle {
+ id: text1
+ anchors.top: header1.bottom
+ anchors.topMargin: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: 100; height: 50
+ color: "blue"
+ }
+ }
+
+ states: [
+ State {
+ name: "row"
+ AnchorChanges {
+ target: header1
+ anchors.horizontalCenter: undefined
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.top: undefined
+ }
+ AnchorChanges {
+ target: text1
+ anchors.horizontalCenter: undefined
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.top: undefined
+ anchors.left: header1.right
+ }
+ PropertyChanges {
+ target: text1
+ anchors.leftMargin: 10
+ anchors.topMargin: 0
+ }
+ }
+ ]
+}
diff --git a/tests/auto/declarative/qsgitem2/data/childrenRectBug3.qml b/tests/auto/declarative/qsgitem2/data/childrenRectBug3.qml
new file mode 100644
index 0000000000..518e76509e
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/childrenRectBug3.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 300
+ height: 300
+
+ Rectangle {
+ height: childrenRect.height
+
+ Repeater {
+ model: 1
+ Rectangle { }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgitem2/data/implicitsize.qml b/tests/auto/declarative/qsgitem2/data/implicitsize.qml
new file mode 100644
index 0000000000..cc6aaf7d60
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/implicitsize.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ implicitWidth: 200
+ implicitHeight: 100
+
+ width: 80
+ height: 60
+
+ function resetSize() {
+ width = undefined
+ height = undefined
+ }
+
+ function changeImplicit() {
+ implicitWidth = 150
+ implicitHeight = 80
+ }
+}
diff --git a/tests/auto/declarative/qsgitem2/data/keynavigationtest.qml b/tests/auto/declarative/qsgitem2/data/keynavigationtest.qml
new file mode 100644
index 0000000000..aacb621fb0
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/keynavigationtest.qml
@@ -0,0 +1,87 @@
+import QtQuick 2.0
+
+Grid {
+ columns: 2
+ width: 100; height: 100
+ function verify() {
+ if (item1.KeyNavigation.right != item2)
+ return false;
+ if (item1.KeyNavigation.down != item3)
+ return false;
+ if (item1.KeyNavigation.tab != item2)
+ return false;
+ if (item1.KeyNavigation.backtab != item4)
+ return false;
+
+ if (item2.KeyNavigation.left != item1)
+ return false;
+ if (item2.KeyNavigation.down != item4)
+ return false;
+ if (item2.KeyNavigation.tab != item3)
+ return false;
+ if (item2.KeyNavigation.backtab != item1)
+ return false;
+
+ if (item3.KeyNavigation.right != item4)
+ return false;
+ if (item3.KeyNavigation.up != item1)
+ return false;
+ if (item3.KeyNavigation.tab != item4)
+ return false;
+ if (item3.KeyNavigation.backtab != item2)
+ return false;
+
+ if (item4.KeyNavigation.left != item3)
+ return false;
+ if (item4.KeyNavigation.up != item2)
+ return false;
+ if (item4.KeyNavigation.tab != item1)
+ return false;
+ if (item4.KeyNavigation.backtab != item3)
+ return false;
+
+ return true;
+ }
+
+ Rectangle {
+ id: item1
+ objectName: "item1"
+ focus: true
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.right: item2
+ KeyNavigation.down: item3
+ KeyNavigation.tab: item2
+ KeyNavigation.backtab: item4
+ }
+ Rectangle {
+ id: item2
+ objectName: "item2"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.left: item1
+ KeyNavigation.down: item4
+ KeyNavigation.tab: item3
+ KeyNavigation.backtab: item1
+ }
+ Rectangle {
+ id: item3
+ objectName: "item3"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.right: item4
+ KeyNavigation.up: item1
+ KeyNavigation.tab: item4
+ KeyNavigation.backtab: item2
+ }
+ Rectangle {
+ id: item4
+ objectName: "item4"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.left: item3
+ KeyNavigation.up: item2
+ KeyNavigation.tab: item1
+ KeyNavigation.backtab: item3
+ }
+}
diff --git a/tests/auto/declarative/qsgitem2/data/keynavigationtest_implicit.qml b/tests/auto/declarative/qsgitem2/data/keynavigationtest_implicit.qml
new file mode 100644
index 0000000000..92d4ae23de
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/keynavigationtest_implicit.qml
@@ -0,0 +1,68 @@
+import QtQuick 2.0
+
+Grid {
+ columns: 2
+ width: 100; height: 100
+ function verify() {
+ if (item1.KeyNavigation.tab != item2)
+ return false;
+ if (item1.KeyNavigation.backtab != item4)
+ return false;
+
+ if (item2.KeyNavigation.left != item1)
+ return false;
+ if (item2.KeyNavigation.down != item4)
+ return false;
+ if (item2.KeyNavigation.tab != item3)
+ return false;
+ if (item2.KeyNavigation.backtab != item1)
+ return false;
+
+ if (item3.KeyNavigation.right != item4)
+ return false;
+ if (item3.KeyNavigation.up != item1)
+ return false;
+ if (item3.KeyNavigation.tab != item4)
+ return false;
+ if (item3.KeyNavigation.backtab != item2)
+ return false;
+
+ return true;
+ }
+
+ Rectangle {
+ id: item1
+ objectName: "item1"
+ focus: true
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.tab: item2
+ KeyNavigation.backtab: item4
+ }
+ Rectangle {
+ id: item2
+ objectName: "item2"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.left: item1
+ KeyNavigation.down: item4
+ KeyNavigation.tab: item3
+ KeyNavigation.backtab: item1
+ }
+ Rectangle {
+ id: item3
+ objectName: "item3"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.right: item4
+ KeyNavigation.up: item1
+ KeyNavigation.tab: item4
+ KeyNavigation.backtab: item2
+ }
+ Rectangle {
+ id: item4
+ objectName: "item4"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ }
+}
diff --git a/tests/auto/declarative/qsgitem2/data/keyspriority.qml b/tests/auto/declarative/qsgitem2/data/keyspriority.qml
new file mode 100644
index 0000000000..114cf0488a
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/keyspriority.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Test 1.0
+
+KeyTestItem {
+ 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.priority: keysTestObject.processLast ? Keys.AfterItem : Keys.BeforeItem
+}
diff --git a/tests/auto/declarative/qsgitem2/data/keystest.qml b/tests/auto/declarative/qsgitem2/data/keystest.qml
new file mode 100644
index 0000000000..c70e0061f5
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/keystest.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Item {
+ focus: true
+
+ property bool isEnabled: Keys.enabled
+
+ 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.onDigit0Pressed: keysTestObject.keyPress(event.key, event.text, event.modifiers)
+ Keys.onDigit9Pressed: { event.accepted = false; keysTestObject.keyPress(event.key, event.text, event.modifiers) }
+ Keys.onTabPressed: keysTestObject.keyPress(event.key, "Tab", event.modifiers)
+ Keys.onBacktabPressed: keysTestObject.keyPress(event.key, "Backtab", event.modifiers)
+ Keys.forwardTo: [ item2 ]
+ Keys.enabled: enableKeyHanding
+
+ Item {
+ id: item2
+ visible: forwardeeVisible
+ Keys.onPressed: keysTestObject.forwardedKey(event.key)
+ Keys.onReleased: keysTestObject.forwardedKey(event.key)
+ }
+}
diff --git a/tests/auto/declarative/qsgitem2/data/layoutmirroring.qml b/tests/auto/declarative/qsgitem2/data/layoutmirroring.qml
new file mode 100644
index 0000000000..036819740c
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/layoutmirroring.qml
@@ -0,0 +1,54 @@
+import QtQuick 2.0
+
+Item {
+ property bool childrenInherit: true
+ Item {
+ objectName: "mirrored1"
+ LayoutMirroring.enabled: true
+ LayoutMirroring.childrenInherit: parent.childrenInherit
+ Item {
+ Item {
+ objectName: "notMirrored1"
+ LayoutMirroring.enabled: false
+ Item {
+ objectName: "inheritedMirror1"
+ }
+ }
+ Item {
+ objectName: "inheritedMirror2"
+ }
+ }
+ }
+ Item {
+ objectName: "mirrored2"
+ LayoutMirroring.enabled: true
+ LayoutMirroring.childrenInherit: false
+ Item {
+ objectName: "notMirrored2"
+ }
+ }
+ Item {
+ LayoutMirroring.enabled: true
+ LayoutMirroring.childrenInherit: true
+ Loader {
+ id: loader
+ }
+ }
+ states: State {
+ name: "newContent"
+ PropertyChanges {
+ target: loader
+ sourceComponent: component
+ }
+ }
+ Component {
+ id: component
+ Item {
+ objectName: "notMirrored3"
+ LayoutMirroring.enabled: false
+ Item {
+ objectName: "inheritedMirror3"
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgitem2/data/mapCoordinates.qml b/tests/auto/declarative/qsgitem2/data/mapCoordinates.qml
new file mode 100644
index 0000000000..a5a073c1a0
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/mapCoordinates.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+
+Item {
+ id: root; objectName: "root"
+ width: 200; height: 200
+
+ Item { id: itemA; objectName: "itemA"; x: 50; y: 50 }
+
+ Item {
+ x: 50; y: 50
+ Item { id: itemB; objectName: "itemB"; x: 100; y: 100 }
+ }
+
+ function mapAToB(x, y) {
+ var pos = itemA.mapToItem(itemB, x, y)
+ return Qt.point(pos.x, pos.y)
+ }
+
+ function mapAFromB(x, y) {
+ var pos = itemA.mapFromItem(itemB, x, y)
+ return Qt.point(pos.x, pos.y)
+ }
+
+ function mapAToNull(x, y) {
+ var pos = itemA.mapToItem(null, x, y)
+ return Qt.point(pos.x, pos.y)
+ }
+
+ function mapAFromNull(x, y) {
+ var pos = itemA.mapFromItem(null, x, y)
+ return Qt.point(pos.x, pos.y)
+ }
+
+ function checkMapAToInvalid(x, y) {
+ var pos = itemA.mapToItem(1122, x, y)
+ return pos.x == undefined && pos.y == undefined
+ }
+
+ function checkMapAFromInvalid(x, y) {
+ var pos = itemA.mapFromItem(1122, x, y)
+ return pos.x == undefined && pos.y == undefined
+ }
+}
diff --git a/tests/auto/declarative/qsgitem2/data/mouseFocus.qml b/tests/auto/declarative/qsgitem2/data/mouseFocus.qml
new file mode 100644
index 0000000000..b120cc0263
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/mouseFocus.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+QGraphicsWidget {
+ size: "200x100"
+ focusPolicy: QGraphicsWidget.ClickFocus
+ Item {
+ objectName: "declarativeItem"
+ id: item
+ width: 200
+ height: 100
+ MouseArea {
+ anchors.fill: parent
+ onPressed: {
+ if (!item.focus) {
+ item.focus = true;
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgitem2/data/propertychanges.qml b/tests/auto/declarative/qsgitem2/data/propertychanges.qml
new file mode 100644
index 0000000000..3fa5ea9c23
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/propertychanges.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ Item {
+ objectName: "item"
+ }
+ Item {
+ objectName: "parentItem"
+ }
+}
diff --git a/tests/auto/declarative/qsgitem2/data/qtbug_16871.qml b/tests/auto/declarative/qsgitem2/data/qtbug_16871.qml
new file mode 100644
index 0000000000..f1e7377730
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/qtbug_16871.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ children: [ 10 ]
+}
diff --git a/tests/auto/declarative/qsgitem2/data/resourcesProperty.qml b/tests/auto/declarative/qsgitem2/data/resourcesProperty.qml
new file mode 100644
index 0000000000..b8f18bb375
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/resourcesProperty.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property bool test1
+ property bool test2
+ property bool test3
+ property bool test4
+ property bool test5
+
+ Component.onCompleted: {
+ test1 = (root.resources.length >= 3)
+ test2 = root.resources[0] == item1
+ test3 = root.resources[1] == item2
+ test4 = root.resources[2] == item3
+ test5 = root.resources[10] == null
+ }
+
+ resources: [ Item { id: item1 }, Item { id: item2 }, Item { id: item3 } ]
+}
diff --git a/tests/auto/declarative/qsgitem2/data/transformCrash.qml b/tests/auto/declarative/qsgitem2/data/transformCrash.qml
new file mode 100644
index 0000000000..284e85f0e0
--- /dev/null
+++ b/tests/auto/declarative/qsgitem2/data/transformCrash.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ id: wrapper
+ width: 200
+ height: 200
+
+ QtObject {
+ id: object
+ }
+
+ Component.onCompleted: wrapper.transform = object
+}