summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp180
-rw-r--r--tests/auto/render/loadscenejob/loadscenejob.pro12
-rw-r--r--tests/auto/render/loadscenejob/tst_loadscenejob.cpp287
-rw-r--r--tests/auto/render/qrendercapture/qrendercapture.pro11
-rw-r--r--tests/auto/render/qrendercapture/tst_qrendercapture.cpp113
-rw-r--r--tests/auto/render/render.pro5
-rw-r--r--tests/auto/render/renderviewutils/tst_renderviewutils.cpp46
-rw-r--r--tests/auto/render/uniform/tst_uniform.cpp292
-rw-r--r--tests/auto/render/uniform/uniform.pro13
-rw-r--r--tests/manual/bigscene-cpp/main.cpp2
-rw-r--r--tests/manual/deferred-renderer-cpp/main.cpp4
-rw-r--r--tests/manual/manual.pro7
-rw-r--r--tests/manual/multiplewindows-qml/Scene.qml152
-rw-r--r--tests/manual/multiplewindows-qml/main.cpp68
-rw-r--r--tests/manual/multiplewindows-qml/main.qml77
-rw-r--r--tests/manual/multiplewindows-qml/multiplewindows-qml.pro16
-rw-r--r--tests/manual/multiplewindows-qml/qml.qrc6
17 files changed, 1272 insertions, 19 deletions
diff --git a/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp b/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp
index ddd9eed22..fa1657732 100644
--- a/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp
+++ b/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp
@@ -286,13 +286,13 @@ private Q_SLOTS:
<< QVector3D(1.0f, 0.0f, 0.0f)
<< QVector3D(1.0f, 0.0f, 0.0f));
const auto texCoords = (QVector<QVector2D>()
- << QVector2D(0.0f, 0.0f)
- << QVector2D(0.0f, 1.0f)
- << QVector2D(1.0f, 0.0f));
+ << QVector2D(1.0f, 0.0f)
+ << QVector2D(1.0f, 1.0f)
+ << QVector2D(0.0f, 0.0f));
const auto tangents = (QVector<QVector4D>()
- << QVector4D(0.0f, 0.0f, 1.0f, -1.0f)
- << QVector4D(0.0f, 0.0f, 1.0f, -1.0f)
- << QVector4D(0.0f, 0.0f, 1.0f, -1.0f));
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f));
QTest::newRow("default_positiveX_firstTriangle")
<< 1.0f << 1.0f << 1.0f
<< QSize(2,2) << QSize(2,2) << QSize(2,2)
@@ -312,13 +312,13 @@ private Q_SLOTS:
<< QVector3D(-1.0f, 0.0f, 0.0f)
<< QVector3D(-1.0f, 0.0f, 0.0f));
const auto texCoords = (QVector<QVector2D>()
- << QVector2D(1.0f, 0.0f)
- << QVector2D(0.0f, 1.0f)
- << QVector2D(1.0f, 1.0f));
+ << QVector2D(0.0f, 0.0f)
+ << QVector2D(1.0f, 1.0f)
+ << QVector2D(0.0f, 1.0f));
const auto tangents = (QVector<QVector4D>()
- << QVector4D(0.0f, 0.0f, -1.0f, -1.0f)
- << QVector4D(0.0f, 0.0f, -1.0f, -1.0f)
- << QVector4D(0.0f, 0.0f, -1.0f, -1.0f));
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f));
QTest::newRow("default_negativeX_lastTriangle")
<< 1.0f << 1.0f << 1.0f
<< QSize(2,2) << QSize(2,2) << QSize(2,2)
@@ -429,6 +429,162 @@ private Q_SLOTS:
<< triangleIndex
<< indices << positions << normals << texCoords << tangents;
}
+
+ {
+ const int triangleIndex = 0;
+ const auto indices = (QVector<quint16>() << 0 << 1 << 2);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(1.0f, -1.5f, -2.5f)
+ << QVector3D(1.0f, 1.5f, -2.5f)
+ << QVector3D(1.0f, -1.5f, -1.25f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(1.0f, 0.0f, 0.0f)
+ << QVector3D(1.0f, 0.0f, 0.0f)
+ << QVector3D(1.0f, 0.0f, 0.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(1.0f, 0.0f)
+ << QVector2D(1.0f, 1.0f)
+ << QVector2D(0.75f, 0.0f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f));
+ QTest::newRow("default_positiveX_firstTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+
+ {
+ const int triangleIndex = 15;
+ const auto indices = (QVector<quint16>() << 18 << 17 << 19);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(-1.0f, -1.5f, -2.5f)
+ << QVector3D(-1.0f, 1.5f, -1.25f)
+ << QVector3D(-1.0f, 1.5f, -2.5f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(-1.0f, 0.0f, 0.0f)
+ << QVector3D(-1.0f, 0.0f, 0.0f)
+ << QVector3D(-1.0f, 0.0f, 0.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(0.0f, 0.0f)
+ << QVector2D(0.25f, 1.0f)
+ << QVector2D(0.0f, 1.0f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f));
+ QTest::newRow("default_negativeX_lastTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+
+ {
+ const int triangleIndex = 16;
+ const auto indices = (QVector<quint16>() << 20 << 21 << 22);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(-1.0f, 1.5f, 2.5f)
+ << QVector3D(1.0f, 1.5f, 2.5f)
+ << QVector3D(-1.0f, 1.5f, 1.875f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(0.0f, 1.0f, 0.0f)
+ << QVector3D(0.0f, 1.0f, 0.0f)
+ << QVector3D(0.0f, 1.0f, 0.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(0.0f, 0.0f)
+ << QVector2D(1.0f, 0.0f)
+ << QVector2D(0.0f, 0.125f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f));
+ QTest::newRow("default_positiveY_firstTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+
+ {
+ const int triangleIndex = 47;
+ const auto indices = (QVector<quint16>() << 54 << 53 << 55);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(-1.0f, -1.5f, 2.5f)
+ << QVector3D(1.0f, -1.5f, 1.875f)
+ << QVector3D(1.0f, -1.5f, 2.5f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(0.0f, -1.0f, 0.0f)
+ << QVector3D(0.0f, -1.0f, 0.0f)
+ << QVector3D(0.0f, -1.0f, 0.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(0.0f, 1.0f)
+ << QVector2D(1.0f, 0.875f)
+ << QVector2D(1.0f, 1.0f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f));
+ QTest::newRow("default_negativeY_lastTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+
+ {
+ const int triangleIndex = 48;
+ const auto indices = (QVector<quint16>() << 56 << 57 << 58);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(-1.0f, -1.5f, 2.5f)
+ << QVector3D(1.0f, -1.5f, 2.5f)
+ << QVector3D(-1.0f, 0.0f, 2.5f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(0.0f, 0.0f, 1.0f)
+ << QVector3D(0.0f, 0.0f, 1.0f)
+ << QVector3D(0.0f, 0.0f, 1.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(0.0f, 0.0f)
+ << QVector2D(1.0f, 0.0f)
+ << QVector2D(0.0f, 0.5f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f));
+ QTest::newRow("default_positiveZ_firstTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+
+ {
+ const int triangleIndex = 55;
+ const auto indices = (QVector<quint16>() << 66 << 65 << 67);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(1.0f, 1.5f, -2.5f)
+ << QVector3D(-1.0f, 0.0f, -2.5f)
+ << QVector3D(-1.0f, 1.5f, -2.5f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(0.0f, 0.0f, -1.0f)
+ << QVector3D(0.0f, 0.0f, -1.0f)
+ << QVector3D(0.0f, 0.0f, -1.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(0.0f, 1.0f)
+ << QVector2D(1.0f, 0.5f)
+ << QVector2D(1.0f, 1.0f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(-1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(-1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(-1.0f, 0.0f, 0.0f, 1.0f));
+ QTest::newRow("default_negativeZ_lastTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
}
void generatedGeometryShouldBeConsistent()
diff --git a/tests/auto/render/loadscenejob/loadscenejob.pro b/tests/auto/render/loadscenejob/loadscenejob.pro
new file mode 100644
index 000000000..3901c3545
--- /dev/null
+++ b/tests/auto/render/loadscenejob/loadscenejob.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_loadscenejob
+
+QT += 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_loadscenejob.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/render/loadscenejob/tst_loadscenejob.cpp b/tests/auto/render/loadscenejob/tst_loadscenejob.cpp
new file mode 100644
index 000000000..3428ecbea
--- /dev/null
+++ b/tests/auto/render/loadscenejob/tst_loadscenejob.cpp
@@ -0,0 +1,287 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
+** 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 <Qt3DRender/private/scene_p.h>
+#include <Qt3DRender/private/loadscenejob_p.h>
+#include <Qt3DRender/private/qsceneiohandler_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
+#include <Qt3DRender/private/scenemanager_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/QEntity>
+#include <Qt3DCore/private/qbackendnode_p.h>
+#include "testpostmanarbiter.h"
+
+class TestIOSceneHandler : public Qt3DRender::QSceneIOHandler
+{
+public:
+ explicit TestIOSceneHandler(bool supportsFormat, bool shouldFail)
+ : m_supportsFormat(supportsFormat)
+ , m_shouldFail(shouldFail)
+ {}
+
+ void setSource(const QUrl &source) Q_DECL_OVERRIDE
+ {
+ m_source = source;
+ }
+
+ bool isFileTypeSupported(const QUrl &) const Q_DECL_OVERRIDE
+ {
+ return m_supportsFormat;
+ }
+
+ Qt3DCore::QEntity *scene(const QString &) Q_DECL_OVERRIDE
+ {
+ return m_shouldFail ? nullptr : new Qt3DCore::QEntity();
+ }
+
+ Qt3DCore::QEntity *node(const QString &) Q_DECL_OVERRIDE
+ {
+ return m_shouldFail ? nullptr : new Qt3DCore::QEntity();
+ }
+
+ QUrl source() const
+ {
+ return m_source;
+ }
+
+private:
+ QUrl m_source;
+ bool m_supportsFormat;
+ bool m_shouldFail;
+};
+
+class tst_LoadSceneJob : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkInitialState()
+ {
+ // GIVEN
+ QUrl url;
+ Qt3DCore::QNodeId nodeId;
+ Qt3DRender::Render::LoadSceneJob backendLoadSceneJob(url, nodeId);
+
+ // THEN
+ QCOMPARE(backendLoadSceneJob.source(), url);
+ QCOMPARE(backendLoadSceneJob.sceneComponentId(), nodeId);
+ QVERIFY(backendLoadSceneJob.nodeManagers() == nullptr);
+ QCOMPARE(backendLoadSceneJob.sceneIOHandlers().size(), 0);
+ }
+
+ void checkInitialize()
+ {
+ // GIVEN
+ const QUrl url(QStringLiteral("URL"));
+ const Qt3DCore::QNodeId sceneId = Qt3DCore::QNodeId::createId();
+ Qt3DRender::Render::NodeManagers nodeManagers;
+ TestIOSceneHandler fakeHandler(true, true);
+
+ // WHEN
+ Qt3DRender::Render::LoadSceneJob backendLoadSceneJob(url, sceneId);
+ backendLoadSceneJob.setNodeManagers(&nodeManagers);
+ backendLoadSceneJob.setSceneIOHandlers(QList<Qt3DRender::QSceneIOHandler *>() << &fakeHandler);
+
+ // THEN
+ QCOMPARE(backendLoadSceneJob.source(), url);
+ QCOMPARE(backendLoadSceneJob.sceneComponentId(), sceneId);
+ QVERIFY(backendLoadSceneJob.nodeManagers() == &nodeManagers);
+ QCOMPARE(backendLoadSceneJob.sceneIOHandlers().size(), 1);
+ QCOMPARE(backendLoadSceneJob.sceneIOHandlers().first(), &fakeHandler);
+ }
+
+ void checkRunValidSourceSupportedFormat()
+ {
+ // GIVEN
+ const QUrl url(QStringLiteral("URL"));
+ TestArbiter arbiter;
+ Qt3DRender::Render::NodeManagers nodeManagers;
+ TestIOSceneHandler fakeHandler(true, false);
+ Qt3DCore::QNodeId sceneId = Qt3DCore::QNodeId::createId();
+ Qt3DRender::Render::Scene *scene = nodeManagers.sceneManager()->getOrCreateResource(sceneId);
+
+ // THEN
+ QVERIFY(scene != nullptr);
+ Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter);
+
+ // WHEN
+ Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId);
+ loadSceneJob.setNodeManagers(&nodeManagers);
+ loadSceneJob.setSceneIOHandlers(QList<Qt3DRender::QSceneIOHandler *>() << &fakeHandler);
+ loadSceneJob.run();
+
+ // THEN
+ QCOMPARE(arbiter.events.count(), 4);
+ auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None);
+
+ change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Loading);
+
+ change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "scene");
+ QVERIFY(change->value().value<Qt3DCore::QEntity *>() != nullptr);
+ delete change->value().value<Qt3DCore::QEntity *>();
+
+ change = arbiter.events.at(3).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Ready);
+ }
+
+ void checkEmptySource()
+ {
+ // GIVEN
+ QUrl url;
+ TestArbiter arbiter;
+ Qt3DRender::Render::NodeManagers nodeManagers;
+ TestIOSceneHandler fakeHandler(true, false);
+ Qt3DCore::QNodeId sceneId = Qt3DCore::QNodeId::createId();
+ Qt3DRender::Render::Scene *scene = nodeManagers.sceneManager()->getOrCreateResource(sceneId);
+
+ // THEN
+ QVERIFY(scene != nullptr);
+ Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter);
+
+ // WHEN
+ Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId);
+ loadSceneJob.setNodeManagers(&nodeManagers);
+ loadSceneJob.setSceneIOHandlers(QList<Qt3DRender::QSceneIOHandler *>() << &fakeHandler);
+ loadSceneJob.run();
+
+ // THEN
+ QCOMPARE(arbiter.events.count(), 3);
+ auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None);
+
+ change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "scene");
+ QVERIFY(change->value().value<Qt3DCore::QEntity *>() == nullptr);
+
+ change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None);
+ }
+
+ void checkRunValidSourceUnsupportedFormat()
+ {
+ // GIVEN
+ const QUrl url(QStringLiteral("URL"));
+ TestArbiter arbiter;
+ Qt3DRender::Render::NodeManagers nodeManagers;
+ TestIOSceneHandler fakeHandler(false, false);
+ Qt3DCore::QNodeId sceneId = Qt3DCore::QNodeId::createId();
+ Qt3DRender::Render::Scene *scene = nodeManagers.sceneManager()->getOrCreateResource(sceneId);
+
+ // THEN
+ QVERIFY(scene != nullptr);
+ Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter);
+
+ // WHEN
+ Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId);
+ loadSceneJob.setNodeManagers(&nodeManagers);
+ loadSceneJob.setSceneIOHandlers(QList<Qt3DRender::QSceneIOHandler *>() << &fakeHandler);
+ loadSceneJob.run();
+
+ // THEN
+ QCOMPARE(arbiter.events.count(), 3);
+ auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None);
+
+ change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "scene");
+ QVERIFY(change->value().value<Qt3DCore::QEntity *>() == nullptr);
+
+ change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Error);
+ }
+
+ void checkRunErrorAtLoading()
+ {
+ // GIVEN
+ const QUrl url(QStringLiteral("URL"));
+ TestArbiter arbiter;
+ Qt3DRender::Render::NodeManagers nodeManagers;
+ TestIOSceneHandler fakeHandler(true, true);
+ Qt3DCore::QNodeId sceneId = Qt3DCore::QNodeId::createId();
+ Qt3DRender::Render::Scene *scene = nodeManagers.sceneManager()->getOrCreateResource(sceneId);
+
+ // THEN
+ QVERIFY(scene != nullptr);
+ Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter);
+
+ // WHEN
+ Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId);
+ loadSceneJob.setNodeManagers(&nodeManagers);
+ loadSceneJob.setSceneIOHandlers(QList<Qt3DRender::QSceneIOHandler *>() << &fakeHandler);
+ loadSceneJob.run();
+
+ // THEN
+ QCOMPARE(arbiter.events.count(), 4);
+ auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None);
+
+ change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Loading);
+
+ change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "scene");
+ QVERIFY(change->value().value<Qt3DCore::QEntity *>() == nullptr);
+ delete change->value().value<Qt3DCore::QEntity *>();
+
+ change = arbiter.events.at(3).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Error);
+ }
+};
+
+QTEST_MAIN(tst_LoadSceneJob)
+
+#include "tst_loadscenejob.moc"
diff --git a/tests/auto/render/qrendercapture/qrendercapture.pro b/tests/auto/render/qrendercapture/qrendercapture.pro
new file mode 100644
index 000000000..999f95a58
--- /dev/null
+++ b/tests/auto/render/qrendercapture/qrendercapture.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+
+TARGET = tst_qrendercapture
+
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qrendercapture.cpp
+
+include(../commons/commons.pri)
diff --git a/tests/auto/render/qrendercapture/tst_qrendercapture.cpp b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp
new file mode 100644
index 000000000..ef1e9f53c
--- /dev/null
+++ b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** 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 <QtTest/QSignalSpy>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DRender/QRenderCapture>
+#include <Qt3DRender/private/qrendercapture_p.h>
+
+#include "testpostmanarbiter.h"
+
+class MyRenderCapture : public Qt3DRender::QRenderCapture
+{
+ Q_OBJECT
+public:
+ MyRenderCapture(Qt3DCore::QNode *parent = nullptr)
+ : Qt3DRender::QRenderCapture(parent)
+ {}
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_FINAL
+ {
+ Qt3DRender::QRenderCapture::sceneChangeEvent(change);
+ }
+
+private:
+ friend class tst_QRenderCapture;
+};
+
+class tst_QRenderCapture : public Qt3DCore::QNode
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkCaptureRequest()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ QScopedPointer<Qt3DRender::QRenderCapture> renderCapture(new Qt3DRender::QRenderCapture());
+ arbiter.setArbiterOnNode(renderCapture.data());
+
+ // WHEN
+ QScopedPointer<Qt3DRender::QRenderCaptureReply> reply(renderCapture->requestCapture(12));
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "renderCaptureRequest");
+ QCOMPARE(change->subjectId(),renderCapture->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ QCOMPARE(change->value().toInt(), 12);
+
+ arbiter.events.clear();
+ }
+
+ void checkRenderCaptureReply()
+ {
+ // GIVEN
+ QScopedPointer<MyRenderCapture> renderCapture(new MyRenderCapture());
+ QScopedPointer<Qt3DRender::QRenderCaptureReply> reply(renderCapture->requestCapture(52));
+ QImage img = QImage(20, 20, QImage::Format_ARGB32);
+
+ // WHEN
+ Qt3DRender::RenderCaptureDataPtr data = Qt3DRender::RenderCaptureDataPtr::create();
+ data.data()->captureId = 52;
+ data.data()->image = img;
+
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(renderCapture->id());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ e->setPropertyName("renderCaptureData");
+ e->setValue(QVariant::fromValue(data));
+
+ renderCapture->sceneChangeEvent(e);
+
+ // THEN
+ QCOMPARE(reply->isComplete(), true);
+ QCOMPARE(reply->captureId(), 52);
+ QCOMPARE(reply->image().width(), 20);
+ QCOMPARE(reply->image().height(), 20);
+ QCOMPARE(reply->image().format(), QImage::Format_ARGB32);
+ }
+};
+
+QTEST_MAIN(tst_QRenderCapture)
+
+#include "tst_qrendercapture.moc"
diff --git a/tests/auto/render/render.pro b/tests/auto/render/render.pro
index 36eda8afb..69080ea47 100644
--- a/tests/auto/render/render.pro
+++ b/tests/auto/render/render.pro
@@ -57,5 +57,8 @@ qtConfig(private_tests) {
qsceneloader \
qrendertargetoutput \
qcameralens \
- qcomputecommand
+ qcomputecommand \
+ loadscenejob \
+ qrendercapture \
+ uniform
}
diff --git a/tests/auto/render/renderviewutils/tst_renderviewutils.cpp b/tests/auto/render/renderviewutils/tst_renderviewutils.cpp
index df68a61d4..e4681a257 100644
--- a/tests/auto/render/renderviewutils/tst_renderviewutils.cpp
+++ b/tests/auto/render/renderviewutils/tst_renderviewutils.cpp
@@ -47,6 +47,7 @@ private Q_SLOTS:
void topLevelStructValue_data();
void topLevelStructValue();
void topLevelDynamicProperties();
+ void transformedProperties();
void shouldNotifyDynamicPropertyChanges();
private:
@@ -496,6 +497,51 @@ void tst_RenderViewUtils::topLevelDynamicProperties()
shaderData->property("array"));
}
+void tst_RenderViewUtils::transformedProperties()
+{
+ // GIVEN
+ QScopedPointer<Qt3DRender::QShaderData> shaderData(new Qt3DRender::QShaderData());
+ QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager());
+
+ // WHEN
+ const QVector3D position = QVector3D(15.0f, -5.0f, 10.0f);
+ QMatrix4x4 worldMatrix;
+ QMatrix4x4 viewMatrix;
+
+ worldMatrix.translate(-3.0f, 2.0f, 7.5f);
+ viewMatrix.translate(9.0f, 6.0f, 12.0f);
+
+ shaderData->setProperty("position0", position);
+ shaderData->setProperty("position1", position);
+ shaderData->setProperty("position2", position);
+ shaderData->setProperty("position3", position);
+ shaderData->setProperty("position1Transformed", Qt3DRender::Render::ShaderData::ModelToEye);
+ shaderData->setProperty("position2Transformed", Qt3DRender::Render::ShaderData::ModelToWorld);
+ shaderData->setProperty("position3Transformed", Qt3DRender::Render::ShaderData::ModelToWorldDirection);
+ initBackendShaderData(shaderData.data(), manager.data());
+
+ // THEN
+ Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id());
+ QVERIFY(backendShaderData != nullptr);
+ QCOMPARE(backendShaderData->propertyTransformType(QStringLiteral("position0")), Qt3DRender::Render::ShaderData::NoTransform);
+ QCOMPARE(backendShaderData->propertyTransformType(QStringLiteral("position1")), Qt3DRender::Render::ShaderData::ModelToEye);
+ QCOMPARE(backendShaderData->propertyTransformType(QStringLiteral("position2")), Qt3DRender::Render::ShaderData::ModelToWorld);
+ QCOMPARE(backendShaderData->propertyTransformType(QStringLiteral("position3")), Qt3DRender::Render::ShaderData::ModelToWorldDirection);
+
+ // WHEN
+ backendShaderData->updateWorldTransform(worldMatrix);
+ const QVector3D position1Value = backendShaderData->getTransformedProperty(QStringLiteral("position1"), viewMatrix).value<QVector3D>();
+ const QVector3D position2Value = backendShaderData->getTransformedProperty(QStringLiteral("position2"), viewMatrix).value<QVector3D>();
+ const QVector3D position3Value = backendShaderData->getTransformedProperty(QStringLiteral("position3"), viewMatrix).value<QVector3D>();
+ const QVariant position0Value = backendShaderData->getTransformedProperty(QStringLiteral("position0"), viewMatrix);
+
+ // THEN
+ QCOMPARE(position0Value, QVariant());
+ QCOMPARE(position1Value, viewMatrix * worldMatrix * position);
+ QCOMPARE(position2Value, worldMatrix * position);
+ QCOMPARE(position3Value, (worldMatrix * QVector4D(position, 0.0f)).toVector3D());
+}
+
void tst_RenderViewUtils::shouldNotifyDynamicPropertyChanges()
{
// GIVEN
diff --git a/tests/auto/render/uniform/tst_uniform.cpp b/tests/auto/render/uniform/tst_uniform.cpp
new file mode 100644
index 000000000..4a7f086e9
--- /dev/null
+++ b/tests/auto/render/uniform/tst_uniform.cpp
@@ -0,0 +1,292 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 <Qt3DRender/private/uniform_p.h>
+
+using namespace Qt3DRender;
+using namespace Qt3DRender::Render;
+
+class tst_Uniform : public QObject
+{
+ Q_OBJECT
+private Q_SLOTS:
+
+ void checkInitialState()
+ {
+ // GIVEN
+ UniformValue v;
+ // THEN
+ QVERIFY(v.constData<float>()[0] == 0.0f);
+ QVERIFY(v.constData<float>()[1] == 0.0f);
+ QVERIFY(v.constData<float>()[2] == 0.0f);
+ QVERIFY(v.constData<float>()[3] == 0.0f);
+ }
+
+ void checkDefaultCTors()
+ {
+ {
+ // GIVEN
+ UniformValue v(883);
+ // THEN
+ QCOMPARE(v.constData<int>()[0], 883);
+ QCOMPARE(v.constData<int>()[1], 0);
+ QCOMPARE(v.constData<int>()[2], 0);
+ QCOMPARE(v.constData<int>()[3], 0);
+ }
+ {
+ // GIVEN
+ UniformValue v(1584U);
+ // THEN
+ QCOMPARE(v.constData<uint>()[0], 1584U);
+ QCOMPARE(v.constData<uint>()[1], 0U);
+ QCOMPARE(v.constData<uint>()[2], 0U);
+ QCOMPARE(v.constData<uint>()[3], 0U);
+ }
+ {
+ // GIVEN
+ UniformValue v(454.0f);
+ // THEN
+ QCOMPARE(v.constData<float>()[0], 454.0f);
+ QCOMPARE(v.constData<float>()[1], 0.0f);
+ QCOMPARE(v.constData<float>()[2], 0.0f);
+ QCOMPARE(v.constData<float>()[3], 0.0f);
+ }
+ {
+ // GIVEN
+ UniformValue v(350.0);
+ // THEN
+ // Note: Uniform value does a double -> float conversion
+ QCOMPARE(v.constData<float>()[0], 350.0f);
+ QCOMPARE(v.constData<float>()[1], 0.0f);
+ QCOMPARE(v.constData<float>()[2], 0.0f);
+ QCOMPARE(v.constData<float>()[3], 0.0f);
+ }
+ {
+ // GIVEN
+ UniformValue v(true);
+ // THEN
+ QCOMPARE(v.constData<bool>()[0], true);
+ QCOMPARE(v.constData<bool>()[1], false);
+ QCOMPARE(v.constData<bool>()[2], false);
+ QCOMPARE(v.constData<bool>()[3], false);
+ }
+ {
+ // GIVEN
+ UniformValue v(QVector2D(355.0f, 383.0f));
+ // THEN
+ QCOMPARE(v.constData<float>()[0], 355.0f);
+ QCOMPARE(v.constData<float>()[1], 383.0f);
+ QCOMPARE(v.constData<float>()[2], 0.0f);
+ QCOMPARE(v.constData<float>()[3], 0.0f);
+ }
+ {
+ // GIVEN
+ UniformValue v(QVector3D(572.0f, 355.0f, 383.0f));
+ // THEN
+ QCOMPARE(v.constData<float>()[0], 572.0f);
+ QCOMPARE(v.constData<float>()[1], 355.0f);
+ QCOMPARE(v.constData<float>()[2], 383.0f);
+ QCOMPARE(v.constData<float>()[4], 0.0f);
+ }
+ {
+ // GIVEN
+ UniformValue v(QVector4D(355.0f, 383.0f, 1340.0f, 1603.0f));
+ // THEN
+ QCOMPARE(v.constData<float>()[0], 355.0f);
+ QCOMPARE(v.constData<float>()[1], 383.0f);
+ QCOMPARE(v.constData<float>()[2], 1340.0f);
+ QCOMPARE(v.constData<float>()[3], 1603.0f);
+ }
+ }
+
+ void checkFromVariant()
+ {
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant(883));
+ // THEN
+ QCOMPARE(v.constData<int>()[0], 883);
+ QCOMPARE(v.constData<int>()[1], 0);
+ QCOMPARE(v.constData<int>()[2], 0);
+ QCOMPARE(v.constData<int>()[3], 0);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant(1584U));
+ // THEN
+ QCOMPARE(v.constData<uint>()[0], 1584U);
+ QCOMPARE(v.constData<uint>()[1], 0U);
+ QCOMPARE(v.constData<uint>()[2], 0U);
+ QCOMPARE(v.constData<uint>()[3], 0U);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant(454.0f));
+ // THEN
+ QCOMPARE(v.constData<float>()[0], 454.0f);
+ QCOMPARE(v.constData<float>()[1], 0.0f);
+ QCOMPARE(v.constData<float>()[2], 0.0f);
+ QCOMPARE(v.constData<float>()[3], 0.0f);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant(350.0));
+ // THEN
+ // Note: Uniform value does a double -> float conversion
+ QCOMPARE(v.constData<float>()[0], 350.0f);
+ QCOMPARE(v.constData<float>()[1], 0.0f);
+ QCOMPARE(v.constData<float>()[2], 0.0f);
+ QCOMPARE(v.constData<float>()[3], 0.0f);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant(true));
+ // THEN
+ QCOMPARE(v.constData<bool>()[0], true);
+ QCOMPARE(v.constData<bool>()[1], false);
+ QCOMPARE(v.constData<bool>()[2], false);
+ QCOMPARE(v.constData<bool>()[3], false);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QVector2D(355.0f, 383.0f)));
+ // THEN
+ QCOMPARE(v.constData<float>()[0], 355.0f);
+ QCOMPARE(v.constData<float>()[1], 383.0f);
+ QCOMPARE(v.constData<float>()[2], 0.0f);
+ QCOMPARE(v.constData<float>()[3], 0.0f);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QVector3D(572.0f, 355.0f, 383.0f)));
+ // THEN
+ QCOMPARE(v.constData<float>()[0], 572.0f);
+ QCOMPARE(v.constData<float>()[1], 355.0f);
+ QCOMPARE(v.constData<float>()[2], 383.0f);
+ QCOMPARE(v.constData<float>()[3], 0.0f);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QVector4D(355.0f, 383.0f, 1340.0f, 1603.0f)));
+ // THEN
+ QCOMPARE(v.constData<float>()[0], 355.0f);
+ QCOMPARE(v.constData<float>()[1], 383.0f);
+ QCOMPARE(v.constData<float>()[2], 1340.0f);
+ QCOMPARE(v.constData<float>()[3], 1603.0f);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QPoint(427, 396)));
+ // THEN
+ QCOMPARE(v.constData<int>()[0], 427);
+ QCOMPARE(v.constData<int>()[1], 396);
+ QCOMPARE(v.constData<int>()[2], 0);
+ QCOMPARE(v.constData<int>()[3], 0);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QSize(427, 396)));
+ // THEN
+ QCOMPARE(v.constData<int>()[0], 427);
+ QCOMPARE(v.constData<int>()[1], 396);
+ QCOMPARE(v.constData<int>()[2], 0);
+ QCOMPARE(v.constData<int>()[3], 0);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QRect(427, 396, 454, 1584)));
+ // THEN
+ QCOMPARE(v.constData<int>()[0], 427);
+ QCOMPARE(v.constData<int>()[1], 396);
+ QCOMPARE(v.constData<int>()[2], 454);
+ QCOMPARE(v.constData<int>()[3], 1584);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QPointF(427, 396)));
+ // THEN
+ QCOMPARE(v.constData<float>()[0], 427.0f);
+ QCOMPARE(v.constData<float>()[1], 396.0f);
+ QCOMPARE(v.constData<float>()[2], 0.0f);
+ QCOMPARE(v.constData<float>()[3], 0.0f);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QSizeF(427, 396)));
+ // THEN
+ QCOMPARE(v.constData<float>()[0], 427.0f);
+ QCOMPARE(v.constData<float>()[1], 396.0f);
+ QCOMPARE(v.constData<float>()[2], 0.0f);
+ QCOMPARE(v.constData<float>()[3], 0.0f);
+ }
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QRectF(427, 396, 454, 1584)));
+ // THEN
+ QCOMPARE(v.constData<float>()[0], 427.0f);
+ QCOMPARE(v.constData<float>()[1], 396.0f);
+ QCOMPARE(v.constData<float>()[2], 454.0f);
+ QCOMPARE(v.constData<float>()[3], 1584.0f);
+ }
+ }
+
+ void checkComparison()
+ {
+ // GIVEN
+ const UniformValue v1(QVector3D(454.0f, 883.0f, 572.0f));
+ UniformValue v2(454.0f);
+
+ // THEN
+ QVERIFY(!(v1 == v2));
+ QVERIFY(v1 != v2);
+
+ // WHEN
+ v2 = UniformValue::fromVariant(QVector3D(454.0f, 883.0f, 572.0f));
+ // THEN
+ QVERIFY(v1 == v2);
+ QVERIFY(!(v1 != v2));
+
+ // WHEN
+ v2 = UniformValue::fromVariant(QVector3D(454.0f, 883.0f, 572.0f));
+ // THEN
+ QVERIFY(v1 == v2);
+ QVERIFY(!(v1 != v2));
+
+ // WHEN
+ v2 = UniformValue::fromVariant(454.0f);
+ // THEN
+ QVERIFY(!(v1 == v2));
+ QVERIFY(v1 != v2);
+ }
+};
+
+
+QTEST_APPLESS_MAIN(tst_Uniform)
+
+#include "tst_uniform.moc"
diff --git a/tests/auto/render/uniform/uniform.pro b/tests/auto/render/uniform/uniform.pro
new file mode 100644
index 000000000..44dd0266a
--- /dev/null
+++ b/tests/auto/render/uniform/uniform.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+
+TARGET = tst_uniform
+
+QT += 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += \
+ tst_uniform.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/manual/bigscene-cpp/main.cpp b/tests/manual/bigscene-cpp/main.cpp
index ebbd499f3..791aeb19d 100644
--- a/tests/manual/bigscene-cpp/main.cpp
+++ b/tests/manual/bigscene-cpp/main.cpp
@@ -61,7 +61,7 @@
#include <Qt3DCore/qaspectengine.h>
#include <Qt3DInput/QInputAspect>
#include <Qt3DRender/QParameter>
-#include <Qt3DExtras//QCylinderMesh>
+#include <Qt3DExtras/QCylinderMesh>
#include <Qt3DRender/QRenderAspect>
#include <Qt3DRender/QCameraSelector>
#include <Qt3DExtras/QPhongMaterial>
diff --git a/tests/manual/deferred-renderer-cpp/main.cpp b/tests/manual/deferred-renderer-cpp/main.cpp
index baafb4796..47425e7ee 100644
--- a/tests/manual/deferred-renderer-cpp/main.cpp
+++ b/tests/manual/deferred-renderer-cpp/main.cpp
@@ -51,8 +51,8 @@
#include <Qt3DCore/QEntity>
#include <Qt3DRender/QMaterial>
-#include <Qt3DExtras//QSphereMesh>
-#include <Qt3DExtras//QPlaneMesh>
+#include <Qt3DExtras/QSphereMesh>
+#include <Qt3DExtras/QPlaneMesh>
#include <Qt3DRender/QLayer>
#include <Qt3DRender/QParameter>
#include <Qt3DRender/QCamera>
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 6aa706023..5b17f18a2 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -9,6 +9,8 @@ SUBDIRS += \
component-changes \
custom-mesh-cpp \
custom-mesh-qml \
+ custom-mesh-update-data-cpp \
+ custom-mesh-update-data-qml \
cylinder-cpp \
cylinder-qml \
deferred-renderer-cpp \
@@ -20,6 +22,7 @@ SUBDIRS += \
keyboardinput-qml \
loader-qml \
mouseinput-qml \
+ multiplewindows-qml \
picking-qml \
plasma \
scene3d-loader \
@@ -28,9 +31,7 @@ SUBDIRS += \
tessellation-modes \
transforms-qml \
transparency-qml \
- transparency-qml-scene3d \
- custom-mesh-update-data-cpp \
- custom-mesh-update-data-qml
+ transparency-qml-scene3d
qtHaveModule(widgets): {
SUBDIRS += \
diff --git a/tests/manual/multiplewindows-qml/Scene.qml b/tests/manual/multiplewindows-qml/Scene.qml
new file mode 100644
index 000000000..06107667d
--- /dev/null
+++ b/tests/manual/multiplewindows-qml/Scene.qml
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: sceneRoot
+
+ property alias view1: renderer.window
+ property alias view2: renderer2.window
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, -40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ OrbitCameraController {
+ camera: camera
+ }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: TechniqueFilter {
+ ForwardRenderer {
+ id: renderer
+ clearColor: Qt.rgba(0, 0.5, 1, 1)
+ camera: camera
+ }
+ ForwardRenderer {
+ id: renderer2
+ clearColor: Qt.rgba(0, 0.5, 1, 1)
+ camera: camera
+ }
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ PhongMaterial {
+ id: material
+ }
+
+ TorusMesh {
+ id: torusMesh
+ radius: 5
+ minorRadius: 1
+ rings: 100
+ slices: 20
+ }
+
+ Transform {
+ id: torusTransform
+ scale3D: Qt.vector3d(1.5, 1, 0.5)
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
+ }
+
+ Entity {
+ id: torusEntity
+ components: [ torusMesh, material, torusTransform ]
+ }
+
+ SphereMesh {
+ id: sphereMesh
+ radius: 3
+ }
+
+ Transform {
+ id: sphereTransform
+ property real userAngle: 0.0
+ matrix: {
+ var m = Qt.matrix4x4();
+ m.rotate(userAngle, Qt.vector3d(0, 1, 0));
+ m.translate(Qt.vector3d(20, 0, 0));
+ return m;
+ }
+ }
+
+ QQ2.NumberAnimation {
+ target: sphereTransform
+ property: "userAngle"
+ duration: 10000
+ from: 0
+ to: 360
+
+ loops: QQ2.Animation.Infinite
+ running: true
+ }
+
+ Entity {
+ id: sphereEntity
+ components: [ sphereMesh, material, sphereTransform ]
+ }
+}
diff --git a/tests/manual/multiplewindows-qml/main.cpp b/tests/manual/multiplewindows-qml/main.cpp
new file mode 100644
index 000000000..3b9480828
--- /dev/null
+++ b/tests/manual/multiplewindows-qml/main.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <Qt3DQuick/QQmlAspectEngine>
+#include <QQmlEngine>
+#include <QQmlContext>
+#include <QGuiApplication>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+ view.setWidth(600);
+ view.setHeight(600);
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_view", &view);
+ view.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/multiplewindows-qml/main.qml b/tests/manual/multiplewindows-qml/main.qml
new file mode 100644
index 000000000..4c6c4b740
--- /dev/null
+++ b/tests/manual/multiplewindows-qml/main.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Window 2.2 as QQW
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+import QtQuick.Scene3D 2.0
+
+Entity {
+ id: rootItem
+
+ QQW.Window {
+ id: window2
+ title: "window2"
+ visible: true
+ width: 600
+ height: 600
+ }
+
+ Scene {
+ id: scene
+ view1: _view
+ view2: window2
+ Component.onCompleted: scene.view1 = _view
+ }
+}
diff --git a/tests/manual/multiplewindows-qml/multiplewindows-qml.pro b/tests/manual/multiplewindows-qml/multiplewindows-qml.pro
new file mode 100644
index 000000000..1b899fc8f
--- /dev/null
+++ b/tests/manual/multiplewindows-qml/multiplewindows-qml.pro
@@ -0,0 +1,16 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+TEMPLATE = app
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
+
+CONFIG += c++11
+
+SOURCES += main.cpp
+
+RESOURCES += qml.qrc
+
+DISTFILES += \
+ Scene.qml
diff --git a/tests/manual/multiplewindows-qml/qml.qrc b/tests/manual/multiplewindows-qml/qml.qrc
new file mode 100644
index 000000000..72868031a
--- /dev/null
+++ b/tests/manual/multiplewindows-qml/qml.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>Scene.qml</file>
+ </qresource>
+</RCC>