OpenGL autotests: verify create()/makeCurrent()

If create() or makeCurrent() calls fail, the test should fail fast.

Change-Id: I025c541f94c8eee492cf0e1545bfbb8027eff2a7
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
Andrew Knight 2013-09-30 15:07:24 +03:00 committed by The Qt Project
parent f08cc1dabe
commit aa5f78cb33
2 changed files with 16 additions and 16 deletions

View File

@ -171,8 +171,8 @@ void tst_QOpenGL::sharedResourceCleanup()
QScopedPointer<QSurface> surface(createSurface(surfaceClass));
QOpenGLContext *ctx = new QOpenGLContext;
ctx->create();
ctx->makeCurrent(surface.data());
QVERIFY(ctx->create());
QVERIFY(ctx->makeCurrent(surface.data()));
SharedResourceTracker tracker;
SharedResource *resource = new SharedResource(&tracker);
@ -188,7 +188,7 @@ void tst_QOpenGL::sharedResourceCleanup()
QOpenGLContext *ctx2 = new QOpenGLContext;
ctx2->setShareContext(ctx);
ctx2->create();
QVERIFY(ctx2->create());
delete ctx;
@ -238,7 +238,7 @@ void tst_QOpenGL::multiGroupSharedResourceCleanup()
for (int i = 0; i < 10; ++i) {
QOpenGLContext *gl = new QOpenGLContext();
gl->create();
QVERIFY(gl->create());
gl->makeCurrent(surface.data());
{
// Cause QOpenGLMultiGroupSharedResource instantiation.
@ -262,8 +262,8 @@ void tst_QOpenGL::multiGroupSharedResourceCleanupCustom()
QScopedPointer<QSurface> surface(createSurface(surfaceClass));
QOpenGLContext *ctx = new QOpenGLContext();
ctx->create();
ctx->makeCurrent(surface.data());
QVERIFY(ctx->create());
QVERIFY(ctx->makeCurrent(surface.data()));
QOpenGLMultiGroupSharedResource multiGroupSharedResource;
SharedResource *resource = multiGroupSharedResource.value<SharedResource>(ctx);
@ -401,7 +401,7 @@ void tst_QOpenGL::fboSimpleRendering()
QScopedPointer<QSurface> surface(createSurface(surfaceClass));
QOpenGLContext ctx;
ctx.create();
QVERIFY(ctx.create());
ctx.makeCurrent(surface.data());
@ -449,7 +449,7 @@ void tst_QOpenGL::fboRendering()
QScopedPointer<QSurface> surface(createSurface(surfaceClass));
QOpenGLContext ctx;
ctx.create();
QVERIFY(ctx.create());
ctx.makeCurrent(surface.data());
@ -493,7 +493,7 @@ void tst_QOpenGL::fboHandleNulledAfterContextDestroyed()
{
QOpenGLContext ctx;
ctx.create();
QVERIFY(ctx.create());
ctx.makeCurrent(&window);
@ -523,7 +523,7 @@ void tst_QOpenGL::openGLPaintDevice()
QScopedPointer<QSurface> surface(createSurface(surfaceClass));
QOpenGLContext ctx;
ctx.create();
QVERIFY(ctx.create());
QSurfaceFormat format = ctx.format();
if (format.majorVersion() < 2)
@ -576,8 +576,8 @@ void tst_QOpenGL::aboutToBeDestroyed()
QOpenGLContext *context = new QOpenGLContext;
QSignalSpy spy(context, SIGNAL(aboutToBeDestroyed()));
context->create();
context->makeCurrent(&window);
QVERIFY(context->create());
QVERIFY(context->makeCurrent(&window));
QCOMPARE(spy.size(), 0);
@ -598,8 +598,8 @@ void tst_QOpenGL::QTBUG15621_triangulatingStrokerDivZero()
window.create();
QOpenGLContext ctx;
ctx.create();
ctx.makeCurrent(&window);
QVERIFY(ctx.create());
QVERIFY(ctx.makeCurrent(&window));
if (!QOpenGLFramebufferObject::hasOpenGLFramebufferObjects())
QSKIP("QOpenGLFramebufferObject not supported on this platform");

View File

@ -228,8 +228,8 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format)
fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
fmt.setSamples(4);
QOpenGLContext ctx;
ctx.create();
ctx.makeCurrent(&win);
QVERIFY(ctx.create());
QVERIFY(ctx.makeCurrent(&win));
QOpenGLFramebufferObject fbo(800, 800, fmt);
fbo.bind();
QOpenGLPaintDevice pdv(800, 800);