diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-02-17 13:06:11 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-14 15:26:41 +0100 |
commit | 7bd7699e172b91527f927957077c148675f9f332 (patch) | |
tree | 92131f0ae06180a072b22e8e17286237f13e5dd3 /tests/auto/gui/qopengl/tst_qopengl.cpp | |
parent | 0300f56133d20fabdd303f5109ccd0c7a1eda9f5 (diff) |
Add sizeLessWindow test case.
Verify that QOpenGLContext works with QWindows that
do not have an explicit size set.
Task-number: QTBUG-35342
Change-Id: I91be7beb0062c5825fc58273c701c396b6423256
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'tests/auto/gui/qopengl/tst_qopengl.cpp')
-rw-r--r-- | tests/auto/gui/qopengl/tst_qopengl.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 975c2acefd..4018c00a38 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -78,6 +78,7 @@ private slots: void openGLPaintDevice_data(); void openGLPaintDevice(); void aboutToBeDestroyed(); + void sizeLessWindow(); void QTBUG15621_triangulatingStrokerDivZero(); void textureblitterFullSourceRectTransform(); void textureblitterPartOriginBottomLeftSourceRectTransform(); @@ -645,6 +646,43 @@ void tst_QOpenGL::aboutToBeDestroyed() QCOMPARE(spy.size(), 1); } +// Verify that QOpenGLContext works with QWindows that do +// not have an explicit size set. +void tst_QOpenGL::sizeLessWindow() +{ + // top-level window + { + QWindow window; + window.setSurfaceType(QWindow::OpenGLSurface); + + QOpenGLContext context; + QVERIFY(context.create()); + + window.show(); + QVERIFY(context.makeCurrent(&window)); + QVERIFY(QOpenGLContext::currentContext()); + } + + QVERIFY(!QOpenGLContext::currentContext()); + + // child window + { + QWindow parent; + QWindow window(&parent); + window.setSurfaceType(QWindow::OpenGLSurface); + + QOpenGLContext context; + QVERIFY(context.create()); + + parent.show(); + window.show(); + QVERIFY(context.makeCurrent(&window)); + QVERIFY(QOpenGLContext::currentContext()); + } + + QVERIFY(!QOpenGLContext::currentContext()); +} + void tst_QOpenGL::QTBUG15621_triangulatingStrokerDivZero() { #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(__x86_64__) |