diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-06-12 12:17:33 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-06-15 16:03:38 +0200 |
commit | 2933e67f4547ec7ae14c9d370d20aff5a99327d0 (patch) | |
tree | de85d72eb95eb1ac3c97c3f19b538711ade3558e /tests/auto/widgets | |
parent | 8a034c62b6c87ee8c15b9132392fb7dde01e2a65 (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.
Pick-to: 6.2 6.1 5.15
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>
Diffstat (limited to 'tests/auto/widgets')
-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) { |