diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2019-03-26 14:42:06 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2019-03-29 08:14:12 +0000 |
commit | ef9ab1a4bd4e3545cfb1c23c002e58b3e078ed75 (patch) | |
tree | 722a58c1350063992d2c9513ea70ef5d08a56562 /tests | |
parent | 7c31b884b932034bb907db638f155b813d90aff2 (diff) |
tst_dialogbuttonbox.qml: use tryVerify() consistently to avoid flakiness
Change-Id: Ic18cca692b09f55818b9c99379aae4be72ba4159
Fixes: QTBUG-74711
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_dialogbuttonbox.qml | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/auto/controls/data/tst_dialogbuttonbox.qml b/tests/auto/controls/data/tst_dialogbuttonbox.qml index 374b32ff..0e2566e9 100644 --- a/tests/auto/controls/data/tst_dialogbuttonbox.qml +++ b/tests/auto/controls/data/tst_dialogbuttonbox.qml @@ -288,9 +288,12 @@ TestCase { verify(button) // The button should never go outside of the box. - var buttonPosInBox = button.mapToItem(control, 0, 0) - verify(buttonPosInBox.x >= 0) - verify(buttonPosInBox.x + button.width < control.width) + 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 { @@ -333,11 +336,12 @@ TestCase { verify(button) // The button should never go outside of the box. - var buttonPosInBox = button.mapToItem(box, 0, 0) - verify(buttonPosInBox.x >= 0, "Expected button to be inside left edge " - + "of DialogButtonBox, but it's " + buttonPosInBox.x) - verify(buttonPosInBox.x + button.width <= box.width, "Expected button to be inside right edge " - + "of DialogButtonBox (" + box.width + "), but it's " + (buttonPosInBox.x + button.width)) + tryVerify(function() { return button.mapToItem(box, 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(box, 0, 0).x) + tryVerify(function() { return button.mapToItem(box, 0, 0).x + button.width <= box.width }, + 1000, "Expected right edge of button to be within right edge of DialogButtonBox (i.e. less than or equal to " + + box.width + "), but it's " + (button.mapToItem(box, 0, 0).x + button.width)) compare(box.width, dialog.width) // There's a single button and we align it to the right. compare(box.contentItem.width, button.width) |