diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-05-23 11:53:42 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-05-23 09:55:36 +0000 |
commit | f0ceecaf0b51809a076ed0add159c95cada528bf (patch) | |
tree | 482e80cc6dd707ba2858d95d6f8fe00c5dd13d78 /tests | |
parent | bac9cc5b55294655ba08f424f402d21f46c00c15 (diff) |
Improve Control::background automatic resizing
- width follows only if x and width are both not specified
- height follows only if y and height are both not specified
Change-Id: Ib881daa9da339baac53f7f9d4de6e5bdad7723e2
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_control.qml | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_control.qml b/tests/auto/controls/data/tst_control.qml index 3d46ff16..da0a979c 100644 --- a/tests/auto/controls/data/tst_control.qml +++ b/tests/auto/controls/data/tst_control.qml @@ -129,4 +129,50 @@ TestCase { control.destroy() } + + function test_background() { + var control = component.createObject(testCase) + + control.background = component.createObject(control) + + // background has no x or width set, so its width follows control's width + control.width = 320 + compare(control.background.width, control.width) + + // background has no y or height set, so its height follows control's height + compare(control.background.height, control.height) + control.height = 240 + + // has width => width does not follow + control.background.width /= 2 + control.width += 20 + verify(control.background.width !== control.width) + + // reset width => width follows again + control.background.width = undefined + control.width += 20 + compare(control.background.width, control.width) + + // has x => width does not follow + control.background.x = 10 + control.width += 20 + verify(control.background.width !== control.width) + + // has height => height does not follow + control.background.height /= 2 + control.height -= 20 + verify(control.background.height !== control.height) + + // reset height => height follows again + control.background.height = undefined + control.height -= 20 + compare(control.background.height, control.height) + + // has y => height does not follow + control.background.y = 10 + control.height -= 20 + verify(control.background.height !== control.height) + + control.destroy() + } } |