summaryrefslogtreecommitdiffstats
path: root/tests/auto/opengl
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-07-18 13:12:59 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-20 09:27:28 +0200
commit87618403976aa82450895da6196a944195980de7 (patch)
tree906d035678d8a31e57a94c01e8756b0085b3e1e4 /tests/auto/opengl
parentc081107206cb1d31415539c4429f7896b997cf71 (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/opengl')
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp56
1 files changed, 15 insertions, 41 deletions
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index 5da44dfbfa..dd0b0dcb01 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -848,6 +848,8 @@ void tst_QGL::graphicsViewClipping()
scene.addWidget(widget)->setPos(0, 0);
QGraphicsView view(&scene);
+ // Use Qt::Tool as fully decorated windows have a minimum width of 160 on Windows.
+ view.setWindowFlags(view.windowFlags() | Qt::Tool);
view.setBackgroundBrush(Qt::white);
#ifdef Q_WS_QWS
view.setWindowFlags(Qt::FramelessWindowHint);
@@ -857,16 +859,14 @@ void tst_QGL::graphicsViewClipping()
QGLWidget *viewport = new QGLWidget;
view.setViewport(viewport);
view.show();
+ qApp->setActiveWindow(&view);
if (!viewport->isValid())
return;
scene.setSceneRect(view.viewport()->rect());
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(500);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QImage image = viewport->grabFrameBuffer();
QImage expected = image;
@@ -966,9 +966,7 @@ void tst_QGL::glWidgetWithAlpha()
{
QGLWidget* w = new QGLWidget(QGLFormat(QGL::AlphaChannel));
w->show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(w);
-#endif
+ QVERIFY(QTest::qWaitForWindowExposed(w));
delete w;
}
@@ -1044,10 +1042,7 @@ void tst_QGL::glWidgetRendering()
w.resize(256, 128);
w.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&w);
-#endif
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
QVERIFY(w.beginOk);
QVERIFY(w.engineType == QPaintEngine::OpenGL || w.engineType == QPaintEngine::OpenGL2);
@@ -1287,10 +1282,7 @@ void tst_QGL::glFBOUseInGLWidget()
w.resize(100, 100);
w.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&w);
-#endif
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
QVERIFY(w.widgetPainterBeginOk);
QVERIFY(w.fboPainterBeginOk);
@@ -1325,32 +1317,23 @@ void tst_QGL::glWidgetReparent()
grandParentWidget.setGeometry(0, 100, 200, 200);
grandParentWidget.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(widget);
- qt_x11_wait_for_window_manager(&parentWidget);
-#endif
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowExposed(widget));
+ QVERIFY(QTest::qWaitForWindowExposed(&grandParentWidget));
QVERIFY(parentWidget.children().count() == 1); // The layout
// Now both widgets should be created & shown, time to re-parent:
parentLayout.addWidget(widget);
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&parentWidget);
-#endif
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowExposed(&grandParentWidget));
QVERIFY(parentWidget.children().count() == 2); // Layout & glwidget
QVERIFY(parentWidget.children().contains(widget));
- QVERIFY(widget->height() > 30);
+ QTRY_VERIFY(widget->height() > 30);
delete widget;
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&parentWidget);
-#endif
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowExposed(&grandParentWidget));
QVERIFY(parentWidget.children().count() == 1); // The layout
@@ -1359,10 +1342,7 @@ void tst_QGL::glWidgetReparent()
widget = new GLWidget;
parentLayout.addWidget(widget);
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&parentWidget);
-#endif
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowExposed(&grandParentWidget));
QVERIFY(parentWidget.children().count() == 2); // Layout & glwidget
QVERIFY(parentWidget.children().contains(widget));
@@ -1676,10 +1656,7 @@ void tst_QGL::replaceClipping()
glw.resize(300, 300);
glw.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&glw);
-#endif
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowExposed(&glw));
QImage reference(300, 300, QImage::Format_RGB32);
QPainter referencePainter(&reference);
@@ -1793,10 +1770,7 @@ void tst_QGL::clipTest()
glw.resize(220, 220);
glw.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&glw);
-#endif
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowExposed(&glw));
QImage reference(glw.size(), QImage::Format_RGB32);
QPainter referencePainter(&reference);