aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-10-22 20:46:33 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-10-26 09:17:17 +0000
commitfa71ef5a2ccfa4666db9338c4ba8f34d19f2faf1 (patch)
tree69f0e465ea5f5baf38a22631fe8d178fde8a795b /tests/auto
parent791d521a3008695f834d5aa8c9bb61f9075b37a8 (diff)
QQuickDialog: simplify the button box handling
Just fill in the footer with a button box by default from the styles. This makes the next step easier, to provide also a default title bar in the header. Task-number: QTBUG-56711 Change-Id: I621a61f29f9ba2fe4b7e907d81da5988133a98c8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/controls/data/tst_dialog.qml51
1 files changed, 6 insertions, 45 deletions
diff --git a/tests/auto/controls/data/tst_dialog.qml b/tests/auto/controls/data/tst_dialog.qml
index d4cbc222..632bb0c4 100644
--- a/tests/auto/controls/data/tst_dialog.qml
+++ b/tests/auto/controls/data/tst_dialog.qml
@@ -62,16 +62,6 @@ TestCase {
}
Component {
- id: headerBox
- DialogButtonBox { position: DialogButtonBox.Header }
- }
-
- Component {
- id: footerBox
- DialogButtonBox { position: DialogButtonBox.Footer }
- }
-
- Component {
id: signalSpy
SignalSpy { }
}
@@ -80,8 +70,7 @@ TestCase {
var control = dialog.createObject(testCase)
verify(control)
verify(!control.header)
- verify(!control.footer)
- verify(control.buttonBox)
+ verify(control.footer)
compare(control.standardButtons, 0)
control.destroy()
}
@@ -122,22 +111,18 @@ TestCase {
function test_buttonBox_data() {
return [
- { tag: "default header", property: "header", buttonBox: headerBox },
- { tag: "default footer", property: "footer", buttonBox: footerBox },
- { tag: "custom header", property: "header", position: DialogButtonBox.Header },
- { tag: "custom footer", property: "footer", position: DialogButtonBox.Footer }
+ { tag: "default" },
+ { tag: "custom", custom: true }
]
}
function test_buttonBox(data) {
var control = dialog.createObject(testCase)
- if (data.buttonBox)
- control.buttonBox = data.buttonBox
- else
- control[data.property] = buttonBox.createObject(testCase, {position: data.position})
+ if (data.custom)
+ control.footer = buttonBox.createObject(testCase)
control.standardButtons = Dialog.Ok | Dialog.Cancel
- var box = control[data.property]
+ var box = control.footer
verify(box)
compare(box.standardButtons, Dialog.Ok | Dialog.Cancel)
@@ -192,30 +177,6 @@ TestCase {
control.destroy()
}
- function test_warnings() {
- var control = dialog.createObject(testCase)
- verify(control)
-
- var testComponent = Qt.createComponent("TestItem.qml")
- verify(testComponent)
-
- control.buttonBox = headerBox
- control.header = testComponent.createObject(testCase)
- ignoreWarning(Qt.resolvedUrl("tst_dialog.qml") + ":56:9: QML Dialog: Custom header detected. Cannot assign buttonBox as a header. No standard buttons will appear in the header.")
- control.standardButtons = Dialog.Apply
-
- control.buttonBox = footerBox
- control.footer = testComponent.createObject(testCase)
- ignoreWarning(Qt.resolvedUrl("tst_dialog.qml") + ":56:9: QML Dialog: Custom footer detected. Cannot assign buttonBox as a footer. No standard buttons will appear in the footer.")
- control.standardButtons = Dialog.Cancel
-
- control.buttonBox = testComponent
- ignoreWarning(Qt.resolvedUrl("tst_dialog.qml") + ":56:9: QML Dialog: buttonBox must be an instance of DialogButtonBox")
- control.standardButtons = Dialog.Ok
-
- control.destroy()
- }
-
function test_layout() {
var control = dialog.createObject(testCase, {width: 100, height: 100})
verify(control)