diff options
author | Jan Arve Sæther <jan-arve.saether@qt.io> | 2020-04-16 10:53:19 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-05-18 20:34:36 +0200 |
commit | a3b34aaf625489364c87028a7d3a37cac1faeb7c (patch) | |
tree | 32640331cbd31ca976cd426a7dceea60a5ee5a38 /tests | |
parent | c0d1afa7715b05c590a9103c67a56e1b7cb6accd (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.
Change-Id: I72ae893da5c561d282800f80c9ab0bec86c557a3
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 7e5a691006c1051be1a163fa6a7d40effb6ef0bb)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml | 57 |
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 |