aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklayouts
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2020-04-16 10:53:19 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2020-04-22 11:04:11 +0200
commit7e5a691006c1051be1a163fa6a7d40effb6ef0bb (patch)
tree3d79d0a3633851e7c28b64d4d74e50cb1840e482 /tests/auto/quick/qquicklayouts
parente0a03d04f8880d81e0c1fec909e5892ae685af71 (diff)
Test if a layout with "fixed" size still do a rearrange if needed
If a layout doesn't change size, it should in many cases still rearrange its children. Pick-to: 5.15 Change-Id: I72ae893da5c561d282800f80c9ab0bec86c557a3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicklayouts')
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
index f61e2e0f48..590249cf91 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
@@ -1035,6 +1035,63 @@ Item {
}
Component {
+ id: rearrangeFixedSizeLayout_Component
+ RowLayout {
+ id: layout
+ width: 200
+ height: 20
+ spacing: 0
+ RowLayout {
+ id: row
+ spacing: 0
+ Rectangle {
+ id: r0
+ color: 'red'
+ implicitWidth: 20
+ implicitHeight: 20
+ }
+ Rectangle {
+ id: r1
+ color: 'grey'
+ implicitWidth: 80
+ implicitHeight: 20
+ }
+ }
+ ColumnLayout {
+ id: row2
+ spacing: 0
+ Rectangle {
+ id: r2_0
+ color: 'blue'
+ Layout.fillWidth: true
+ implicitWidth: 100
+ implicitHeight: 20
+ }
+ }
+ }
+ }
+ function test_rearrangeFixedSizeLayout()
+ {
+ var layout = createTemporaryObject(rearrangeFixedSizeLayout_Component, testCase)
+ var row = layout.children[0]
+ var r0 = row.children[0]
+ var r1 = row.children[1]
+
+ waitForRendering(layout)
+ compare(itemRect(r0), [0,0,20,20])
+ compare(itemRect(r1), [20,0,80,20])
+
+ // just swap their widths. The layout should keep the same size
+ r0.implicitWidth = 80
+ r1.implicitWidth = 20
+ waitForRendering(layout)
+ // even if the layout did not change size, it should rearrange its children
+ compare(itemRect(row), [0,0, 100, 20])
+ compare(itemRect(r0), [0,0,80,20])
+ compare(itemRect(r1), [80,0,20,20])
+ }
+
+ Component {
id: changeChildrenOfHiddenLayout_Component
RowLayout {
property int childCount: 1