aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2019-03-26 15:22:31 +0100
committerMitch Curtis <mitch.curtis@qt.io>2019-03-29 08:14:48 +0000
commit1bb25edd6c30e163976afa43065671ffcb56d6f4 (patch)
tree8830f25e766e3534dcb7134209491fc43ae4c1ed
parentef9ab1a4bd4e3545cfb1c23c002e58b3e078ed75 (diff)
tst_dialogbuttonbox.qml: consolidate two similar tests
into one data-driven one. Change-Id: I7507765747dd984530e50df5cd08152b9d71cb66 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--tests/auto/controls/data/tst_dialogbuttonbox.qml35
1 files changed, 11 insertions, 24 deletions
diff --git a/tests/auto/controls/data/tst_dialogbuttonbox.qml b/tests/auto/controls/data/tst_dialogbuttonbox.qml
index 0e2566e9..a651713a 100644
--- a/tests/auto/controls/data/tst_dialogbuttonbox.qml
+++ b/tests/auto/controls/data/tst_dialogbuttonbox.qml
@@ -366,27 +366,6 @@ TestCase {
}
}
- // QTBUG-72886
- function test_oneCustomButtonChangeText() {
- var control = createTemporaryObject(customButtonBox, testCase, {})
- verify(control)
-
- var listView = control.contentItem
- waitForRendering(listView)
-
- var button = control.okButton
- verify(button)
- button.text = "some longer text";
-
- // The button should never go outside of the box.
- tryVerify(function() { return button.mapToItem(control, 0, 0).x >= 0 },
- 1000, "Expected left edge of button to be within left edge of DialogButtonBox (i.e. greater than or equal to 0)" +
- ", but it's " + button.mapToItem(control, 0, 0).x)
- tryVerify(function() { return button.mapToItem(control, 0, 0).x + button.width <= control.width },
- 1000, "Expected right edge of button to be within right edge of DialogButtonBox (i.e. less than or equal to " +
- control.width + "), but it's " + (button.mapToItem(control, 0, 0).x + button.width))
- }
-
Component {
id: customButtonBoxTwoButtons
@@ -410,16 +389,25 @@ TestCase {
}
}
+ function test_changeCustomButtonText_data() {
+ return [
+ { tag: "oneButton", component: customButtonBox },
+ { tag: "twoButtons", component: customButtonBoxTwoButtons },
+ ]
+ }
+
// QTBUG-72886
- function test_twoCustomButtonsChangeText() {
- var control = createTemporaryObject(customButtonBoxTwoButtons, testCase, {})
+ function test_changeCustomButtonText(data) {
+ var control = createTemporaryObject(customButtonBox, testCase, {})
verify(control)
var listView = control.contentItem
waitForRendering(listView)
var button = control.okButton
+ verify(button)
button.text = "some longer text";
+
// The button should never go outside of the box.
tryVerify(function() { return button.mapToItem(control, 0, 0).x >= 0 },
1000, "Expected left edge of button to be within left edge of DialogButtonBox (i.e. greater than or equal to 0)" +
@@ -429,7 +417,6 @@ TestCase {
control.width + "), but it's " + (button.mapToItem(control, 0, 0).x + button.width))
}
-
Component {
id: noRolesDialog