diff options
Diffstat (limited to 'tests/auto/controls/data/tst_dialogbuttonbox.qml')
-rw-r--r-- | tests/auto/controls/data/tst_dialogbuttonbox.qml | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_dialogbuttonbox.qml b/tests/auto/controls/data/tst_dialogbuttonbox.qml index 6faf0db4..ed181c5b 100644 --- a/tests/auto/controls/data/tst_dialogbuttonbox.qml +++ b/tests/auto/controls/data/tst_dialogbuttonbox.qml @@ -196,6 +196,31 @@ TestCase { compare(roleSpy.count, 1) } + function test_buttonLayout_data() { + return [ + { tag: "WinLayout", buttonLayout: DialogButtonBox.WinLayout, button1Role: DialogButtonBox.AcceptRole, button2Role: DialogButtonBox.RejectRole }, + { tag: "MacLayout", buttonLayout: DialogButtonBox.MacLayout, button1Role: DialogButtonBox.RejectRole, button2Role: DialogButtonBox.AcceptRole }, + { tag: "KdeLayout", buttonLayout: DialogButtonBox.KdeLayout, button1Role: DialogButtonBox.AcceptRole, button2Role: DialogButtonBox.RejectRole }, + { tag: "GnomeLayout", buttonLayout: DialogButtonBox.GnomeLayout, button1Role: DialogButtonBox.RejectRole, button2Role: DialogButtonBox.AcceptRole }, + { tag: "AndroidLayout", buttonLayout: DialogButtonBox.AndroidLayout, button1Role: DialogButtonBox.RejectRole, button2Role: DialogButtonBox.AcceptRole } + ] + } + + function test_buttonLayout(data) { + var control = createTemporaryObject(buttonBox, testCase, {buttonLayout: data.buttonLayout, standardButtons: DialogButtonBox.Ok|DialogButtonBox.Cancel}) + verify(control) + + compare(control.count, 2) + + var button1 = control.itemAt(0) + verify(button1) + compare(button1.DialogButtonBox.buttonRole, data.button1Role) + + var button2 = control.itemAt(1) + verify(button2) + compare(button2.DialogButtonBox.buttonRole, data.button2Role) + } + function test_implicitSize_data() { return [ { tag: "Ok", standardButtons: DialogButtonBox.Ok }, @@ -223,4 +248,31 @@ TestCase { verify(implicitContentWidth > control.leftPadding + control.rightPadding) verify(control.implicitWidth >= implicitContentWidth, qsTr("implicit width (%1) is less than content width (%2)").arg(control.implicitWidth).arg(implicitContentWidth)) } + + Component { + id: okCancelBox + DialogButtonBox { + Button { + text: qsTr("OK") + } + Button { + text: qsTr("Cancel") + } + } + } + + function test_buttonSize() { + var control = createTemporaryObject(okCancelBox, testCase) + verify(control) + + var okButton = control.itemAt(0) + verify(okButton) + verify(okButton.width > 0) + + var cancelButton = control.itemAt(1) + verify(cancelButton) + verify(cancelButton.width > 0) + + compare(okButton.width + cancelButton.width, control.availableWidth - control.spacing) + } } |