aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-12-04 03:05:33 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-12-04 03:05:33 +0100
commit64c44f392b3912849e5eb81a98eae60d11c6dddb (patch)
tree537fac580423a2c75b330dda81e923f48357301c /tests
parentaf0566ac7663ef5b7feb2291351e820110f71516 (diff)
parentbbd6c9972206eccc4d2872be44db509ef716c351 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_scrollview.qml49
-rw-r--r--tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp5
2 files changed, 54 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_scrollview.qml b/tests/auto/controls/data/tst_scrollview.qml
index 80110b5a..a06072e5 100644
--- a/tests/auto/controls/data/tst_scrollview.qml
+++ b/tests/auto/controls/data/tst_scrollview.qml
@@ -118,6 +118,22 @@ TestCase {
}
Component {
+ id: emptyFlickable
+ ScrollView {
+ Flickable {
+ }
+ }
+ }
+
+ Component {
+ id: labelComponent
+ Label {
+ text: "ABC"
+ font.pixelSize: 512
+ }
+ }
+
+ Component {
id: scrollableListView
ScrollView {
ListView {
@@ -241,6 +257,39 @@ TestCase {
compare(control.contentHeight, listview.contentHeight)
}
+ function test_flickableWithExplicitContentSize() {
+ var control = createTemporaryObject(emptyFlickable, testCase)
+ verify(control)
+
+ var flickable = control.contentItem
+ verify(flickable.hasOwnProperty("contentX"))
+ verify(flickable.hasOwnProperty("contentY"))
+
+ var flickableContentSize = 1000;
+ flickable.contentWidth = flickableContentSize;
+ flickable.contentHeight = flickableContentSize;
+
+ compare(flickable.contentWidth, flickableContentSize)
+ compare(flickable.contentHeight, flickableContentSize)
+ compare(control.implicitWidth, flickableContentSize)
+ compare(control.implicitHeight, flickableContentSize)
+ compare(control.contentWidth, flickableContentSize)
+ compare(control.contentHeight, flickableContentSize)
+
+ // Add a single child to the flickable. This should not
+ // trick ScrollView into taking the implicit size of
+ // the child as content size, since the flickable
+ // already has an explicit content size.
+ labelComponent.createObject(flickable);
+
+ compare(flickable.contentWidth, flickableContentSize)
+ compare(flickable.contentHeight, flickableContentSize)
+ compare(control.implicitWidth, flickableContentSize)
+ compare(control.implicitHeight, flickableContentSize)
+ compare(control.contentWidth, flickableContentSize)
+ compare(control.contentHeight, flickableContentSize)
+ }
+
function test_mouse() {
var control = createTemporaryObject(scrollView, testCase, {width: 200, height: 200, contentHeight: 400})
verify(control)
diff --git a/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp b/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp
index 1f00d8e7..0ecc95c5 100644
--- a/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp
+++ b/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp
@@ -216,6 +216,11 @@ void tst_qquickiconlabel::display()
QCOMPARE(label->implicitHeight(), qMax(icon->implicitHeight(), text->implicitHeight()) + verticalPadding);
break;
}
+
+ if (text)
+ QCOMPARE(label->baselineOffset(), text->y() + text->baselineOffset());
+ else
+ QCOMPARE(label->baselineOffset(), 0);
}
}