From c9b46a130ec7f874a564bff1c9a70083705fc25b Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 18 Apr 2018 14:07:36 +0200 Subject: qtestlib: restore qWaitForWindowActive() its original semantics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Kari Oikarinen Reviewed-by: Morten Johan Sørvig Reviewed-by: Ville Voutilainen --- src/testlib/qtestsystem.h | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'src/testlib/qtestsystem.h') 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) -- cgit v1.2.3