diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-07-18 13:12:59 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-20 09:27:28 +0200 |
commit | 87618403976aa82450895da6196a944195980de7 (patch) | |
tree | 906d035678d8a31e57a94c01e8756b0085b3e1e4 /tests/auto/gui/image/qpixmap | |
parent | c081107206cb1d31415539c4429f7896b997cf71 (diff) |
Implement waitForWindowExposed and friends for widget windows.
- Implement waitForWindowExposed() for toplevel windows.
- Implement waitForWindowShown(QWidget *) and mark as
deprecated in line with waitForWindowShown(QWindow*).
- Use in tests.
- Simplify tests (collapse waitForExposed, setActive
into setActiveWindow, waitForActive), remove most
hard-coded timeouts.
- Stabilize graphicsview tests by using waitForWindowActive.
Change-Id: Ic7c061e2745b36f71a715ee4e47c0346b11a91e8
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'tests/auto/gui/image/qpixmap')
-rw-r--r-- | tests/auto/gui/image/qpixmap/tst_qpixmap.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 16fccb7491..b3d578ef3e 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -733,10 +733,7 @@ void tst_QPixmap::grabWindow() QWidget w; w.resize(640, 480); w.show(); - QTest::qWait(100); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&w); -#endif + QVERIFY(QTest::qWaitForWindowExposed(&w)); QVERIFY(QPixmap::grabWindow(w.winId()).isNull() == false); QWidget child(&w); @@ -744,14 +741,12 @@ void tst_QPixmap::grabWindow() child.setPalette(Qt::red); child.setAutoFillBackground(true); child.show(); - QTest::qWait(100); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&child); -#endif - - QPixmap grabWindowPixmap = QPixmap::grabWindow(child.winId()); - QPixmap grabWidgetPixmap = QPixmap::grabWidget(&child); - lenientCompare(grabWindowPixmap, grabWidgetPixmap); + QTest::qWait(20); + const QPixmap grabWidgetPixmap = QPixmap::grabWidget(&child); + const WId childWinId = child.winId(); // Create native child + QVERIFY(QTest::qWaitForWindowExposed(child.windowHandle())); + const QPixmap grabWindowPixmap = QPixmap::grabWindow(childWinId); + QVERIFY(lenientCompare(grabWindowPixmap, grabWidgetPixmap)); #endif } |