diff options
author | Liang Qi <liang.qi@qt.io> | 2016-10-17 11:02:54 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-10-17 11:02:54 +0200 |
commit | d90b155c6034bc16a9eb2d5794f101cde4ea9e2c (patch) | |
tree | e648b8db6b9e8e8d7f0c765ac2953b066524eb49 /tests | |
parent | b00565bc2803bb783e8f2b0d02becfa73323e283 (diff) | |
parent | d71bb504a635b51a85f3ccd919e0d77f869e50a8 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
mkspecs/macx-ios-clang/features/resolve_config.prf
src/testlib/qtestcase.qdoc
Change-Id: Icefa63056ffb37106f35299a8f19165535571799
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/gui/qopengl/tst_qopengl.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 15244744bf..f988cdb957 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -109,6 +109,7 @@ private slots: void vaoCreate(); void bufferCreate(); void bufferMapRange(); + void defaultQGLCurrentBuffer(); }; struct SharedResourceTracker @@ -1520,6 +1521,33 @@ void tst_QOpenGL::bufferMapRange() ctx->doneCurrent(); } +void tst_QOpenGL::defaultQGLCurrentBuffer() +{ + QScopedPointer<QSurface> surface(createSurface(QSurface::Window)); + QScopedPointer<QOpenGLContext> ctx(new QOpenGLContext); + ctx->create(); + ctx->makeCurrent(surface.data()); + + // Bind default FBO on the current context, and record what's the current QGL FBO. It should + // be Q_NULLPTR because the default platform OpenGL FBO is not backed by a + // QOpenGLFramebufferObject. + QOpenGLFramebufferObject::bindDefault(); + QOpenGLFramebufferObject *defaultQFBO = QOpenGLContextPrivate::get(ctx.data())->qgl_current_fbo; + + // Create new FBO, bind it, and see that the QGL FBO points to the newly created FBO. + QScopedPointer<QOpenGLFramebufferObject> obj(new QOpenGLFramebufferObject(128, 128)); + obj->bind(); + QOpenGLFramebufferObject *customQFBO = QOpenGLContextPrivate::get(ctx.data())->qgl_current_fbo; + QVERIFY(defaultQFBO != customQFBO); + + // Bind the default FBO, and check that the QGL FBO points to the original FBO object. + QOpenGLFramebufferObject::bindDefault(); + QOpenGLFramebufferObject *finalQFBO = QOpenGLContextPrivate::get(ctx.data())->qgl_current_fbo; + QCOMPARE(defaultQFBO, finalQFBO); + + ctx->doneCurrent(); +} + void tst_QOpenGL::nullTextureInitializtion() { QScopedPointer<QSurface> surface(createSurface(QSurface::Window)); |