diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-10-24 17:38:06 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-10-26 10:13:22 +0000 |
commit | 935daea1cdd9247d04618fcd67eb2a935060d1db (patch) | |
tree | df16bd763fc6f7ae8938d0fd1f70fdb35da3da0d /tests | |
parent | 25d6d137a90ca9e3ce654adcc454c23de4622a49 (diff) |
Page: support spacing
Add spacing support into QQuickPageLayout. Having spacing and padding
separately gives more fine-grained control over the layout. Spacing is
inserted between the header, content, and footer, but only when the
respective building blocks are visible.
Change-Id: Ia26a4c33c2756a603ca6d53aefac3a66414b36d3
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_page.qml | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_page.qml b/tests/auto/controls/data/tst_page.qml index a1cdbf8e..9b52236e 100644 --- a/tests/auto/controls/data/tst_page.qml +++ b/tests/auto/controls/data/tst_page.qml @@ -226,4 +226,44 @@ TestCase { control.destroy() } + + function test_spacing_data() { + return [ + { tag: "content", header: false, content: true, footer: false }, + { tag: "header,content", header: true, content: true, footer: false }, + { tag: "content,footer", header: false, content: true, footer: true }, + { tag: "header,content,footer", header: true, content: true, footer: true }, + { tag: "header,footer", header: true, content: false, footer: true }, + { tag: "header", header: true, content: false, footer: false }, + { tag: "footer", header: false, content: false, footer: true }, + ] + } + + function test_spacing(data) { + var control = page.createObject(testCase, {spacing: 20, width: 100, height: 100}) + verify(control) + + control.contentItem.visible = data.content + control.header = toolBar.createObject(control.contentItem, {visible: data.header}) + control.footer = toolBar.createObject(control.contentItem, {visible: data.footer}) + + compare(control.header.x, 0) + compare(control.header.y, 0) + compare(control.header.width, control.width) + verify(control.header.height > 0) + + compare(control.footer.x, 0) + compare(control.footer.y, control.height - control.footer.height) + compare(control.footer.width, control.width) + verify(control.footer.height > 0) + + compare(control.contentItem.x, control.leftPadding) + compare(control.contentItem.y, control.topPadding + (data.header ? control.header.height + control.spacing : 0)) + compare(control.contentItem.width, control.availableWidth) + compare(control.contentItem.height, control.availableHeight + - (data.header ? control.header.height + control.spacing : 0) + - (data.footer ? control.footer.height + control.spacing : 0)) + + control.destroy() + } } |