aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickcontrols/controls/data/tst_pane.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quickcontrols/controls/data/tst_pane.qml')
-rw-r--r--tests/auto/quickcontrols/controls/data/tst_pane.qml141
1 files changed, 85 insertions, 56 deletions
diff --git a/tests/auto/quickcontrols/controls/data/tst_pane.qml b/tests/auto/quickcontrols/controls/data/tst_pane.qml
index f823031c79..ab042edec2 100644
--- a/tests/auto/quickcontrols/controls/data/tst_pane.qml
+++ b/tests/auto/quickcontrols/controls/data/tst_pane.qml
@@ -1,9 +1,10 @@
// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtTest
import QtQuick.Controls
+import QtQuick.Layouts
TestCase {
id: testCase
@@ -18,57 +19,22 @@ TestCase {
Pane { }
}
- Component {
- id: oneChildPane
- Pane {
- Item {
- implicitWidth: 100
- implicitHeight: 30
- }
- }
- }
-
- Component {
- id: twoChildrenPane
- Pane {
- Item {
- implicitWidth: 100
- implicitHeight: 30
- }
- Item {
- implicitWidth: 200
- implicitHeight: 60
- }
- }
+ function init() {
+ failOnWarning(/.?/)
}
- Component {
- id: contentPane
- Pane {
- contentItem: Item {
- implicitWidth: 100
- implicitHeight: 30
- }
- }
- }
+ function test_implicitContentItem() {
+ let control = createTemporaryObject(pane, testCase, {width: 100, height: 100})
+ verify(control)
- Component {
- id: pressPane
- MouseArea {
- width: 200
- height: 200
- property int pressCount
- onPressed: ++pressCount
- Pane {
- anchors.fill: parent
- }
- }
+ compare(control.width, 100)
+ compare(control.height, 100)
+ compare(control.contentItem.width, control.availableWidth)
+ compare(control.contentItem.height, control.availableHeight)
}
function test_empty() {
- failOnWarning(/.?/)
-
- var control = createTemporaryObject(pane, testCase)
+ let control = createTemporaryObject(pane, testCase)
verify(control)
verify(control.contentItem)
@@ -78,8 +44,18 @@ TestCase {
compare(control.implicitContentHeight, 0)
}
+ Component {
+ id: oneChildPane
+ Pane {
+ Item {
+ implicitWidth: 100
+ implicitHeight: 30
+ }
+ }
+ }
+
function test_oneChild() {
- var control = createTemporaryObject(oneChildPane, testCase)
+ let control = createTemporaryObject(oneChildPane, testCase)
verify(control)
compare(control.contentWidth, 100)
@@ -101,8 +77,22 @@ TestCase {
verify(control.implicitHeight > 40)
}
+ Component {
+ id: twoChildrenPane
+ Pane {
+ Item {
+ implicitWidth: 100
+ implicitHeight: 30
+ }
+ Item {
+ implicitWidth: 200
+ implicitHeight: 60
+ }
+ }
+ }
+
function test_twoChildren() {
- var control = createTemporaryObject(twoChildrenPane, testCase)
+ let control = createTemporaryObject(twoChildrenPane, testCase)
verify(control)
compare(control.contentWidth, 0)
@@ -113,8 +103,18 @@ TestCase {
verify(control.implicitHeight > 0)
}
+ Component {
+ id: contentPane
+ Pane {
+ contentItem: Item {
+ implicitWidth: 100
+ implicitHeight: 30
+ }
+ }
+ }
+
function test_contentItem() {
- var control = createTemporaryObject(contentPane, testCase)
+ let control = createTemporaryObject(contentPane, testCase)
verify(control)
compare(control.contentWidth, 100)
@@ -125,18 +125,47 @@ TestCase {
verify(control.implicitHeight > 30)
}
- function test_implicitContentItem() {
- var control = createTemporaryObject(pane, testCase, {width: 100, height: 100})
+ Component {
+ id: contentItemPane
+ Pane {
+ property string description: ""
+ contentItem: ColumnLayout {
+ Label {
+ Layout.maximumWidth: 100
+ text: description
+ elide: Label.ElideRight
+ }
+ }
+ Component.onCompleted: {
+ description = "Binding loop issue ".repeat(100)
+ }
+ }
+ }
+
+ function test_paneBindingLoop() {
+ let control = createTemporaryObject(contentItemPane, testCase)
verify(control)
+ // Wait for content item to be polished
+ waitForPolish(control.contentItem)
- compare(control.width, 100)
- compare(control.height, 100)
- compare(control.contentItem.width, control.availableWidth)
- compare(control.contentItem.height, control.availableHeight)
+ compare(control.contentWidth, 100)
+ }
+
+ Component {
+ id: pressPane
+ MouseArea {
+ width: 200
+ height: 200
+ property int pressCount
+ onPressed: ++pressCount
+ Pane {
+ anchors.fill: parent
+ }
+ }
}
function test_press() {
- var control = createTemporaryObject(pressPane, testCase)
+ let control = createTemporaryObject(pressPane, testCase)
verify(control)
compare(control.pressCount, 0)