diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2019-09-03 13:20:29 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2019-09-04 12:32:47 +0200 |
commit | 97fc102cd079f32cc1a4f00a764ceea981699fc0 (patch) | |
tree | 7c4f1a0b5d89c8d879c7dda5f11ae469f7d7a5c8 /tests/auto/qquickdrawer | |
parent | 7f36556603f7ea6d3a15625c9057ea875a6b6f41 (diff) |
Fix flakiness in tst_qquickdrawer tests
Although it's not ideal to add arbitrary delays to tests, it does
reflect a more realistic testing environment, and more importantly,
seems to fix the flakiness on OpenSUSE.
Change-Id: I0c13e5f628654aaff349c2f07be46792773a9789
Fixes: QTBUG-77946
Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'tests/auto/qquickdrawer')
-rw-r--r-- | tests/auto/qquickdrawer/tst_qquickdrawer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp index 97472a11..7644cacf 100644 --- a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp +++ b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp @@ -350,7 +350,8 @@ void tst_QQuickDrawer::position() QVERIFY(drawer); drawer->setEdge(edge); - QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, press); + // Give it some time (50 ms) before the press to avoid flakiness on OpenSUSE: QTBUG-77946 + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, press, 50); QTest::mouseMove(window, from); QTest::mouseMove(window, to); QCOMPARE(drawer->position(), position); @@ -403,7 +404,8 @@ void tst_QQuickDrawer::dragMargin() int leftX = qMax<int>(0, dragMargin); int leftDistance = startDragDistance + drawer->width() * 0.45; QVERIFY(leftDistance > QGuiApplication::styleHints()->startDragDistance()); - QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(leftX, drawer->height() / 2)); + // Give it some time (50 ms) before the press to avoid flakiness on OpenSUSE: QTBUG-77946 + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(leftX, drawer->height() / 2), 50); QTest::mouseMove(window, QPoint(leftX + startDragDistance, drawer->height() / 2)); QTest::mouseMove(window, QPoint(leftX + leftDistance, drawer->height() / 2)); QCOMPARE(drawer->position(), dragFromLeft); |