summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2018-04-18 14:07:36 +0200
committerGatis Paeglis <gatis.paeglis@qt.io>2018-05-02 11:42:04 +0000
commitc9b46a130ec7f874a564bff1c9a70083705fc25b (patch)
tree79881d228fa9bcdb505d5f0cfd999acd4bd802c8
parent2803cdf758dbae1006a0c50300af12dac9f71531 (diff)
qtestlib: restore qWaitForWindowActive() its original semantics
This patch removes a bad hack for Unity issue described in QTBUG-67757. The workaround from 243a0660e10d13b8bd6eb4f90e5695aefab4611f caused even more problems, see QTBUG-63542. Besides causing more problems, the usage of this hack was inconsistent. The goal was to get stable geometry before continuing further in the test function. The same logic should have been used in qWaitForWindowExposed(). It was never documented that only qWaitForWindowActive() has this tweak. Also this hack was needed only for Unity, instead being unconditionally executed for all platforms. Task-number: QTBUG-67757 Change-Id: I7b7fb4b09151c4ab4807282006d7f956b18f60ad Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
-rw-r--r--src/testlib/qtestsystem.h18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h
index 79fe68004e..daa0d7aea0 100644
--- a/src/testlib/qtestsystem.h
+++ b/src/testlib/qtestsystem.h
@@ -112,23 +112,7 @@ namespace QTest
#ifdef QT_GUI_LIB
Q_REQUIRED_RESULT inline static bool qWaitForWindowActive(QWindow *window, int timeout = 5000)
{
- bool becameActive = qWaitFor([&]() { return window->isActive(); }, timeout);
-
- // Try ensuring the platform window receives the real position.
- // (i.e. that window->pos() reflects reality)
- // isActive() ( == FocusIn in case of X) does not guarantee this. It seems some WMs randomly
- // send the final ConfigureNotify (the one with the non-bogus 0,0 position) after the FocusIn.
- // If we just let things go, every mapTo/FromGlobal call the tests perform directly after
- // qWaitForWindowShown() will generate bogus results.
- if (becameActive) {
- int waitNo = 0; // 0, 0 might be a valid position after all, so do not wait for ever
- while (window->position().isNull()) {
- if (waitNo++ > timeout / 10)
- break;
- qWait(10);
- }
- }
- return window->isActive();
+ return qWaitFor([&]() { return window->isActive(); }, timeout);
}
Q_REQUIRED_RESULT inline static bool qWaitForWindowExposed(QWindow *window, int timeout = 5000)