diff options
-rw-r--r-- | tests/auto/quick/nodes/tst_nodestest.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index 9910729807..d07fd7177d 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -48,6 +48,8 @@ #include <QtQuick/qsgnode.h> #include <QtQuick/private/qsgbatchrenderer_p.h> #include <QtQuick/private/qsgnodeupdater_p.h> +#include <QtQuick/private/qsgrenderloop_p.h> +#include <QtQuick/private/qsgcontext_p.h> #include <QtQuick/qsgsimplerectnode.h> @@ -75,16 +77,22 @@ private Q_SLOTS: private: QOffscreenSurface *surface; QOpenGLContext *context; + QSGRenderContext *renderContext; }; void NodesTest::initTestCase() { + QSGRenderLoop *renderLoop = QSGRenderLoop::instance(); + surface = new QOffscreenSurface; surface->create(); context = new QOpenGLContext(); context->create(); context->makeCurrent(surface); + + renderContext = renderLoop->createRenderContext(renderLoop->sceneGraphContext()); + renderContext->initialize(context); } void NodesTest::cleanupTestCase() @@ -97,8 +105,8 @@ void NodesTest::cleanupTestCase() class DummyRenderer : public QSGBatchRenderer::Renderer { public: - DummyRenderer(QSGRootNode *root) - : QSGBatchRenderer::Renderer(new QSGRenderContext(0)) + DummyRenderer(QSGRootNode *root, QSGRenderContext *renderContext) + : QSGBatchRenderer::Renderer(renderContext) , changedNode(0) , changedState(0) , renderCount(0) @@ -138,7 +146,7 @@ void NodesTest::propegate() QSGNode child; child.setFlag(QSGNode::OwnedByParent, false); root.appendChildNode(&child); - DummyRenderer renderer(&root); + DummyRenderer renderer(&root, renderContext); child.markDirty(QSGNode::DirtyGeometry); @@ -158,8 +166,8 @@ void NodesTest::propegateWithMultipleRoots() child2.appendChildNode(&root3); root3.appendChildNode(&child4); - DummyRenderer ren1(&root1); - DummyRenderer ren2(&root3); + DummyRenderer ren1(&root1, renderContext); + DummyRenderer ren2(&root3, renderContext); child4.markDirty(QSGNode::DirtyGeometry); @@ -195,7 +203,7 @@ void NodesTest::opacityPropegation() QSGSimpleRectNode *geometry = new QSGSimpleRectNode; geometry->setRect(0, 0, 100, 100); - DummyRenderer renderer(&root); + DummyRenderer renderer(&root, renderContext); root.appendChildNode(a); a->appendChildNode(b); |