diff options
Diffstat (limited to 'tests/auto/controls')
-rw-r--r-- | tests/auto/controls/data/tst_dialog.qml | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_dialog.qml b/tests/auto/controls/data/tst_dialog.qml index 3c42ccf4..69c47fed 100644 --- a/tests/auto/controls/data/tst_dialog.qml +++ b/tests/auto/controls/data/tst_dialog.qml @@ -255,4 +255,48 @@ 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 = dialog.createObject(testCase, {spacing: 20, width: 100, height: 100}) + verify(control) + + control.open() + waitForRendering(control.contentItem) + verify(control.visible) + + control.contentItem.visible = data.content + control.header = buttonBox.createObject(control.contentItem, {visible: data.header}) + control.footer = buttonBox.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() + } } |