Fix tst_qwidget_window::mouseMoveWithPopup on Wayland

The test assumed that a window was registered as the active
one immediately when it was exposed. This created a race
condition on Wayland, where we would often get the wrong
active window when simulating the events.

Task-number: QTBUG-91418
Change-Id: Ie41fe5adb339bbb43d5ee5db400a198e479de386
Reviewed-by: Liang Qi <liang.qi@qt.io>
bb10
Eskil Abrahamsen Blomfeldt 2021-03-02 08:16:38 +01:00
parent 22ff16dc72
commit 5552d3d446
1 changed files with 4 additions and 1 deletions

View File

@ -1397,7 +1397,7 @@ void tst_QWidget_window::mouseMoveWithPopup()
QSKIP("Failed to expose window!");
QCOMPARE(QApplication::activePopupWidget(), nullptr);
QCOMPARE(QApplication::activeWindow(), &topLevel);
QTRY_COMPARE(QApplication::activeWindow(), &topLevel);
QPoint mousePos = topLevel.geometry().center();
QWindow *window = nullptr;
@ -1452,6 +1452,9 @@ void tst_QWidget_window::mouseMoveWithPopup()
topLevel.resetCounters();
topLevel.popup->resetCounters();
QTRY_VERIFY(QApplication::activeWindow() == topLevel.popup
|| QApplication::activePopupWidget() == topLevel.popup);
// nested popup, same procedure
QCOMPARE(mouseAction(Qt::RightButton), QEvent::MouseButtonPress);
QVERIFY(topLevel.popup);