summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-03-02 08:16:38 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-03-15 08:17:34 +0100
commit5552d3d4465a4095f899aa1f8ca03de6a9737b4a (patch)
tree959862886f77fa4156c7ce8c22b0cf12db5fb379 /tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
parent22ff16dc726d0f551eb6888038b766fd18213bf4 (diff)
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>
Diffstat (limited to 'tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp')
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index 654d8e58ba..dbd541c736 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -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);