aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-10-24 16:03:39 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-10-26 11:35:57 +0000
commite09a8591990e5281929ca2a7bb180bb3a35556ba (patch)
tree1b0a88ff0a827266e62f312520553e42c12d288f /tests/auto
parent41ec11a8157b9f1cbbc75ab8f68a2e08d24280d9 (diff)
Popup: add spacing support for Dialogv5.8.0-beta1
This helps to get the dialog layout right (a separate follow-up commit), because we don't need to mess with the paddings of the header, content, and footer, based on their existence and visibility, but we can also adjust the spacing which gets automatically added between the building blocks when they exist and are visible. Change-Id: Ie8b587eeb9d0fb4a8f42baf957879d40bbd3385c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/controls/data/tst_dialog.qml44
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()
+ }
}