diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-01-26 09:25:15 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-01-29 11:10:49 +0000 |
commit | c1c7a952bc11d3bd9edcd3739c57df15b60a9e79 (patch) | |
tree | ecd1ad0087f973e0eba66e5392db48d00e478036 /tests/auto/quick/nodes | |
parent | cf6e97119df5bf17b4a952b257d05d43b7d6ca26 (diff) |
Verify context creation in Quick tests.
Verify initialization steps and initialize pointers to avoid
crashes.
Change-Id: I2d3a53c6719727aed56e673d0d8cf5a02ae0f0f6
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'tests/auto/quick/nodes')
-rw-r--r-- | tests/auto/quick/nodes/tst_nodestest.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
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; |