summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2019-10-01 11:32:55 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2019-10-01 11:47:37 +0200
commit56f084781e2b8891929eca0070212fd7a32b32fc (patch)
tree1caa2abe968ae03c21d91ff9aeb4a1ff8138f98c /tests/auto/gui
parent6b3de85f2b12a001a8f7a55da917a6f2fa004dcd (diff)
Prospective fix to stabilize tst_qwindow::isActive() on Windows 10
It is conceivable that during the try-compare loop of processing windowing system events we loose and regain the focus. That would explain the occasional test failure where instead of the expected 3 focus in events, we have received four. Task-number: QTBUG-77769 Change-Id: I2221440d09a74d4d18a72f7786232b4491cf45a8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 1290347eab..34de756ab5 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -893,7 +893,13 @@ void tst_QWindow::isActive()
QTRY_COMPARE(QGuiApplication::focusWindow(), &window);
QCoreApplication::processEvents();
QTRY_COMPARE(dialog.received(QEvent::FocusOut), 1);
- QTRY_COMPARE(window.received(QEvent::FocusIn), 3);
+ // We should be checking for exactly three, but since this is a try-compare _loop_, we might
+ // loose and regain focus multiple times in the event of a system popup. This has been observed
+ // to fail on Windows, see QTBUG-77769.
+ QTRY_VERIFY2(window.received(QEvent::FocusIn) >= 3,
+ qPrintable(
+ QStringLiteral("Expected more than three focus in events, received: %1")
+ .arg(window.received(QEvent::FocusIn))));
QVERIFY(window.isActive());