diff options
author | David Edmundson <davidedmundson@kde.org> | 2020-04-19 15:14:02 +0100 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2020-08-26 16:11:46 +0100 |
commit | 16613f3741af013f7e380c98df6889d73512d0ad (patch) | |
tree | 8375963a816dfe50858ffbb5466797d9f7bc78bb /tests | |
parent | 9aa152da3d416c7d5b4e0e970b6eb1a301df1028 (diff) |
Follow layoutMirroring in Layout margins
If a layout is laid out left to right using the layoutDirection
property, we want left Margins on the left, and rightMargin still on the
right
However, if a layout is mirrored, not only should the layout direction
change but also the left margin should now be on the right and vice
versa.
Task-number: QTBUG-62989
Pick-to: 5.15
Change-Id: Iaae4bc436fd1eb7f1947869563ac325f3d6b79bb
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml index 0fa84a1617..46d18a4384 100644 --- a/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml +++ b/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml @@ -991,6 +991,47 @@ Item { } Component { + + id: layout_RTL_Component + GridLayout { + LayoutMirroring.enabled: true + columns: 2 + rowSpacing: 0 + columnSpacing: 0 + Rectangle { + color: "red" + Layout.preferredWidth: 20 + Layout.preferredHeight: 20 + Layout.leftMargin: 2 + Layout.rightMargin: 1 + } + Rectangle { + color: "blue" + Layout.preferredWidth: 20 + Layout.preferredHeight: 20 + Layout.leftMargin: 3 + Layout.rightMargin: 4 + } + } + } + + function test_Rtl() + { + var layout = layout_RTL_Component.createObject(container) + + compare(layout.implicitWidth, 3 + 20 + 4 + 2 + 20 + 1 ) + layout.width = layout.implicitWidth + + waitForRendering(layout) + + var c0 = layout.children[0] + var c1 = layout.children[1] + + compare(c1.x, 4) // c1 is first, with the right margin on the left + compare(c0.x, 20 + 3 + 4 + 1) + } + + Component { id: layout_invalidateWhileRearranging_Component GridLayout { |