diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-06-12 12:17:33 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-15 15:07:17 +0000 |
commit | 141334fdc81d2b1556003a6aedb59d084671dbe4 (patch) | |
tree | d030dcaae00ea384ed4938e071fef402cbc970f3 /tests/auto | |
parent | 81a7e0ea67e71f4128f9f5b070e1dde28dfc616f (diff) |
Stabilize flaky scrollerSmoothScroll test case
This test failed when checking for a pre-condition of the tested scenario,
so skip the test if that condition isn't met, as the test won't test
anything.
Amends b1fdcc8c0fefe0660302494618032342b623e199.
Task-number: QTBUG-64543
Change-Id: I135cd5b45efcae111305b9be338eb5429d3b97d5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 2933e67f4547ec7ae14c9d370d20aff5a99327d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 7c4dc38d6d..669428dd35 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -3081,9 +3081,11 @@ void tst_QAbstractItemView::scrollerSmoothScroll() QListWidgetItem *pressItem = view.item(23); QPoint dragPosition = view.visualRect(view.indexFromItem(pressItem)).center(); // the mouse press changes the current item temporarily, but the press is delayed - // by the gesture machinery + // by the gesture machinery. this is not what we are testing here, so skip the test + // if this fails within a reasonable amount of time. QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::NoModifier, dragPosition); - QTRY_COMPARE(view.currentItem(), pressItem); + if (!(QTest::qWaitFor([&]{ return view.currentItem() == pressItem; }))) + QSKIP("Current item didn't change on press, skipping test"); // QAIV will reset the current item when the scroller changes state to Dragging for (int y = 0; y < QApplication::startDragDistance() * 2; ++y) { |