Stabilize test QMenu::QTBUG_89082_actionTipsHide() on Windows, take 2

Use the QWindow-based overloads of QTest::mouseMove(), which do
not move the cursor position.

Amends ba139603925453bf79994eca48b566d8f15b2af0,
3f3d5e6716d9130776b3613ccbd5595de7d4af8d.

Task-number: QTBUG-89082
Change-Id: I2cc62e4d1f24e4baebafd0d76fbf0fbdb6f588c7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 65c6fbea242e150d785ea0a7062188fdc090af32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Friedemann Kleint 2021-03-03 08:13:40 +01:00 committed by Qt Cherry-pick Bot
parent c72c228717
commit bbdbe26cad

View File

@ -1373,6 +1373,8 @@ void tst_QMenu::QTBUG_89082_actionTipsHide()
QVERIFY(QTest::qWaitForWindowExposed(&widget));
menu->popup(widget.geometry().topRight() + QPoint(50, 0));
QVERIFY(QTest::qWaitForWindowExposed(menu));
auto menuWindow = menu->windowHandle();
QVERIFY(menuWindow != nullptr);
auto actionZero = menu->actions().at(0);
auto actionOne = menu->actions().at(1);
@ -1386,12 +1388,12 @@ void tst_QMenu::QTBUG_89082_actionTipsHide()
const QRect submenuRect5 = menu->actionGeometry(actionFive);
const QPoint submenuPos5(submenuRect5.topLeft() + QPoint(10, 3));
QTest::mouseMove(menu, submenuPos1);
QTest::mouseMove(menu, submenuPos0); //show the tip
QTest::mouseMove(menuWindow, submenuPos1);
QTest::mouseMove(menuWindow, submenuPos0); //show the tip
QTRY_COMPARE_WITH_TIMEOUT(QToolTip::text(), tipFullName, 1000);
//Move to the fifth action without prompting
QTest::mouseMove(menu, submenuPos5);
QTest::mouseMove(menuWindow, submenuPos5);
//The previous tip was hidden, but now is a new tip to get text, So there should be no content
QTRY_COMPARE_WITH_TIMEOUT(QToolTip::text(), QString(), 1000);
}