diff options
author | Jan Arve Sæther <jan-arve.saether@qt.io> | 2019-08-15 11:22:40 +0200 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@qt.io> | 2019-08-21 08:20:01 +0000 |
commit | 9655f7fdc96d26de369578bb6620f525c6f919d7 (patch) | |
tree | e3a80ee0a36a095d214a0e1ab6fc0a07d4b5c082 | |
parent | 1535c36a4728b3355ebe8abba4a9966eb2169d27 (diff) |
Fix flakiness in QQuickTextEdit::mouseSelection
Avoid that the last click from the previous test data and the first
click in the current test data happens so close in time that they are
interpreted as a double click.
Task-number: QTBUG-77389
Change-Id: Ia2d159452dcdb58cacccf7101cc3360175b39594
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r-- | tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 33a6b829bc..a9016be84a 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -2106,13 +2106,17 @@ void tst_qquicktextedit::mouseSelection() textEditObject->setFocus(focus); textEditObject->setFocusOnPress(focusOnPress); + // Avoid that the last click from the previous test data and the first click in the + // current test data happens so close in time that they are interpreted as a double click. + static const int moreThanDoubleClickInterval = QGuiApplication::styleHints()->mouseDoubleClickInterval() + 1; + // press-and-drag-and-release from x1 to x2 QPoint p1 = textEditObject->positionToRectangle(from).center().toPoint(); QPoint p2 = textEditObject->positionToRectangle(to).center().toPoint(); if (clicks == 2) - QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1, moreThanDoubleClickInterval); else if (clicks == 3) - QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p1); + QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p1, moreThanDoubleClickInterval); QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p1); if (clicks == 2) { // QTBUG-50022: Since qtbase commit beef975, QTestLib avoids generating |