diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2017-03-20 11:15:46 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-03-24 06:34:20 +0000 |
commit | a7d9818dd414565cdcc4f4c9415f67735d146c68 (patch) | |
tree | c2629d10b60f1fc7b6466d7217156f774397a44f /tests/auto/controls/data/tst_button.qml | |
parent | b0d2e6d13358cc30f044504f83bd584606b6c235 (diff) |
Button: add support for icons
Task-number: QTBUG-49820
Change-Id: I7f2a72a4ef199d31b2b0041fdad42cfeb15f7b54
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_button.qml')
-rw-r--r-- | tests/auto/controls/data/tst_button.qml | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml index c705832a..e3081354 100644 --- a/tests/auto/controls/data/tst_button.qml +++ b/tests/auto/controls/data/tst_button.qml @@ -431,4 +431,21 @@ TestCase { control.highlighted = true verify(control.highlighted) } + + function test_spacing() { + var control = createTemporaryObject(button, testCase, { text: "Some long, long, long text" }) + verify(control) + verify(control.contentItem.implicitWidth + control.leftPadding + control.rightPadding > control.background.implicitWidth) + + // The implicitWidth of the ImplicitRow that all buttons use as their contentItem + // should be equal to the implicitWidth of the Text while no icon is set. + compare(control.contentItem.implicitWidth, control.contentItem.text.implicitWidth) + + // That means that spacing shouldn't affect it. + control.spacing += 100 + compare(control.contentItem.implicitWidth, control.contentItem.text.implicitWidth) + + // The implicitWidth of the Button itself should, therefore, also never include spacing while no icon is set. + compare(control.implicitWidth, control.contentItem.text.implicitWidth + control.leftPadding + control.rightPadding) + } } |