From c1c7a952bc11d3bd9edcd3739c57df15b60a9e79 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 26 Jan 2015 09:25:15 +0100 Subject: Verify context creation in Quick tests. Verify initialization steps and initialize pointers to avoid crashes. Change-Id: I2d3a53c6719727aed56e673d0d8cf5a02ae0f0f6 Reviewed-by: Laszlo Agocs --- tests/auto/quick/nodes/tst_nodestest.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'tests/auto/quick/nodes') diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index e017cae422..37a73cca6f 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -82,19 +82,24 @@ void NodesTest::initTestCase() surface = new QOffscreenSurface; surface->create(); + QVERIFY(surface->isValid()); context = new QOpenGLContext(); - context->create(); - context->makeCurrent(surface); + QVERIFY(context->create()); + QVERIFY(context->makeCurrent(surface)); renderContext = renderLoop->createRenderContext(renderLoop->sceneGraphContext()); + QVERIFY(renderContext); renderContext->initialize(context); + QVERIFY(renderContext->isValid()); } void NodesTest::cleanupTestCase() { - renderContext->invalidate(); - context->doneCurrent(); + if (renderContext) + renderContext->invalidate(); + if (context) + context->doneCurrent(); delete context; delete surface; } @@ -133,10 +138,12 @@ public: int DummyRenderer::globalRendereringOrder; NodesTest::NodesTest() + : surface(Q_NULLPTR) + , context(Q_NULLPTR) + , renderContext(Q_NULLPTR) { } - void NodesTest::propegate() { QSGRootNode root; -- cgit v1.2.3