summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2012-03-14 12:16:45 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-15 11:40:50 +0100
commit0b70d8c6afb525d80cf4f1fc788e1a5947f0b152 (patch)
tree19f04db2641072202ca4403f471a05f16660acc1 /src
parenta17907829e6b180f2bb4af9a8594996b2a0e531a (diff)
Improved qWaitForWindowShown().
Made faster by actually waiting for the window to be exposed, using similar waiting logic as qWait(). Should speed up autotests that use it quite a bit. Change-Id: I628c6110a554fdbbf5bed7e91f57c2fe341113ed Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/testlib/qtestsystem.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h
index 1f10967557..ade5f4c8ac 100644
--- a/src/testlib/qtestsystem.h
+++ b/src/testlib/qtestsystem.h
@@ -53,9 +53,6 @@ QT_BEGIN_NAMESPACE
class QWidget;
-#ifdef Q_WS_X11
-extern void qt_x11_wait_for_window_manager(QWidget *w);
-#endif
namespace QTest
{
@@ -74,22 +71,25 @@ namespace QTest
inline static bool qWaitForWindowShown(QWidget *window)
{
-#if defined(Q_WS_X11)
- qt_x11_wait_for_window_manager(window);
- QCoreApplication::processEvents();
-#else
Q_UNUSED(window);
qWait(200);
-#endif
return true;
}
+
inline static bool qWaitForWindowShown(QWindow *window)
{
- Q_UNUSED(window);
- qWait(200);
+ QElapsedTimer timer;
+ timer.start();
+ while (!window->isExposed()) {
+ int remaining = int(timer.elapsed()) - 1000;
+ if (remaining <= 0)
+ break;
+ QCoreApplication::processEvents(QEventLoop::AllEvents, remaining);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QTest::qSleep(10);
+ }
return true;
}
-
}
QT_END_NAMESPACE