diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_scrollview.qml | 49 | ||||
-rw-r--r-- | tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp | 5 |
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); } } |