diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 20 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp | 24 |
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index e542c85218..89490525c9 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -91,6 +91,7 @@ private slots: void modalWindowModallity(); void modalWindowPosition(); void windowsTransientChildren(); + void requestUpdate(); void initTestCase(); void cleanup(); @@ -1666,6 +1667,25 @@ void tst_QWindow::windowsTransientChildren() QVERIFY(isNativeWindowVisible(&child)); // Real children should be visible. } +void tst_QWindow::requestUpdate() +{ + QRect geometry(m_availableTopLeft + QPoint(80, 80), m_testWindowSize); + + Window window; + window.setGeometry(geometry); + window.show(); + QCoreApplication::processEvents(); + QTRY_VERIFY(window.isExposed()); + + QVERIFY(window.received(QEvent::UpdateRequest) == 0); + + window.requestUpdate(); + QTRY_VERIFY(window.received(QEvent::UpdateRequest) == 1); + + window.requestUpdate(); + QTRY_VERIFY(window.received(QEvent::UpdateRequest) == 2); +} + #include <tst_qwindow.moc> QTEST_MAIN(tst_QWindow) diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp index ade70b0eec..0c0c50ac64 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp +++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp @@ -55,6 +55,7 @@ private slots: void reparentToAlreadyCreated(); void reparentToNotYetCreated(); void asViewport(); + void requestUpdate(); }; void tst_QOpenGLWidget::create() @@ -305,6 +306,29 @@ void tst_QOpenGLWidget::asViewport() QVERIFY(view->paintCount() == 0); } +class PaintCountWidget : public QOpenGLWidget +{ +public: + PaintCountWidget() : m_count(0) { } + void reset() { m_count = 0; } + void paintGL() Q_DECL_OVERRIDE { ++m_count; } + int m_count; +}; + +void tst_QOpenGLWidget::requestUpdate() +{ + PaintCountWidget w; + w.resize(640, 480); + w.show(); + QTest::qWaitForWindowExposed(&w); + + w.reset(); + QCOMPARE(w.m_count, 0); + + w.windowHandle()->requestUpdate(); + QTRY_VERIFY(w.m_count > 0); +} + QTEST_MAIN(tst_QOpenGLWidget) #include "tst_qopenglwidget.moc" |