diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-04-08 19:58:03 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-04-10 07:14:09 +0000 |
commit | 04f4de502cd420da870b83e062a50833be63bde5 (patch) | |
tree | 432dabd955ab34edc35ab11af5c809565bc669b2 /tests | |
parent | d3c628fbd7b7d7f2a83e3e77d9318bb930b8b3b6 (diff) |
QQuickLabel: fix background resizing
setBackground() must resize the item if component construction is
already complete.
Change-Id: I76cada5b37257473a9c0146ee1f6de8de6c10218
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 159599e97750ad1a9208a66303552aa8b4f2cdc7)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_label.qml | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_label.qml b/tests/auto/controls/data/tst_label.qml index 5618fe07..69d273a7 100644 --- a/tests/auto/controls/data/tst_label.qml +++ b/tests/auto/controls/data/tst_label.qml @@ -66,6 +66,18 @@ TestCase { } Component { + id: backgroundLabel + Label { + background: Rectangle { } + } + } + + Component { + id: rectangle + Rectangle { } + } + + Component { id: signalSpy SignalSpy { } } @@ -115,4 +127,16 @@ TestCase { compare(child.font[data.tag], defaultValue) compare(childSpy.count, 0) } + + function test_background() { + var control = createTemporaryObject(backgroundLabel, testCase, {text: "Label"}) + verify(control) + + compare(control.background.width, control.width) + compare(control.background.height, control.height) + + control.background = rectangle.createObject(control) + compare(control.background.width, control.width) + compare(control.background.height, control.height) + } } |