From aa5f78cb33404e585a1e511a58a0ca43aa46f421 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Mon, 30 Sep 2013 15:07:24 +0300 Subject: OpenGL autotests: verify create()/makeCurrent() If create() or makeCurrent() calls fail, the test should fail fast. Change-Id: I025c541f94c8eee492cf0e1545bfbb8027eff2a7 Reviewed-by: Gunnar Sletta --- tests/auto/gui/qopengl/tst_qopengl.cpp | 28 ++++++++++++++-------------- tests/auto/other/lancelot/tst_lancelot.cpp | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 97f3ec128d..4defbe181f 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -171,8 +171,8 @@ void tst_QOpenGL::sharedResourceCleanup() QScopedPointer 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 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(ctx); @@ -401,7 +401,7 @@ void tst_QOpenGL::fboSimpleRendering() QScopedPointer surface(createSurface(surfaceClass)); QOpenGLContext ctx; - ctx.create(); + QVERIFY(ctx.create()); ctx.makeCurrent(surface.data()); @@ -449,7 +449,7 @@ void tst_QOpenGL::fboRendering() QScopedPointer 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 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"); diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp index fff8884d67..a99b041bfc 100644 --- a/tests/auto/other/lancelot/tst_lancelot.cpp +++ b/tests/auto/other/lancelot/tst_lancelot.cpp @@ -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); -- cgit v1.2.3