summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2013-10-01 11:23:47 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-01 12:06:28 +0200
commit66fb8dd12189232a41164f0f6681699900ef2f3a (patch)
tree3bf425a3d9ae1413c2506f811d15a5574acb71d6 /tests
parentdf4fbe3bf0383903288883f6ea9df6566946f406 (diff)
downloadqtquickcontrols-66fb8dd12189232a41164f0f6681699900ef2f3a.tar.gz
qtquickcontrols-66fb8dd12189232a41164f0f6681699900ef2f3a.tar.bz2
qtquickcontrols-66fb8dd12189232a41164f0f6681699900ef2f3a.zip
Don't apply baseline calculations if Qt.AlignBaseline is not set
Parts of the code assumed that if q_minimumDescent or q_minimumAscent was valid, it would reserve enough space in each case for the combined ascents and descents of all items in a row. The extreme case was when one item had a baseline at its bottom edge, and the next item had the baseline at its top edge, the layouts minimum height tried to reserve space for such a case even though baseline alignment was not desired. The last case in the test demonstrates such a (valid) case. The problem was that the same logic was applied to the first case. Change-Id: Ie24503b1a5f7333f16ed84ebe01ab8d48becb4e2 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_gridlayout.qml40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_gridlayout.qml b/tests/auto/controls/data/tst_gridlayout.qml
index 3bd41cce..7c31b6b6 100644
--- a/tests/auto/controls/data/tst_gridlayout.qml
+++ b/tests/auto/controls/data/tst_gridlayout.qml
@@ -710,5 +710,45 @@ Item {
compare(itemRect(layout.children[1]), [ 0, 0, 10, 10])
compare(itemRect(layout.children[2]), [20, 0, 10, 10])
}
+
+ Component {
+ id: layout_baselines_Component
+ GridLayout {
+ id: layout
+ columnSpacing: 0
+ Rectangle {
+ implicitWidth: 10
+ implicitHeight: 10
+ baselineOffset: 10
+ }
+ Rectangle {
+ implicitWidth: 10
+ implicitHeight: 10
+ }
+ }
+ }
+ function test_baselines()
+ {
+ var layout = layout_baselines_Component.createObject(container);
+ waitForRendering(layout)
+ compare(itemRect(layout.children[0]), [ 0, 0, 10, 10])
+ compare(itemRect(layout.children[1]), [10, 0, 10, 10])
+ compare(layout.implicitWidth, 20)
+ compare(layout.implicitHeight, 10)
+
+
+ layout.children[0].Layout.alignment = Qt.AlignBaseline
+ layout.children[1].Layout.alignment = Qt.AlignBaseline
+
+ // Workaround, force full invalidation (QTBUG-33773)
+ layout.children[1].visible = false; layout.children[1].visible = true;
+
+ compare(itemRect(layout.children[0]), [ 0, 0, 10, 10])
+ compare(itemRect(layout.children[1]), [10, 10, 10, 10])
+ compare(layout.implicitWidth, 20)
+ compare(layout.implicitHeight, 20)
+
+ layout.destroy();
+ }
}
}