aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_control.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-08-30 17:16:43 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-08-31 07:56:56 +0000
commit87b21a5702be5f91e18ca8af5ac169fa111c31d5 (patch)
tree7ad548247906b8502ab2756b6dc4e9296943df5f /tests/auto/controls/data/tst_control.qml
parent8d093a47f52ffcebc4e61f9918985e62424658c0 (diff)
Make a plain Control calculate suitable implicit size
[ChangeLog][Controls][Control] A plain Control now calculates its implicit size based on the implicit size of the content item plus paddings, and the implicit size of the background item. Change-Id: I086ecf8e3f564ee49df2f9d30015e127dc88db6e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_control.qml')
-rw-r--r--tests/auto/controls/data/tst_control.qml29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_control.qml b/tests/auto/controls/data/tst_control.qml
index 89266d16..601b7f8f 100644
--- a/tests/auto/controls/data/tst_control.qml
+++ b/tests/auto/controls/data/tst_control.qml
@@ -53,7 +53,12 @@ TestCase {
Component {
id: component
- T.Control { }
+ Control { }
+ }
+
+ Component {
+ id: rectangle
+ Rectangle { }
}
Component {
@@ -877,4 +882,26 @@ TestCase {
control.destroy()
}
+
+ function test_implicitSize() {
+ var control = component.createObject(testCase)
+ verify(control)
+
+ compare(control.implicitWidth, 0)
+ compare(control.implicitHeight, 0)
+
+ control.contentItem = rectangle.createObject(control, {implicitWidth: 10, implicitHeight: 20})
+ compare(control.implicitWidth, 10)
+ compare(control.implicitHeight, 20)
+
+ control.background = rectangle.createObject(control, {implicitWidth: 20, implicitHeight: 30})
+ compare(control.implicitWidth, 20)
+ compare(control.implicitHeight, 30)
+
+ control.padding = 100
+ compare(control.implicitWidth, 210)
+ compare(control.implicitHeight, 220)
+
+ control.destroy()
+ }
}