Commit 2b0f2c1c8452c16723a15f00117c96c57bb017a8

Added a QTest::qWaitForWindowShown function that waits for window manager on X11.

On X11 it calls the qt_x11_wait_for_window_manager from QtGui,
allowing to wait until the window has been mapped and reparented into
a frame decoration parent.

Reviewed-by: Olivier Goffart
  
225225QTest::qSleep(250);
226226//! [23]
227227
228//! [24]
229QWidget widget;
230widget.show();
231QTest::qWaitForWindowShown(&widget);
232//! [24]
233
228234}
  
731731 \sa QTest::qSleep()
732732*/
733733
734/*! \fn void QTest::qWaitForWindowManager(QWidget *window)
735
736 Waits until the window is shown in the screen. This is mainly useful for
737 asynchronous systems like X11, where a window will be mapped to screen some
738 time after being asked to show itself on the screen.
739
740 Example:
741 \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 24
742*/
743
734744/*!
735745 \class QTest::QTouchEventSequence
736746 \inmodule QtTest
  
5252
5353QT_MODULE(Test)
5454
55class QWidget;
56#ifdef Q_WS_X11
57extern void qt_x11_wait_for_window_manager(QWidget *w);
58#endif
59
5560namespace QTest
5661{
5762 inline static void qWait(int ms)
7070 QTest::qSleep(10);
7171 } while (timer.elapsed() < ms);
7272 }
73
74 inline static bool qWaitForWindowShown(QWidget *window)
75 {
76#if defined(Q_WS_X11)
77 qt_x11_wait_for_window_manager(window);
78#elif defined(Q_WS_QWS)
79 qWait(100);
80#else
81 qWait(50);
82#endif
83 return true;
84 }
85
7386}
7487
7588QT_END_NAMESPACE