aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qtquick2/qquickpositioners
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-02-16 14:43:03 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-24 04:51:31 +0100
commitb855240b782395f94315f43ea3e7e182299fac48 (patch)
treebc594c04449be8cd14cd0ab0bb72dafc2be0ffb2 /tests/auto/qtquick2/qquickpositioners
parent6a42a6e0a9a1abdda0d07a5a20b4ac7e45348684 (diff)
Rename QDeclarative symbols to QQuick and QQml
Symbols beginning with QDeclarative are already exported by the quick1 module. Users can apply the bin/rename-qtdeclarative-symbols.sh script to modify client code using the previous names of the renamed symbols. Task-number: QTBUG-23737 Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/qtquick2/qquickpositioners')
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/allInvisible.qml44
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/attachedproperties-column.qml50
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/attachedproperties-dynamic.qml44
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/attachedproperties-flow.qml50
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/attachedproperties-grid.qml50
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/attachedproperties-row.qml50
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/flow-testimplicitsize.qml19
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/flowtest-toptobottom.qml44
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/flowtest.qml43
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/grid-animated.qml64
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/grid-row-column-spacing.qml43
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/grid-spacing.qml41
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/grid-toptobottom.qml41
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/gridtest.qml42
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/gridzerocolumns.qml40
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/horizontal-animated-disabled.qml40
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/horizontal-animated.qml47
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/horizontal-spacing.qml31
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/horizontal.qml29
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/propertychangestest.qml39
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/rectangleComponent.qml11
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/repeatertest.qml38
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/vertical-animated.qml41
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/vertical-spacing.qml28
-rw-r--r--tests/auto/qtquick2/qquickpositioners/data/vertical.qml27
-rw-r--r--tests/auto/qtquick2/qquickpositioners/qquickpositioners.pro14
-rw-r--r--tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp1472
27 files changed, 0 insertions, 2482 deletions
diff --git a/tests/auto/qtquick2/qquickpositioners/data/allInvisible.qml b/tests/auto/qtquick2/qquickpositioners/data/allInvisible.qml
deleted file mode 100644
index 5894171434..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/allInvisible.qml
+++ /dev/null
@@ -1,44 +0,0 @@
-import QtQuick 2.0
-
-Item{
- width: 400
- height: 400
- Column{
- spacing: 20
- objectName: "column"
- Item{
- width: 0
- height: 20
- visible: false
- }
- Item{
- width: 20
- height: 0
- visible: false
- }
- Item{
- width: 20
- height: 20
- visible: false
- }
- }
- Row{
- spacing: 20
- objectName: "row"
- Item{
- width: 0
- height: 20
- visible: false
- }
- Item{
- width: 20
- height: 0
- visible: false
- }
- Item{
- width: 20
- height: 20
- visible: false
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-column.qml b/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-column.qml
deleted file mode 100644
index 4c667aa205..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-column.qml
+++ /dev/null
@@ -1,50 +0,0 @@
-import QtQuick 2.0
-
-Rectangle {
- width: 100
- height: 200
-
- Column {
-
- Rectangle {
- width: 100
- height: 100
- color: 'red'
- visible: false
- }
-
- Rectangle {
- objectName: "greenRect"
- width: 100
- height: 100
- color: 'green'
- property int posIndex: Positioner.index
- property bool isFirstItem: Positioner.isFirstItem
- property bool isLastItem: Positioner.isLastItem
- }
-
- Rectangle {
- width: 100
- height: 100
- color: 'blue'
- visible: false
- }
-
- Rectangle {
- objectName: "yellowRect"
- width: 100
- height: 100
- color: 'yellow'
-
- property int posIndex: -1
- property bool isFirstItem: false
- property bool isLastItem: false
-
- function onDemandPositioner() {
- posIndex = Positioner.index;
- isFirstItem = Positioner.isFirstItem
- isLastItem = Positioner.isLastItem
- }
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-dynamic.qml b/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-dynamic.qml
deleted file mode 100644
index 894749dc16..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-dynamic.qml
+++ /dev/null
@@ -1,44 +0,0 @@
-import QtQuick 2.0
-
-Rectangle
-{
- width: 300
- height: 100
-
- Row {
- id: pos
- objectName: "pos"
- anchors.fill: parent
-
- Rectangle {
- objectName: "rect0"
- width: 100
- height: 100
- color: 'red'
- property int index: Positioner.index
- property bool firstItem: Positioner.isFirstItem
- property bool lastItem: Positioner.isLastItem
- }
-
- Rectangle {
- objectName: "rect1"
- width: 100
- height: 100
- color: 'green'
- property int index: Positioner.index
- property bool firstItem: Positioner.isFirstItem
- property bool lastItem: Positioner.isLastItem
- }
-
- property QtObject subRect;
-
- function createSubRect() {
- var component = Qt.createComponent("rectangleComponent.qml");
- subRect = component.createObject(pos, {});
- }
-
- function destroySubRect() {
- subRect.destroy();
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-flow.qml b/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-flow.qml
deleted file mode 100644
index e7f9a63e2a..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-flow.qml
+++ /dev/null
@@ -1,50 +0,0 @@
-import QtQuick 2.0
-
-Rectangle {
- width: 200
- height: 100
-
- Flow {
-
- Rectangle {
- width: 100
- height: 100
- color: 'red'
- visible: false
- }
-
- Rectangle {
- objectName: "greenRect"
- width: 100
- height: 100
- color: 'green'
- property int posIndex: Positioner.index
- property bool isFirstItem: Positioner.isFirstItem
- property bool isLastItem: Positioner.isLastItem
- }
-
- Rectangle {
- width: 100
- height: 100
- color: 'blue'
- visible: false
- }
-
- Rectangle {
- objectName: "yellowRect"
- width: 100
- height: 100
- color: 'yellow'
-
- property int posIndex: -1
- property bool isFirstItem: false
- property bool isLastItem: false
-
- function onDemandPositioner() {
- posIndex = Positioner.index;
- isFirstItem = Positioner.isFirstItem
- isLastItem = Positioner.isLastItem
- }
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-grid.qml b/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-grid.qml
deleted file mode 100644
index 2094309b9f..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-grid.qml
+++ /dev/null
@@ -1,50 +0,0 @@
-import QtQuick 2.0
-
-Rectangle {
- width: 200
- height: 100
-
- Grid {
-
- Rectangle {
- width: 100
- height: 100
- color: 'red'
- visible: false
- }
-
- Rectangle {
- objectName: "greenRect"
- width: 100
- height: 100
- color: 'green'
- property int posIndex: Positioner.index
- property bool isFirstItem: Positioner.isFirstItem
- property bool isLastItem: Positioner.isLastItem
- }
-
- Rectangle {
- width: 100
- height: 100
- color: 'blue'
- visible: false
- }
-
- Rectangle {
- objectName: "yellowRect"
- width: 100
- height: 100
- color: 'yellow'
-
- property int posIndex: -1
- property bool isFirstItem: false
- property bool isLastItem: false
-
- function onDemandPositioner() {
- posIndex = Positioner.index;
- isFirstItem = Positioner.isFirstItem
- isLastItem = Positioner.isLastItem
- }
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-row.qml b/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-row.qml
deleted file mode 100644
index 212a26b431..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/attachedproperties-row.qml
+++ /dev/null
@@ -1,50 +0,0 @@
-import QtQuick 2.0
-
-Rectangle {
- width: 200
- height: 100
-
- Row {
-
- Rectangle {
- width: 100
- height: 100
- color: 'red'
- visible: false
- }
-
- Rectangle {
- objectName: "greenRect"
- width: 100
- height: 100
- color: 'green'
- property int posIndex: Positioner.index
- property bool isFirstItem: Positioner.isFirstItem
- property bool isLastItem: Positioner.isLastItem
- }
-
- Rectangle {
- width: 100
- height: 100
- color: 'blue'
- visible: false
- }
-
- Rectangle {
- objectName: "yellowRect"
- width: 100
- height: 100
- color: 'yellow'
-
- property int posIndex: -1
- property bool isFirstItem: false
- property bool isLastItem: false
-
- function onDemandPositioner() {
- posIndex = Positioner.index;
- isFirstItem = Positioner.isFirstItem
- isLastItem = Positioner.isLastItem
- }
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/flow-testimplicitsize.qml b/tests/auto/qtquick2/qquickpositioners/data/flow-testimplicitsize.qml
deleted file mode 100644
index c32b78676c..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/flow-testimplicitsize.qml
+++ /dev/null
@@ -1,19 +0,0 @@
-import QtQuick 2.0
-
-Rectangle {
- width: 300; height: 200;
-
- property int flowLayout: 1
-
- Flow {
- objectName: "flow"
- layoutDirection: (flowLayout == 2) ? Qt.RightToLeft : Qt.LeftToRight
- flow: (flowLayout == 1) ? Flow.TopToBottom : Flow.LeftToRight;
-
- spacing: 20
- anchors.horizontalCenter: parent.horizontalCenter
- Rectangle { color: "red"; width: 100; height: 50 }
- Rectangle { color: "blue"; width: 100; height: 50 }
- }
-}
-
diff --git a/tests/auto/qtquick2/qquickpositioners/data/flowtest-toptobottom.qml b/tests/auto/qtquick2/qquickpositioners/data/flowtest-toptobottom.qml
deleted file mode 100644
index a7d3ee13c7..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/flowtest-toptobottom.qml
+++ /dev/null
@@ -1,44 +0,0 @@
-import QtQuick 2.0
-
-Item {
- height: 90
- width: 480
- property bool testRightToLeft: false
-
- Flow {
- objectName: "flow"
- height: parent.height
- layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
- flow: Flow.TopToBottom
- Rectangle {
- objectName: "one"
- color: "red"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "green"
- width: 20
- height: 50
- }
- Rectangle {
- objectName: "three"
- color: "blue"
- width: 50
- height: 20
- }
- Rectangle {
- objectName: "four"
- color: "cyan"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "five"
- color: "magenta"
- width: 10
- height: 10
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/flowtest.qml b/tests/auto/qtquick2/qquickpositioners/data/flowtest.qml
deleted file mode 100644
index 40b042dd79..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/flowtest.qml
+++ /dev/null
@@ -1,43 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 90
- height: 480
- property bool testRightToLeft: false
-
- Flow {
- objectName: "flow"
- width: parent.width
- layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
- Rectangle {
- objectName: "one"
- color: "red"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "green"
- width: 20
- height: 50
- }
- Rectangle {
- objectName: "three"
- color: "blue"
- width: 50
- height: 20
- }
- Rectangle {
- objectName: "four"
- color: "cyan"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "five"
- color: "magenta"
- width: 10
- height: 10
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/grid-animated.qml b/tests/auto/qtquick2/qquickpositioners/data/grid-animated.qml
deleted file mode 100644
index b8ee8f9a52..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/grid-animated.qml
+++ /dev/null
@@ -1,64 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- property bool testRightToLeft: true
-
- Grid {
- objectName: "grid"
- columns: 3
- layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
- add: Transition {
- NumberAnimation {
- properties: "x,y";
- }
- }
- move: Transition {
- NumberAnimation {
- properties: "x,y";
- }
- }
- Rectangle {
- objectName: "one"
- color: "red"
- x: -100
- y: -100
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- x: -100
- y: -100
- visible: false
- color: "green"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "three"
- color: "blue"
- x: -100
- y: -100
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "four"
- color: "cyan"
- x: -100
- y: -100
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "five"
- color: "magenta"
- x: -100
- y: -100
- width: 50
- height: 50
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/grid-row-column-spacing.qml b/tests/auto/qtquick2/qquickpositioners/data/grid-row-column-spacing.qml
deleted file mode 100644
index 49bbd337e7..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/grid-row-column-spacing.qml
+++ /dev/null
@@ -1,43 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- Grid {
- objectName: "grid"
- columns: 3
- spacing: 4
- rowSpacing: 7
- columnSpacing: 11
- Rectangle {
- objectName: "one"
- color: "red"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "green"
- width: 20
- height: 50
- }
- Rectangle {
- objectName: "three"
- color: "blue"
- width: 50
- height: 20
- }
- Rectangle {
- objectName: "four"
- color: "cyan"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "five"
- color: "magenta"
- width: 10
- height: 10
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/grid-spacing.qml b/tests/auto/qtquick2/qquickpositioners/data/grid-spacing.qml
deleted file mode 100644
index 535a39037f..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/grid-spacing.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- Grid {
- objectName: "grid"
- columns: 3
- spacing: 4
- Rectangle {
- objectName: "one"
- color: "red"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "green"
- width: 20
- height: 50
- }
- Rectangle {
- objectName: "three"
- color: "blue"
- width: 50
- height: 20
- }
- Rectangle {
- objectName: "four"
- color: "cyan"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "five"
- color: "magenta"
- width: 10
- height: 10
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/grid-toptobottom.qml b/tests/auto/qtquick2/qquickpositioners/data/grid-toptobottom.qml
deleted file mode 100644
index 45559aab5d..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/grid-toptobottom.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- Grid {
- objectName: "grid"
- rows: 3
- flow: Grid.TopToBottom
- Rectangle {
- objectName: "one"
- color: "red"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "green"
- width: 20
- height: 50
- }
- Rectangle {
- objectName: "three"
- color: "blue"
- width: 50
- height: 20
- }
- Rectangle {
- objectName: "four"
- color: "cyan"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "five"
- color: "magenta"
- width: 10
- height: 10
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/gridtest.qml b/tests/auto/qtquick2/qquickpositioners/data/gridtest.qml
deleted file mode 100644
index 50bec1377b..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/gridtest.qml
+++ /dev/null
@@ -1,42 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- property bool testRightToLeft: false
- Grid {
- layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
- objectName: "grid"
- columns: 3
- Rectangle {
- objectName: "one"
- color: "red"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "green"
- width: 20
- height: 50
- }
- Rectangle {
- objectName: "three"
- color: "blue"
- width: 30
- height: 20
- }
- Rectangle {
- objectName: "four"
- color: "cyan"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "five"
- color: "magenta"
- width: 10
- height: 10
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/gridzerocolumns.qml b/tests/auto/qtquick2/qquickpositioners/data/gridzerocolumns.qml
deleted file mode 100644
index a252f279c3..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/gridzerocolumns.qml
+++ /dev/null
@@ -1,40 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- Grid {
- objectName: "grid"
- columns: 0
- Rectangle {
- objectName: "one"
- color: "red"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "green"
- width: 20
- height: 50
- }
- Rectangle {
- objectName: "three"
- color: "blue"
- width: 50
- height: 20
- }
- Rectangle {
- objectName: "four"
- color: "cyan"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "five"
- color: "magenta"
- width: 10
- height: 10
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/horizontal-animated-disabled.qml b/tests/auto/qtquick2/qquickpositioners/data/horizontal-animated-disabled.qml
deleted file mode 100644
index 8723ffc78f..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/horizontal-animated-disabled.qml
+++ /dev/null
@@ -1,40 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
-
- Row {
- objectName: "row"
- add: Transition {
- enabled: false
- NumberAnimation { properties: "x" }
- }
- move: Transition {
- enabled: false
- NumberAnimation { properties: "x" }
- }
- Rectangle {
- objectName: "one"
- color: "red"
- x: -100;
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "blue"
- x: -100;
- visible: false
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "three"
- x: -100;
- color: "green"
- width: 50
- height: 50
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/horizontal-animated.qml b/tests/auto/qtquick2/qquickpositioners/data/horizontal-animated.qml
deleted file mode 100644
index a88c26b66c..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/horizontal-animated.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- property bool testRightToLeft: false
- property bool testEnabled: false
-
- Row {
- objectName: "row"
- layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
- add: Transition {
- enabled: testEnabled ? false : true
- NumberAnimation {
- properties: "x";
- }
- }
- move: Transition {
- enabled: testEnabled ? false : true
- NumberAnimation {
- properties: "x";
- }
- }
- Rectangle {
- objectName: "one"
- color: "red"
- x: -100;
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "blue"
- x: -100;
- visible: false
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "three"
- x: -100;
- color: "green"
- width: 50
- height: 50
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/horizontal-spacing.qml b/tests/auto/qtquick2/qquickpositioners/data/horizontal-spacing.qml
deleted file mode 100644
index c6ff75ac6b..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/horizontal-spacing.qml
+++ /dev/null
@@ -1,31 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- property bool testRightToLeft: false
-
- Row {
- objectName: "row"
- spacing: 10
- layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
- Rectangle {
- objectName: "one"
- color: "red"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "red"
- width: 20
- height: 10
- }
- Rectangle {
- objectName: "three"
- color: "red"
- width: 40
- height: 20
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/horizontal.qml b/tests/auto/qtquick2/qquickpositioners/data/horizontal.qml
deleted file mode 100644
index 235ee78c9b..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/horizontal.qml
+++ /dev/null
@@ -1,29 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- property bool testRightToLeft: false
- Row {
- objectName: "row"
- layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
- Rectangle {
- objectName: "one"
- color: "red"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "red"
- width: 20
- height: 10
- }
- Rectangle {
- objectName: "three"
- color: "red"
- width: 40
- height: 20
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/propertychangestest.qml b/tests/auto/qtquick2/qquickpositioners/data/propertychangestest.qml
deleted file mode 100644
index c9fd62b012..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/propertychangestest.qml
+++ /dev/null
@@ -1,39 +0,0 @@
-import QtQuick 2.0
-
-Grid {
- id: myGrid
-
- width: 270
- height: 270
- x: 3
- y: 3
- columns: 4
- spacing: 3
-
- add: columnTransition
- move: columnTransition
-
- Repeater {
- model: 20
- Rectangle { color: "black"; width: 50; height: 50 }
- }
-
- data: [
- Transition {
- id: rowTransition
- objectName: "rowTransition"
- NumberAnimation {
- properties: "x,y";
- easing.type: "OutInCubic"
- }
- },
- Transition {
- id: columnTransition
- objectName: "columnTransition"
- NumberAnimation {
- properties: "x,y";
- easing.type: "OutInCubic"
- }
- }
- ]
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/rectangleComponent.qml b/tests/auto/qtquick2/qquickpositioners/data/rectangleComponent.qml
deleted file mode 100644
index de1bb99593..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/rectangleComponent.qml
+++ /dev/null
@@ -1,11 +0,0 @@
-import QtQuick 2.0;
-
-Rectangle {
- objectName: "rect2"
- color: "blue"
- width: 100
- height: 100
- property int index: Positioner.index
- property bool firstItem: Positioner.isFirstItem
- property bool lastItem: Positioner.isLastItem
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/repeatertest.qml b/tests/auto/qtquick2/qquickpositioners/data/repeatertest.qml
deleted file mode 100644
index d90e1cf160..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/repeatertest.qml
+++ /dev/null
@@ -1,38 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- Row {
- Repeater{ model: 3;
- delegate: Component {
- Rectangle {
- color: "red"
- width: 50
- height: 50
- z: {if(index == 0){2;}else if(index == 1){1;} else{3;}}
- objectName: {if(index == 0){"one";}else if(index == 1){"two";} else{"three";}}
- }
- }
- }
- }
-
- //This crashed once (QTBUG-16959) because the repeater ended up on the end of the list
- //If this grid just instantiates without crashing, then it has not regressed.
- Grid {
- id: grid
- rows: 2
- flow: Grid.TopToBottom
-
- Repeater {
- model: 13
- Rectangle {
- color: "goldenrod"
- width: 100
- height: 100
- radius: 10
- border.width: 1
- }
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/vertical-animated.qml b/tests/auto/qtquick2/qquickpositioners/data/vertical-animated.qml
deleted file mode 100644
index ecf593cd70..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/vertical-animated.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- Column {
- objectName: "column"
- add: Transition {
- NumberAnimation {
- properties: "y";
- }
- }
- move: Transition {
- NumberAnimation {
- properties: "y";
- }
- }
- Rectangle {
- objectName: "one"
- color: "red"
- y: -100
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "blue"
- y: -100
- visible: false
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "three"
- color: "red"
- y: -100
- width: 50
- height: 50
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/vertical-spacing.qml b/tests/auto/qtquick2/qquickpositioners/data/vertical-spacing.qml
deleted file mode 100644
index 7087961651..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/vertical-spacing.qml
+++ /dev/null
@@ -1,28 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- Column {
- objectName: "column"
- spacing: 10
- Rectangle {
- objectName: "one"
- color: "red"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "red"
- width: 20
- height: 10
- }
- Rectangle {
- objectName: "three"
- color: "red"
- width: 40
- height: 20
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/data/vertical.qml b/tests/auto/qtquick2/qquickpositioners/data/vertical.qml
deleted file mode 100644
index 0c3a81f008..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/data/vertical.qml
+++ /dev/null
@@ -1,27 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 640
- height: 480
- Column {
- objectName: "column"
- Rectangle {
- objectName: "one"
- color: "red"
- width: 50
- height: 50
- }
- Rectangle {
- objectName: "two"
- color: "red"
- width: 20
- height: 10
- }
- Rectangle {
- objectName: "three"
- color: "red"
- width: 40
- height: 20
- }
- }
-}
diff --git a/tests/auto/qtquick2/qquickpositioners/qquickpositioners.pro b/tests/auto/qtquick2/qquickpositioners/qquickpositioners.pro
deleted file mode 100644
index ec0056f8e9..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/qquickpositioners.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qquickpositioners
-SOURCES += tst_qquickpositioners.cpp
-
-include (../../shared/util.pri)
-
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-CONFIG += parallel_test
-QT += core-private gui-private v8-private declarative-private quick-private opengl-private testlib
diff --git a/tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp
deleted file mode 100644
index 4c903ab704..0000000000
--- a/tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp
+++ /dev/null
@@ -1,1472 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QtTest/QtTest>
-#include <private/qlistmodelinterface_p.h>
-#include <QtQuick/qquickview.h>
-#include <qdeclarativeengine.h>
-#include <QtQuick/private/qquickrectangle_p.h>
-#include <QtQuick/private/qquickpositioners_p.h>
-#include <QtQuick/private/qdeclarativetransition_p.h>
-#include <private/qquickitem_p.h>
-#include <qdeclarativeexpression.h>
-#include "../../shared/util.h"
-
-class tst_qquickpositioners : public QDeclarativeDataTest
-{
- Q_OBJECT
-public:
- tst_qquickpositioners();
-
-private slots:
- void test_horizontal();
- void test_horizontal_rtl();
- void test_horizontal_spacing();
- void test_horizontal_spacing_rightToLeft();
- void test_horizontal_animated();
- void test_horizontal_animated_rightToLeft();
- void test_horizontal_animated_disabled();
- void test_vertical();
- void test_vertical_spacing();
- void test_vertical_animated();
- void test_grid();
- void test_grid_topToBottom();
- void test_grid_rightToLeft();
- void test_grid_spacing();
- void test_grid_row_column_spacing();
- void test_grid_animated();
- void test_grid_animated_rightToLeft();
- void test_grid_zero_columns();
- void test_propertychanges();
- void test_repeater();
- void test_flow();
- void test_flow_rightToLeft();
- void test_flow_topToBottom();
- void test_flow_resize();
- void test_flow_resize_rightToLeft();
- void test_flow_implicit_resize();
- void test_conflictinganchors();
- void test_mirroring();
- void test_allInvisible();
- void test_attachedproperties();
- void test_attachedproperties_data();
- void test_attachedproperties_dynamic();
-
-private:
- QQuickView *createView(const QString &filename, bool wait=true);
-};
-
-tst_qquickpositioners::tst_qquickpositioners()
-{
-}
-
-void tst_qquickpositioners::test_horizontal()
-{
- QQuickView *canvas = createView(testFile("horizontal.qml"));
-
- canvas->rootObject()->setProperty("testRightToLeft", false);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 50.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 70.0);
- QCOMPARE(three->y(), 0.0);
-
- QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
- QCOMPARE(row->width(), 110.0);
- QCOMPARE(row->height(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_horizontal_rtl()
-{
- QQuickView *canvas = createView(testFile("horizontal.qml"));
-
- canvas->rootObject()->setProperty("testRightToLeft", true);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
-
- QCOMPARE(one->x(), 60.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 40.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 0.0);
- QCOMPARE(three->y(), 0.0);
-
- QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
- QCOMPARE(row->width(), 110.0);
- QCOMPARE(row->height(), 50.0);
-
- // Change the width of the row and check that items stay to the right
- row->setWidth(200);
- QTRY_COMPARE(one->x(), 150.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 130.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 90.0);
- QCOMPARE(three->y(), 0.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_horizontal_spacing()
-{
- QQuickView *canvas = createView(testFile("horizontal-spacing.qml"));
-
- canvas->rootObject()->setProperty("testRightToLeft", false);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 60.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 90.0);
- QCOMPARE(three->y(), 0.0);
-
- QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
- QCOMPARE(row->width(), 130.0);
- QCOMPARE(row->height(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_horizontal_spacing_rightToLeft()
-{
- QQuickView *canvas = createView(testFile("horizontal-spacing.qml"));
-
- canvas->rootObject()->setProperty("testRightToLeft", true);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
-
- QCOMPARE(one->x(), 80.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 50.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 00.0);
- QCOMPARE(three->y(), 0.0);
-
- QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
- QCOMPARE(row->width(), 130.0);
- QCOMPARE(row->height(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_horizontal_animated()
-{
- QQuickView *canvas = createView(testFile("horizontal-animated.qml"), false);
-
- canvas->rootObject()->setProperty("testRightToLeft", false);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
-
- //Note that they animate in
- QCOMPARE(one->x(), -100.0);
- QCOMPARE(two->x(), -100.0);
- QCOMPARE(three->x(), -100.0);
-
- QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn
-
- QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
- QVERIFY(row);
- QCOMPARE(row->width(), 100.0);
- QCOMPARE(row->height(), 50.0);
-
- //QTRY_COMPARE used instead of waiting for the expected time of animation completion
- //Note that this means the duration of the animation is NOT tested
-
- QTRY_COMPARE(one->x(), 0.0);
- QTRY_COMPARE(one->y(), 0.0);
- QTRY_COMPARE(two->isVisible(), false);
- QTRY_COMPARE(two->x(), -100.0);//Not 'in' yet
- QTRY_COMPARE(two->y(), 0.0);
- QTRY_COMPARE(three->x(), 50.0);
- QTRY_COMPARE(three->y(), 0.0);
-
- //Add 'two'
- two->setVisible(true);
- QTRY_COMPARE(two->isVisible(), true);
- QTRY_COMPARE(row->width(), 150.0);
- QTRY_COMPARE(row->height(), 50.0);
-
- QTest::qWait(0);//Let the animation start
- QVERIFY(two->x() >= -100.0 && two->x() < 50.0);
- QVERIFY(three->x() >= 50.0 && three->x() < 100.0);
-
- QTRY_COMPARE(two->x(), 50.0);
- QTRY_COMPARE(three->x(), 100.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_horizontal_animated_rightToLeft()
-{
- QQuickView *canvas = createView(testFile("horizontal-animated.qml"), false);
-
- canvas->rootObject()->setProperty("testRightToLeft", true);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
-
- //Note that they animate in
- QCOMPARE(one->x(), -100.0);
- QCOMPARE(two->x(), -100.0);
- QCOMPARE(three->x(), -100.0);
-
- QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn
-
- QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
- QVERIFY(row);
- QCOMPARE(row->width(), 100.0);
- QCOMPARE(row->height(), 50.0);
-
- //QTRY_COMPARE used instead of waiting for the expected time of animation completion
- //Note that this means the duration of the animation is NOT tested
-
- QTRY_COMPARE(one->x(), 50.0);
- QTRY_COMPARE(one->y(), 0.0);
- QTRY_COMPARE(two->isVisible(), false);
- QTRY_COMPARE(two->x(), -100.0);//Not 'in' yet
- QTRY_COMPARE(two->y(), 0.0);
- QTRY_COMPARE(three->x(), 0.0);
- QTRY_COMPARE(three->y(), 0.0);
-
- //Add 'two'
- two->setVisible(true);
- QTRY_COMPARE(two->isVisible(), true);
-
- // New size should propagate after visible change
- QTRY_COMPARE(row->width(), 150.0);
- QTRY_COMPARE(row->height(), 50.0);
-
- QTest::qWait(0);//Let the animation start
- QVERIFY(one->x() >= 50.0 && one->x() < 100);
- QVERIFY(two->x() >= -100.0 && two->x() < 50.0);
-
- QTRY_COMPARE(one->x(), 100.0);
- QTRY_COMPARE(two->x(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_horizontal_animated_disabled()
-{
- QQuickView *canvas = createView(testFile("horizontal-animated-disabled.qml"));
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
-
- QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
- QVERIFY(row);
-
- qApp->processEvents();
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->isVisible(), false);
- QCOMPARE(two->x(), -100.0);//Not 'in' yet
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 50.0);
- QCOMPARE(three->y(), 0.0);
-
- //Add 'two'
- two->setVisible(true);
- QCOMPARE(two->isVisible(), true);
- QTRY_COMPARE(row->width(), 150.0);
- QTRY_COMPARE(row->height(), 50.0);
-
- QTRY_COMPARE(two->x(), 50.0);
- QTRY_COMPARE(three->x(), 100.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_vertical()
-{
- QQuickView *canvas = createView(testFile("vertical.qml"));
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 0.0);
- QCOMPARE(two->y(), 50.0);
- QCOMPARE(three->x(), 0.0);
- QCOMPARE(three->y(), 60.0);
-
- QQuickItem *column = canvas->rootObject()->findChild<QQuickItem*>("column");
- QVERIFY(column);
- QCOMPARE(column->height(), 80.0);
- QCOMPARE(column->width(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_vertical_spacing()
-{
- QQuickView *canvas = createView(testFile("vertical-spacing.qml"));
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 0.0);
- QCOMPARE(two->y(), 60.0);
- QCOMPARE(three->x(), 0.0);
- QCOMPARE(three->y(), 80.0);
-
- QQuickItem *column = canvas->rootObject()->findChild<QQuickItem*>("column");
- QCOMPARE(column->height(), 100.0);
- QCOMPARE(column->width(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_vertical_animated()
-{
- QQuickView *canvas = createView(testFile("vertical-animated.qml"), false);
-
- //Note that they animate in
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QCOMPARE(one->y(), -100.0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QCOMPARE(two->y(), -100.0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QCOMPARE(three->y(), -100.0);
-
- QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn
-
- QQuickItem *column = canvas->rootObject()->findChild<QQuickItem*>("column");
- QVERIFY(column);
- QCOMPARE(column->height(), 100.0);
- QCOMPARE(column->width(), 50.0);
-
- //QTRY_COMPARE used instead of waiting for the expected time of animation completion
- //Note that this means the duration of the animation is NOT tested
-
- QTRY_COMPARE(one->y(), 0.0);
- QTRY_COMPARE(one->x(), 0.0);
- QTRY_COMPARE(two->isVisible(), false);
- QTRY_COMPARE(two->y(), -100.0);//Not 'in' yet
- QTRY_COMPARE(two->x(), 0.0);
- QTRY_COMPARE(three->y(), 50.0);
- QTRY_COMPARE(three->x(), 0.0);
-
- //Add 'two'
- two->setVisible(true);
- QTRY_COMPARE(two->isVisible(), true);
- QTRY_COMPARE(column->height(), 150.0);
- QTRY_COMPARE(column->width(), 50.0);
- QTest::qWait(0);//Let the animation start
- QVERIFY(two->y() >= -100.0 && two->y() < 50.0);
- QVERIFY(three->y() >= 50.0 && three->y() < 100.0);
-
- QTRY_COMPARE(two->y(), 50.0);
- QTRY_COMPARE(three->y(), 100.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_grid()
-{
- QQuickView *canvas = createView(testFile("gridtest.qml"));
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 50.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 70.0);
- QCOMPARE(three->y(), 0.0);
- QCOMPARE(four->x(), 0.0);
- QCOMPARE(four->y(), 50.0);
- QCOMPARE(five->x(), 50.0);
- QCOMPARE(five->y(), 50.0);
-
- QQuickGrid *grid = canvas->rootObject()->findChild<QQuickGrid*>("grid");
- QCOMPARE(grid->flow(), QQuickGrid::LeftToRight);
- QCOMPARE(grid->width(), 100.0);
- QCOMPARE(grid->height(), 100.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_grid_topToBottom()
-{
- QQuickView *canvas = createView(testFile("grid-toptobottom.qml"));
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 0.0);
- QCOMPARE(two->y(), 50.0);
- QCOMPARE(three->x(), 0.0);
- QCOMPARE(three->y(), 100.0);
- QCOMPARE(four->x(), 50.0);
- QCOMPARE(four->y(), 0.0);
- QCOMPARE(five->x(), 50.0);
- QCOMPARE(five->y(), 50.0);
-
- QQuickGrid *grid = canvas->rootObject()->findChild<QQuickGrid*>("grid");
- QCOMPARE(grid->flow(), QQuickGrid::TopToBottom);
- QCOMPARE(grid->width(), 100.0);
- QCOMPARE(grid->height(), 120.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_grid_rightToLeft()
-{
- QQuickView *canvas = createView(testFile("gridtest.qml"));
-
- canvas->rootObject()->setProperty("testRightToLeft", true);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
-
- QCOMPARE(one->x(), 50.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 30.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 0.0);
- QCOMPARE(three->y(), 0.0);
- QCOMPARE(four->x(), 50.0);
- QCOMPARE(four->y(), 50.0);
- QCOMPARE(five->x(), 40.0);
- QCOMPARE(five->y(), 50.0);
-
- QQuickGrid *grid = canvas->rootObject()->findChild<QQuickGrid*>("grid");
- QCOMPARE(grid->layoutDirection(), Qt::RightToLeft);
- QCOMPARE(grid->width(), 100.0);
- QCOMPARE(grid->height(), 100.0);
-
- // Change the width of the grid and check that items stay to the right
- grid->setWidth(200);
- QTRY_COMPARE(one->x(), 150.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 130.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 100.0);
- QCOMPARE(three->y(), 0.0);
- QCOMPARE(four->x(), 150.0);
- QCOMPARE(four->y(), 50.0);
- QCOMPARE(five->x(), 140.0);
- QCOMPARE(five->y(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_grid_spacing()
-{
- QQuickView *canvas = createView(testFile("grid-spacing.qml"));
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 54.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 78.0);
- QCOMPARE(three->y(), 0.0);
- QCOMPARE(four->x(), 0.0);
- QCOMPARE(four->y(), 54.0);
- QCOMPARE(five->x(), 54.0);
- QCOMPARE(five->y(), 54.0);
-
- QQuickItem *grid = canvas->rootObject()->findChild<QQuickItem*>("grid");
- QCOMPARE(grid->width(), 128.0);
- QCOMPARE(grid->height(), 104.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_grid_row_column_spacing()
-{
- QQuickView *canvas = createView(testFile("grid-row-column-spacing.qml"));
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 61.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 92.0);
- QCOMPARE(three->y(), 0.0);
- QCOMPARE(four->x(), 0.0);
- QCOMPARE(four->y(), 57.0);
- QCOMPARE(five->x(), 61.0);
- QCOMPARE(five->y(), 57.0);
-
- QQuickItem *grid = canvas->rootObject()->findChild<QQuickItem*>("grid");
- QCOMPARE(grid->width(), 142.0);
- QCOMPARE(grid->height(), 107.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_grid_animated()
-{
- QQuickView *canvas = createView(testFile("grid-animated.qml"), false);
-
- canvas->rootObject()->setProperty("testRightToLeft", false);
-
- //Note that all animate in
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QCOMPARE(one->x(), -100.0);
- QCOMPARE(one->y(), -100.0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QCOMPARE(two->x(), -100.0);
- QCOMPARE(two->y(), -100.0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QCOMPARE(three->x(), -100.0);
- QCOMPARE(three->y(), -100.0);
-
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QCOMPARE(four->x(), -100.0);
- QCOMPARE(four->y(), -100.0);
-
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
- QCOMPARE(five->x(), -100.0);
- QCOMPARE(five->y(), -100.0);
-
- QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn
-
- QQuickItem *grid = canvas->rootObject()->findChild<QQuickItem*>("grid");
- QVERIFY(grid);
- QCOMPARE(grid->width(), 150.0);
- QCOMPARE(grid->height(), 100.0);
-
- //QTRY_COMPARE used instead of waiting for the expected time of animation completion
- //Note that this means the duration of the animation is NOT tested
-
- QTRY_COMPARE(one->y(), 0.0);
- QTRY_COMPARE(one->x(), 0.0);
- QTRY_COMPARE(two->isVisible(), false);
- QTRY_COMPARE(two->y(), -100.0);
- QTRY_COMPARE(two->x(), -100.0);
- QTRY_COMPARE(three->y(), 0.0);
- QTRY_COMPARE(three->x(), 50.0);
- QTRY_COMPARE(four->y(), 0.0);
- QTRY_COMPARE(four->x(), 100.0);
- QTRY_COMPARE(five->y(), 50.0);
- QTRY_COMPARE(five->x(), 0.0);
-
- //Add 'two'
- two->setVisible(true);
- QCOMPARE(two->isVisible(), true);
- QCOMPARE(grid->width(), 150.0);
- QCOMPARE(grid->height(), 100.0);
- QTest::qWait(0);//Let the animation start
- QCOMPARE(two->x(), -100.0);
- QCOMPARE(two->y(), -100.0);
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(three->x(), 50.0);
- QCOMPARE(three->y(), 0.0);
- QCOMPARE(four->x(), 100.0);
- QCOMPARE(four->y(), 0.0);
- QCOMPARE(five->x(), 0.0);
- QCOMPARE(five->y(), 50.0);
- //Let the animation complete
- QTRY_COMPARE(two->x(), 50.0);
- QTRY_COMPARE(two->y(), 0.0);
- QTRY_COMPARE(one->x(), 0.0);
- QTRY_COMPARE(one->y(), 0.0);
- QTRY_COMPARE(three->x(), 100.0);
- QTRY_COMPARE(three->y(), 0.0);
- QTRY_COMPARE(four->x(), 0.0);
- QTRY_COMPARE(four->y(), 50.0);
- QTRY_COMPARE(five->x(), 50.0);
- QTRY_COMPARE(five->y(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_grid_animated_rightToLeft()
-{
- QQuickView *canvas = createView(testFile("grid-animated.qml"), false);
-
- canvas->rootObject()->setProperty("testRightToLeft", true);
-
- //Note that all animate in
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QCOMPARE(one->x(), -100.0);
- QCOMPARE(one->y(), -100.0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QCOMPARE(two->x(), -100.0);
- QCOMPARE(two->y(), -100.0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QCOMPARE(three->x(), -100.0);
- QCOMPARE(three->y(), -100.0);
-
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QCOMPARE(four->x(), -100.0);
- QCOMPARE(four->y(), -100.0);
-
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
- QCOMPARE(five->x(), -100.0);
- QCOMPARE(five->y(), -100.0);
-
- QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn
-
- QQuickItem *grid = canvas->rootObject()->findChild<QQuickItem*>("grid");
- QVERIFY(grid);
- QCOMPARE(grid->width(), 150.0);
- QCOMPARE(grid->height(), 100.0);
-
- //QTRY_COMPARE used instead of waiting for the expected time of animation completion
- //Note that this means the duration of the animation is NOT tested
-
- QTRY_COMPARE(one->y(), 0.0);
- QTRY_COMPARE(one->x(), 100.0);
- QTRY_COMPARE(two->isVisible(), false);
- QTRY_COMPARE(two->y(), -100.0);
- QTRY_COMPARE(two->x(), -100.0);
- QTRY_COMPARE(three->y(), 0.0);
- QTRY_COMPARE(three->x(), 50.0);
- QTRY_COMPARE(four->y(), 0.0);
- QTRY_COMPARE(four->x(), 0.0);
- QTRY_COMPARE(five->y(), 50.0);
- QTRY_COMPARE(five->x(), 100.0);
-
- //Add 'two'
- two->setVisible(true);
- QCOMPARE(two->isVisible(), true);
- QCOMPARE(grid->width(), 150.0);
- QCOMPARE(grid->height(), 100.0);
- QTest::qWait(0);//Let the animation start
- QCOMPARE(two->x(), -100.0);
- QCOMPARE(two->y(), -100.0);
- QCOMPARE(one->x(), 100.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(three->x(), 50.0);
- QCOMPARE(three->y(), 0.0);
- QCOMPARE(four->x(), 0.0);
- QCOMPARE(four->y(), 0.0);
- QCOMPARE(five->x(), 100.0);
- QCOMPARE(five->y(), 50.0);
- //Let the animation complete
- QTRY_COMPARE(two->x(), 50.0);
- QTRY_COMPARE(two->y(), 0.0);
- QTRY_COMPARE(one->x(), 100.0);
- QTRY_COMPARE(one->y(), 0.0);
- QTRY_COMPARE(three->x(), 0.0);
- QTRY_COMPARE(three->y(), 0.0);
- QTRY_COMPARE(four->x(), 100.0);
- QTRY_COMPARE(four->y(), 50.0);
- QTRY_COMPARE(five->x(), 50.0);
- QTRY_COMPARE(five->y(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_grid_zero_columns()
-{
- QQuickView *canvas = createView(testFile("gridzerocolumns.qml"));
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 50.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 70.0);
- QCOMPARE(three->y(), 0.0);
- QCOMPARE(four->x(), 120.0);
- QCOMPARE(four->y(), 0.0);
- QCOMPARE(five->x(), 0.0);
- QCOMPARE(five->y(), 50.0);
-
- QQuickItem *grid = canvas->rootObject()->findChild<QQuickItem*>("grid");
- QCOMPARE(grid->width(), 170.0);
- QCOMPARE(grid->height(), 60.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_propertychanges()
-{
- QQuickView *canvas = createView(testFile("propertychangestest.qml"));
-
- QQuickGrid *grid = qobject_cast<QQuickGrid*>(canvas->rootObject());
- QVERIFY(grid != 0);
- QDeclarativeTransition *rowTransition = canvas->rootObject()->findChild<QDeclarativeTransition*>("rowTransition");
- QDeclarativeTransition *columnTransition = canvas->rootObject()->findChild<QDeclarativeTransition*>("columnTransition");
-
- QSignalSpy addSpy(grid, SIGNAL(addChanged()));
- QSignalSpy moveSpy(grid, SIGNAL(moveChanged()));
- QSignalSpy columnsSpy(grid, SIGNAL(columnsChanged()));
- QSignalSpy rowsSpy(grid, SIGNAL(rowsChanged()));
-
- QVERIFY(grid);
- QVERIFY(rowTransition);
- QVERIFY(columnTransition);
- QCOMPARE(grid->add(), columnTransition);
- QCOMPARE(grid->move(), columnTransition);
- QCOMPARE(grid->columns(), 4);
- QCOMPARE(grid->rows(), -1);
-
- grid->setAdd(rowTransition);
- grid->setMove(rowTransition);
- QCOMPARE(grid->add(), rowTransition);
- QCOMPARE(grid->move(), rowTransition);
- QCOMPARE(addSpy.count(),1);
- QCOMPARE(moveSpy.count(),1);
-
- grid->setAdd(rowTransition);
- grid->setMove(rowTransition);
- QCOMPARE(addSpy.count(),1);
- QCOMPARE(moveSpy.count(),1);
-
- grid->setAdd(0);
- grid->setMove(0);
- QCOMPARE(addSpy.count(),2);
- QCOMPARE(moveSpy.count(),2);
-
- grid->setColumns(-1);
- grid->setRows(3);
- QCOMPARE(grid->columns(), -1);
- QCOMPARE(grid->rows(), 3);
- QCOMPARE(columnsSpy.count(),1);
- QCOMPARE(rowsSpy.count(),1);
-
- grid->setColumns(-1);
- grid->setRows(3);
- QCOMPARE(columnsSpy.count(),1);
- QCOMPARE(rowsSpy.count(),1);
-
- grid->setColumns(2);
- grid->setRows(2);
- QCOMPARE(columnsSpy.count(),2);
- QCOMPARE(rowsSpy.count(),2);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_repeater()
-{
- QQuickView *canvas = createView(testFile("repeatertest.qml"));
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
-
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
-
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 50.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 100.0);
- QCOMPARE(three->y(), 0.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_flow()
-{
- QQuickView *canvas = createView(testFile("flowtest.qml"));
-
- canvas->rootObject()->setProperty("testRightToLeft", false);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 50.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 0.0);
- QCOMPARE(three->y(), 50.0);
- QCOMPARE(four->x(), 0.0);
- QCOMPARE(four->y(), 70.0);
- QCOMPARE(five->x(), 50.0);
- QCOMPARE(five->y(), 70.0);
-
- QQuickItem *flow = canvas->rootObject()->findChild<QQuickItem*>("flow");
- QVERIFY(flow);
- QCOMPARE(flow->width(), 90.0);
- QCOMPARE(flow->height(), 120.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_flow_rightToLeft()
-{
- QQuickView *canvas = createView(testFile("flowtest.qml"));
-
- canvas->rootObject()->setProperty("testRightToLeft", true);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
-
- QCOMPARE(one->x(), 40.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 20.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 40.0);
- QCOMPARE(three->y(), 50.0);
- QCOMPARE(four->x(), 40.0);
- QCOMPARE(four->y(), 70.0);
- QCOMPARE(five->x(), 30.0);
- QCOMPARE(five->y(), 70.0);
-
- QQuickItem *flow = canvas->rootObject()->findChild<QQuickItem*>("flow");
- QVERIFY(flow);
- QCOMPARE(flow->width(), 90.0);
- QCOMPARE(flow->height(), 120.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_flow_topToBottom()
-{
- QQuickView *canvas = createView(testFile("flowtest-toptobottom.qml"));
-
- canvas->rootObject()->setProperty("testRightToLeft", false);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
-
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 50.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 50.0);
- QCOMPARE(three->y(), 50.0);
- QCOMPARE(four->x(), 100.0);
- QCOMPARE(four->y(), 00.0);
- QCOMPARE(five->x(), 100.0);
- QCOMPARE(five->y(), 50.0);
-
- QQuickItem *flow = canvas->rootObject()->findChild<QQuickItem*>("flow");
- QVERIFY(flow);
- QCOMPARE(flow->height(), 90.0);
- QCOMPARE(flow->width(), 150.0);
-
- canvas->rootObject()->setProperty("testRightToLeft", true);
-
- QVERIFY(flow);
- QCOMPARE(flow->height(), 90.0);
- QCOMPARE(flow->width(), 150.0);
-
- QCOMPARE(one->x(), 100.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 80.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 50.0);
- QCOMPARE(three->y(), 50.0);
- QCOMPARE(four->x(), 0.0);
- QCOMPARE(four->y(), 0.0);
- QCOMPARE(five->x(), 40.0);
- QCOMPARE(five->y(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_flow_resize()
-{
- QQuickView *canvas = createView(testFile("flowtest.qml"));
-
- QQuickItem *root = qobject_cast<QQuickItem*>(canvas->rootObject());
- QVERIFY(root);
- root->setWidth(125);
- root->setProperty("testRightToLeft", false);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QVERIFY(one != 0);
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
-
- QTRY_COMPARE(one->x(), 0.0);
- QTRY_COMPARE(one->y(), 0.0);
- QTRY_COMPARE(two->x(), 50.0);
- QTRY_COMPARE(two->y(), 0.0);
- QTRY_COMPARE(three->x(), 70.0);
- QTRY_COMPARE(three->y(), 0.0);
- QTRY_COMPARE(four->x(), 0.0);
- QTRY_COMPARE(four->y(), 50.0);
- QTRY_COMPARE(five->x(), 50.0);
- QTRY_COMPARE(five->y(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_flow_resize_rightToLeft()
-{
- QQuickView *canvas = createView(testFile("flowtest.qml"));
-
- QQuickItem *root = qobject_cast<QQuickItem*>(canvas->rootObject());
- QVERIFY(root);
- root->setWidth(125);
- root->setProperty("testRightToLeft", true);
-
- QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
- QTRY_VERIFY(one != 0);
- QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
- QVERIFY(two != 0);
- QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
- QVERIFY(three != 0);
- QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
- QVERIFY(four != 0);
- QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
- QVERIFY(five != 0);
-
- QCOMPARE(one->x(), 75.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->x(), 55.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 5.0);
- QCOMPARE(three->y(), 0.0);
- QCOMPARE(four->x(), 75.0);
- QCOMPARE(four->y(), 50.0);
- QCOMPARE(five->x(), 65.0);
- QCOMPARE(five->y(), 50.0);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_flow_implicit_resize()
-{
- QQuickView *canvas = createView(testFile("flow-testimplicitsize.qml"));
- QVERIFY(canvas->rootObject() != 0);
-
- QQuickFlow *flow = canvas->rootObject()->findChild<QQuickFlow*>("flow");
- QVERIFY(flow != 0);
-
- QCOMPARE(flow->width(), 100.0);
- QCOMPARE(flow->height(), 120.0);
-
- canvas->rootObject()->setProperty("flowLayout", 0);
- QCOMPARE(flow->flow(), QQuickFlow::LeftToRight);
- QCOMPARE(flow->width(), 220.0);
- QCOMPARE(flow->height(), 50.0);
-
- canvas->rootObject()->setProperty("flowLayout", 1);
- QCOMPARE(flow->flow(), QQuickFlow::TopToBottom);
- QCOMPARE(flow->width(), 100.0);
- QCOMPARE(flow->height(), 120.0);
-
- canvas->rootObject()->setProperty("flowLayout", 2);
- QCOMPARE(flow->layoutDirection(), Qt::RightToLeft);
- QCOMPARE(flow->width(), 220.0);
- QCOMPARE(flow->height(), 50.0);
-
- delete canvas;
-}
-
-QString warningMessage;
-
-void interceptWarnings(QtMsgType type, const char *msg)
-{
- Q_UNUSED( type );
- warningMessage = msg;
-}
-
-void tst_qquickpositioners::test_conflictinganchors()
-{
- QtMsgHandler oldMsgHandler = qInstallMsgHandler(interceptWarnings);
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine);
-
- component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
- QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
- delete item;
-
- component.setData("import QtQuick 2.0\nRow { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
- delete item;
-
- component.setData("import QtQuick 2.0\nGrid { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
- delete item;
-
- component.setData("import QtQuick 2.0\nFlow { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
- delete item;
-
- component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; anchors.top: parent.top } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function."));
- warningMessage.clear();
- delete item;
-
- component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; anchors.centerIn: parent } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function."));
- warningMessage.clear();
- delete item;
-
- component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; anchors.left: parent.left } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
- warningMessage.clear();
- delete item;
-
- component.setData("import QtQuick 2.0\nRow { Item { width: 100; height: 100; anchors.left: parent.left } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function."));
- warningMessage.clear();
- delete item;
-
- component.setData("import QtQuick 2.0\nRow { width: 100; height: 100; Item { anchors.fill: parent } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function."));
- warningMessage.clear();
- delete item;
-
- component.setData("import QtQuick 2.0\nRow { Item { width: 100; height: 100; anchors.top: parent.top } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
- warningMessage.clear();
- delete item;
-
- component.setData("import QtQuick 2.0\nGrid { Item { width: 100; height: 100; anchors.horizontalCenter: parent.horizontalCenter } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function."));
- warningMessage.clear();
- delete item;
-
- component.setData("import QtQuick 2.0\nGrid { Item { width: 100; height: 100; anchors.centerIn: parent } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function."));
- warningMessage.clear();
- delete item;
-
- component.setData("import QtQuick 2.0\nFlow { Item { width: 100; height: 100; anchors.verticalCenter: parent.verticalCenter } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function."));
- delete item;
-
- component.setData("import QtQuick 2.0\nFlow { width: 100; height: 100; Item { anchors.fill: parent } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QQuickItem*>(component.create());
- QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function."));
- qInstallMsgHandler(oldMsgHandler);
- delete item;
-}
-
-void tst_qquickpositioners::test_mirroring()
-{
- QList<QString> qmlFiles;
- qmlFiles << "horizontal.qml" << "gridtest.qml" << "flowtest.qml";
- QList<QString> objectNames;
- objectNames << "one" << "two" << "three" << "four" << "five";
-
- foreach (const QString qmlFile, qmlFiles) {
- QQuickView *canvasA = createView(testFile(qmlFile));
- QQuickItem *rootA = qobject_cast<QQuickItem*>(canvasA->rootObject());
-
- QQuickView *canvasB = createView(testFile(qmlFile));
- QQuickItem *rootB = qobject_cast<QQuickItem*>(canvasB->rootObject());
-
- rootA->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft
-
- // LTR != RTL
- foreach (const QString objectName, objectNames) {
- // horizontal.qml only has three items
- if (qmlFile == QString("horizontal.qml") && objectName == QString("four"))
- break;
- QQuickItem *itemA = rootA->findChild<QQuickItem*>(objectName);
- QQuickItem *itemB = rootB->findChild<QQuickItem*>(objectName);
- QTRY_VERIFY(itemA->x() != itemB->x());
- }
-
- QDeclarativeProperty enabledProp(rootB, "LayoutMirroring.enabled", qmlContext(rootB));
- enabledProp.write(true);
- QDeclarativeProperty inheritProp(rootB, "LayoutMirroring.childrenInherit", qmlContext(rootB));
- inheritProp.write(true);
-
- // RTL == mirror
- foreach (const QString objectName, objectNames) {
- // horizontal.qml only has three items
- if (qmlFile == QString("horizontal.qml") && objectName == QString("four"))
- break;
- QQuickItem *itemA = rootA->findChild<QQuickItem*>(objectName);
- QQuickItem *itemB = rootB->findChild<QQuickItem*>(objectName);
- QTRY_COMPARE(itemA->x(), itemB->x());
- }
-
- rootA->setProperty("testRightToLeft", false); // layoutDirection: Qt.LeftToRight
- rootB->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft
-
- // LTR == RTL + mirror
- foreach (const QString objectName, objectNames) {
- // horizontal.qml only has three items
- if (qmlFile == QString("horizontal.qml") && objectName == QString("four"))
- break;
- QQuickItem *itemA = rootA->findChild<QQuickItem*>(objectName);
- QQuickItem *itemB = rootB->findChild<QQuickItem*>(objectName);
- QTRY_COMPARE(itemA->x(), itemB->x());
- }
- delete canvasA;
- delete canvasB;
- }
-}
-
-void tst_qquickpositioners::test_allInvisible()
-{
- //QTBUG-19361
- QQuickView *canvas = createView(testFile("allInvisible.qml"));
-
- QQuickItem *root = qobject_cast<QQuickItem*>(canvas->rootObject());
- QVERIFY(root);
-
- QQuickRow *row = canvas->rootObject()->findChild<QQuickRow*>("row");
- QVERIFY(row != 0);
- QVERIFY(row->width() == 0);
- QVERIFY(row->height() == 0);
- QQuickColumn *column = canvas->rootObject()->findChild<QQuickColumn*>("column");
- QVERIFY(column != 0);
- QVERIFY(column->width() == 0);
- QVERIFY(column->height() == 0);
-}
-
-void tst_qquickpositioners::test_attachedproperties()
-{
- QFETCH(QString, filename);
-
- QQuickView *canvas = createView(filename);
- QVERIFY(canvas->rootObject() != 0);
-
- QQuickRectangle *greenRect = canvas->rootObject()->findChild<QQuickRectangle *>("greenRect");
- QVERIFY(greenRect != 0);
-
- int posIndex = greenRect->property("posIndex").toInt();
- QVERIFY(posIndex == 0);
- bool isFirst = greenRect->property("isFirstItem").toBool();
- QVERIFY(isFirst == true);
- bool isLast = greenRect->property("isLastItem").toBool();
- QVERIFY(isLast == false);
-
- QQuickRectangle *yellowRect = canvas->rootObject()->findChild<QQuickRectangle *>("yellowRect");
- QVERIFY(yellowRect != 0);
-
- posIndex = yellowRect->property("posIndex").toInt();
- QVERIFY(posIndex == -1);
- isFirst = yellowRect->property("isFirstItem").toBool();
- QVERIFY(isFirst == false);
- isLast = yellowRect->property("isLastItem").toBool();
- QVERIFY(isLast == false);
-
- yellowRect->metaObject()->invokeMethod(yellowRect, "onDemandPositioner");
-
- posIndex = yellowRect->property("posIndex").toInt();
- QVERIFY(posIndex == 1);
- isFirst = yellowRect->property("isFirstItem").toBool();
- QVERIFY(isFirst == false);
- isLast = yellowRect->property("isLastItem").toBool();
- QVERIFY(isLast == true);
-
- delete canvas;
-}
-
-void tst_qquickpositioners::test_attachedproperties_data()
-{
- QTest::addColumn<QString>("filename");
-
- QTest::newRow("column") << testFile("attachedproperties-column.qml");
- QTest::newRow("row") << testFile("attachedproperties-row.qml");
- QTest::newRow("grid") << testFile("attachedproperties-grid.qml");
- QTest::newRow("flow") << testFile("attachedproperties-flow.qml");
-}
-
-void tst_qquickpositioners::test_attachedproperties_dynamic()
-{
- QQuickView *canvas = createView(testFile("attachedproperties-dynamic.qml"));
- QVERIFY(canvas->rootObject() != 0);
-
- QQuickRow *row = canvas->rootObject()->findChild<QQuickRow *>("pos");
- QVERIFY(row != 0);
-
- QQuickRectangle *rect0 = canvas->rootObject()->findChild<QQuickRectangle *>("rect0");
- QVERIFY(rect0 != 0);
-
- int posIndex = rect0->property("index").toInt();
- QVERIFY(posIndex == 0);
- bool isFirst = rect0->property("firstItem").toBool();
- QVERIFY(isFirst == true);
- bool isLast = rect0->property("lastItem").toBool();
- QVERIFY(isLast == false);
-
- QQuickRectangle *rect1 = canvas->rootObject()->findChild<QQuickRectangle *>("rect1");
- QVERIFY(rect1 != 0);
-
- posIndex = rect1->property("index").toInt();
- QVERIFY(posIndex == 1);
- isFirst = rect1->property("firstItem").toBool();
- QVERIFY(isFirst == false);
- isLast = rect1->property("lastItem").toBool();
- QVERIFY(isLast == true);
-
- row->metaObject()->invokeMethod(row, "createSubRect");
-
- QTRY_VERIFY(rect1->property("index").toInt() == 1);
- QTRY_VERIFY(rect1->property("firstItem").toBool() == false);
- QTRY_VERIFY(rect1->property("lastItem").toBool() == false);
-
- QQuickRectangle *rect2 = canvas->rootObject()->findChild<QQuickRectangle *>("rect2");
- QVERIFY(rect2 != 0);
-
- posIndex = rect2->property("index").toInt();
- QVERIFY(posIndex == 2);
- isFirst = rect2->property("firstItem").toBool();
- QVERIFY(isFirst == false);
- isLast = rect2->property("lastItem").toBool();
- QVERIFY(isLast == true);
-
- row->metaObject()->invokeMethod(row, "destroySubRect");
-
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
- QCoreApplication::processEvents();
-
- QTRY_VERIFY(rect1->property("index").toInt() == 1);
- QTRY_VERIFY(rect1->property("firstItem").toBool() == false);
- QTRY_VERIFY(rect1->property("lastItem").toBool() == true);
-
- delete canvas;
-}
-
-QQuickView *tst_qquickpositioners::createView(const QString &filename, bool wait)
-{
- QQuickView *canvas = new QQuickView(0);
-
- canvas->setSource(QUrl::fromLocalFile(filename));
- canvas->show();
- if (wait)
- QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn
-
- return canvas;
-}
-
-
-QTEST_MAIN(tst_qquickpositioners)
-
-#include "tst_qquickpositioners.moc"