summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/qopengl
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-31 20:09:14 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-01 06:02:55 +0100
commita732576a66ff2bbd9c0b41cd5f3505a4d2fbf043 (patch)
treed09875c3543ad837fbfaaf10bd4eef1d3de42941 /tests/auto/gui/qopengl
parentcd9de59177ccbeb7fdfacf8716af7bb20112c880 (diff)
parent8e20daae9fee5f3b999daffce0d7156015ee974b (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: config.tests/win/msvc_version.cpp configure.pri mkspecs/macx-ios-clang/features/default_post.prf mkspecs/macx-ios-clang/features/resolve_config.prf mkspecs/features/uikit/default_post.prf mkspecs/features/uikit/resolve_config.prf src/corelib/io/qsettings_mac.cpp src/corelib/json/qjsondocument.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.h src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/ios.pro src/plugins/platforms/ios/kernel.pro src/plugins/platforms/ios/qiosintegration.h src/plugins/platforms/minimalegl/qminimaleglintegration.cpp tests/auto/gui/painting/qpainter/tst_qpainter.cpp tools/configure/environment.cpp Change-Id: I654845e54e40f5951fb78aab349ca667e9f27843
Diffstat (limited to 'tests/auto/gui/qopengl')
-rw-r--r--tests/auto/gui/qopengl/tst_qopengl.cpp28
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 ed48a4978a..44921f68aa 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));