summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWieland Hagen <wieland.hagen@kdab.com>2016-02-17 17:53:42 +0100
committerSean Harmer <sean.harmer@kdab.com>2016-03-09 13:19:39 +0000
commitc042228267dc4bb05ee3e6d53074c7218d1e7054 (patch)
treeaacbe10f48912e9324526e64d722377143d542cc /tests
parent807a25d74550faf42ed79dfe234b5f1ce3380cf4 (diff)
Drop QFrameGraph in favor of QRenderSettings
QFrameGraph did store just the Frame Graph Root, and was not configurable at runtime. This functionality has been moved to QRenderSettings. The renderer now gets the scene graph root directly from QRenderSettings. Change-Id: I3012eb96b8073717f96f5e42374859a3f4a89bfc Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/render/commons/testrenderer.h1
-rw-r--r--tests/auto/render/qframegraph/qframegraph.pro10
-rw-r--r--tests/auto/render/qframegraph/tst_qframegraph.cpp184
-rw-r--r--tests/auto/render/render.pro1
-rw-r--r--tests/benchmarks/render/jobs/tst_bench_jobs.cpp9
5 files changed, 4 insertions, 201 deletions
diff --git a/tests/auto/render/commons/testrenderer.h b/tests/auto/render/commons/testrenderer.h
index 977b915e1..bad8c3e3a 100644
--- a/tests/auto/render/commons/testrenderer.h
+++ b/tests/auto/render/commons/testrenderer.h
@@ -58,7 +58,6 @@ public:
void skipNextFrame() Q_DECL_OVERRIDE {}
QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() Q_DECL_OVERRIDE { return QVector<Qt3DCore::QAspectJobPtr>(); }
Qt3DCore::QAspectJobPtr pickBoundingVolumeJob() Q_DECL_OVERRIDE { return Qt3DCore::QAspectJobPtr(); }
- void setFrameGraphRoot(const Qt3DCore::QNodeId fgRootId) Q_DECL_OVERRIDE { Q_UNUSED(fgRootId); }
void setSceneRoot(Qt3DCore::QBackendNodeFactory *factory, Qt3DRender::Render::Entity *root) Q_DECL_OVERRIDE { Q_UNUSED(factory); Q_UNUSED(root); }
Qt3DRender::Render::Entity *sceneRoot() const Q_DECL_OVERRIDE { return Q_NULLPTR; }
Qt3DRender::Render::FrameGraphNode *frameGraphRoot() const Q_DECL_OVERRIDE { return Q_NULLPTR; }
diff --git a/tests/auto/render/qframegraph/qframegraph.pro b/tests/auto/render/qframegraph/qframegraph.pro
deleted file mode 100644
index 4f782fcd1..000000000
--- a/tests/auto/render/qframegraph/qframegraph.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = app
-
-TARGET = tst_qframegraph
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
-
-CONFIG += testcase
-
-SOURCES += tst_qframegraph.cpp
-
-include(../commons/commons.pri)
diff --git a/tests/auto/render/qframegraph/tst_qframegraph.cpp b/tests/auto/render/qframegraph/tst_qframegraph.cpp
deleted file mode 100644
index afd7ee471..000000000
--- a/tests/auto/render/qframegraph/tst_qframegraph.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QTest>
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qentity.h>
-
-#include <Qt3DRender/qframegraphnode.h>
-#include <Qt3DRender/qframegraph.h>
-
-#include "testpostmanarbiter.h"
-
-class MyFrameGraphNode : public Qt3DRender::QFrameGraphNode
-{
- Q_OBJECT
-public:
- explicit MyFrameGraphNode(Qt3DCore::QNode *parent = Q_NULLPTR)
- : QFrameGraphNode(parent)
- {
- }
-
- ~MyFrameGraphNode()
- {
- QNode::cleanup();
- }
-
-private:
- QT3D_CLONEABLE(MyFrameGraphNode)
-};
-
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QFrameGraph: public Qt3DCore::QNode
-{
- Q_OBJECT
-public:
- ~tst_QFrameGraph()
- {
- QNode::cleanup();
- }
-
-private Q_SLOTS:
-
- void checkSaneDefaults()
- {
- QScopedPointer<Qt3DRender::QFrameGraph> defaultFrameGraph(new Qt3DRender::QFrameGraph);
-
- QVERIFY(defaultFrameGraph->activeFrameGraph() == Q_NULLPTR);
- }
-
- void checkCloning_data()
- {
- QTest::addColumn<Qt3DRender::QFrameGraph *>("frameGraph");
- QTest::addColumn<Qt3DRender::QFrameGraphNode *>("frameGraphTree");
-
- Qt3DRender::QFrameGraph *defaultConstructed = new Qt3DRender::QFrameGraph();
- QTest::newRow("defaultConstructed") << defaultConstructed << static_cast<Qt3DRender::QFrameGraphNode *>(Q_NULLPTR);
-
- Qt3DRender::QFrameGraph *frameGraphWithActiveNode = new Qt3DRender::QFrameGraph();
- Qt3DRender::QFrameGraphNode *frameGraphTree = new MyFrameGraphNode();
- frameGraphWithActiveNode->setActiveFrameGraph(frameGraphTree);
- QTest::newRow("frameGraphWithActiveTree") << frameGraphWithActiveNode << frameGraphTree;
- }
-
- void checkCloning()
- {
- // GIVEN
- QFETCH(Qt3DRender::QFrameGraph*, frameGraph);
- QFETCH(Qt3DRender::QFrameGraphNode *, frameGraphTree);
-
- // THEN
- QVERIFY(frameGraph->activeFrameGraph() == frameGraphTree);
-
- // WHEN
- Qt3DRender::QFrameGraph *clone = static_cast<Qt3DRender::QFrameGraph *>(QNode::clone(frameGraph));
-
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(frameGraph->id(), clone->id());
-
- if (frameGraph->activeFrameGraph() != Q_NULLPTR) {
- QVERIFY(frameGraph->activeFrameGraph()->parent() == frameGraph);
- QVERIFY(clone->activeFrameGraph() != Q_NULLPTR);
- QCOMPARE(clone->activeFrameGraph()->id(), frameGraph->activeFrameGraph()->id());
- QVERIFY(clone->activeFrameGraph()->parent() == clone);
- }
-
- delete frameGraph;
- delete clone;
- }
-
- void checkPropertyUpdates()
- {
- // GIVEN
- QScopedPointer<Qt3DRender::QFrameGraph> frameGraph(new Qt3DRender::QFrameGraph());
- TestArbiter arbiter(frameGraph.data());
-
- // WHEN
- MyFrameGraphNode *activeFrameGraph1 = new MyFrameGraphNode();
- frameGraph->setActiveFrameGraph(activeFrameGraph1);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "activeFrameGraph");
- QCOMPARE(change->subjectId(), frameGraph->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), activeFrameGraph1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- frameGraph->setActiveFrameGraph(activeFrameGraph1);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 0);
-
- // WHEN
- MyFrameGraphNode *activeFrameGraph2 = new MyFrameGraphNode();
- frameGraph->setActiveFrameGraph(activeFrameGraph2);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "activeFrameGraph");
- QCOMPARE(change->subjectId(), frameGraph->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), activeFrameGraph2->id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- frameGraph->setActiveFrameGraph(Q_NULLPTR);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "activeFrameGraph");
- QCOMPARE(change->subjectId(), frameGraph->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), Qt3DCore::QNodeId());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
- }
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
-};
-
-QTEST_MAIN(tst_QFrameGraph)
-
-#include "tst_qframegraph.moc"
diff --git a/tests/auto/render/render.pro b/tests/auto/render/render.pro
index 0f4ba3035..e78b98d50 100644
--- a/tests/auto/render/render.pro
+++ b/tests/auto/render/render.pro
@@ -25,7 +25,6 @@ contains(QT_CONFIG, private_tests) {
qcameraselector \
qclearbuffer \
qframegraphnode \
- qframegraph \
qlayerfilter \
qlight \
qray3d \
diff --git a/tests/benchmarks/render/jobs/tst_bench_jobs.cpp b/tests/benchmarks/render/jobs/tst_bench_jobs.cpp
index 3c85752b3..305cd8094 100644
--- a/tests/benchmarks/render/jobs/tst_bench_jobs.cpp
+++ b/tests/benchmarks/render/jobs/tst_bench_jobs.cpp
@@ -31,10 +31,10 @@
#include <Qt3DCore/QEntity>
#include <Qt3DCore/QTransform>
#include <Qt3DRender/QMaterial>
-#include <Qt3DRender/QFrameGraph>
#include <Qt3DRender/QForwardRenderer>
#include <Qt3DRender/QPhongMaterial>
#include <Qt3DRender/QCylinderMesh>
+#include <Qt3DRender/QRenderSettings>
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DCore/private/qresourcemanager_p.h>
@@ -164,13 +164,12 @@ Qt3DCore::QEntity *buildBigScene()
cameraEntity->setViewCenter(QVector3D(0, 0, 0));
// FrameGraph
- Qt3DRender::QFrameGraph *frameGraph = new Qt3DRender::QFrameGraph();
+ Qt3DRender::QRenderSettings* renderSettings = new Qt3DRender::QRenderSettings();
Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
forwardRenderer->setCamera(cameraEntity);
forwardRenderer->setClearColor(Qt::black);
- frameGraph->setActiveFrameGraph(forwardRenderer);
- root->addComponent(frameGraph);
-
+ renderSettings->setActiveFrameGraph(forwardRenderer);
+ root->addComponent(renderSettings);
const float radius = 100.0f;
const int max = 1000;