diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2018-02-15 12:44:27 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2018-02-15 20:59:03 +0000 |
commit | 6e82860f19bb28744c0d7f6ccc88ca89b187e3ce (patch) | |
tree | 1c8682d5bf06a0a03cefc3da5e3918056de78a04 /tests/auto/core | |
parent | 0bbccd492532786adc6816b992b85b4fdf162842 (diff) | |
parent | e1d1a59eb04f8b17582571275073a6cfa10e9e32 (diff) |
Merge remote-tracking branch 'origin/5.10' into 5.11
Conflicts:
src/animation/doc/src/qt3danimation-module.qdoc
src/render/backend/abstractrenderer_p.h
src/render/backend/buffervisitor_p.h
src/render/backend/renderer.cpp
src/render/backend/renderer_p.h
src/render/backend/triangleboundingvolume_p.h
src/render/backend/trianglesextractor_p.h
src/render/frontend/sphere_p.h
src/render/jobs/calcboundingvolumejob.cpp
src/render/jobs/job_common_p.h
src/render/jobs/pickboundingvolumejob.cpp
src/render/jobs/pickboundingvolumejob_p.h
src/render/jobs/pickboundingvolumeutils.cpp
src/render/jobs/renderviewjobutils_p.h
tests/auto/render/boundingsphere/tst_boundingsphere.cpp
tests/auto/render/commons/testrenderer.h
tests/auto/render/raycasting/tst_raycasting.cpp
tests/auto/render/render.pro
tests/auto/render/renderer/tst_renderer.cpp
Change-Id: I76633bc5a5a065e5f9ea62cc16563377e5c693a3
Diffstat (limited to 'tests/auto/core')
-rw-r--r-- | tests/auto/core/common/common.pri | 10 | ||||
-rw-r--r-- | tests/auto/core/matrix4x4_avx2/matrix4x4_avx2.pro | 2 | ||||
-rw-r--r-- | tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp | 3 | ||||
-rw-r--r-- | tests/auto/core/nodes/tst_nodes.cpp | 34 | ||||
-rw-r--r-- | tests/auto/core/vector3d_sse/tst_vector3d_sse.cpp | 13 | ||||
-rw-r--r-- | tests/auto/core/vector4d_sse/tst_vector4d_sse.cpp | 92 |
6 files changed, 142 insertions, 12 deletions
diff --git a/tests/auto/core/common/common.pri b/tests/auto/core/common/common.pri index 3a85df875..9b761b8e0 100644 --- a/tests/auto/core/common/common.pri +++ b/tests/auto/core/common/common.pri @@ -15,3 +15,13 @@ qtConfig(private_tests) { } QT += core-private 3dcore 3dcore-private + +qtConfig(qt3d-simd-avx2) { + CONFIG += simd + QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX2 +} + +qtConfig(qt3d-simd-sse2):!qtConfig(qt3d-simd-avx2) { + CONFIG += simd + QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE2 +} diff --git a/tests/auto/core/matrix4x4_avx2/matrix4x4_avx2.pro b/tests/auto/core/matrix4x4_avx2/matrix4x4_avx2.pro index 4a97ab2a9..4db8a1975 100644 --- a/tests/auto/core/matrix4x4_avx2/matrix4x4_avx2.pro +++ b/tests/auto/core/matrix4x4_avx2/matrix4x4_avx2.pro @@ -1,6 +1,6 @@ TARGET = tst_matrix4x4_avx2 CONFIG += testcase -QT += testlib 3dcore 3dcore-private +QT += testlib 3dcore 3dcore-private 3drender-private QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX2 diff --git a/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp b/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp index 41b0c535c..144df6711 100644 --- a/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp +++ b/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp @@ -28,12 +28,15 @@ #include <QtTest/QtTest> #include <Qt3DCore/private/matrix4x4_avx2_p.h> +#include <Qt3DRender/private/aligned_malloc_p.h> using namespace Qt3DCore; class tst_Matrix4x4_AVX2: public QObject { Q_OBJECT +public: + QT3D_ALIGNED_MALLOC_AND_FREE() private Q_SLOTS: diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp index 2e73e6c34..baf7010b0 100644 --- a/tests/auto/core/nodes/tst_nodes.cpp +++ b/tests/auto/core/nodes/tst_nodes.cpp @@ -1041,15 +1041,22 @@ void tst_Nodes::appendingParentlessComponentToEntity() // return early in such a case. // Check that we received ComponentAdded - for (const auto event: { entitySpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(), - componentSpy.events.takeLast().change().dynamicCast<Qt3DCore::QComponentAddedChange>() }) { + const auto event = entitySpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); QCOMPARE(event->type(), Qt3DCore::ComponentAdded); QCOMPARE(event->subjectId(), entity->id()); QCOMPARE(event->entityId(), entity->id()); QCOMPARE(event->componentId(), comp->id()); QCOMPARE(event->componentMetaObject(), comp->metaObject()); } + { + const auto event = componentSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); + QCOMPARE(event->type(), Qt3DCore::ComponentAdded); + QCOMPARE(event->subjectId(), comp->id()); + QCOMPARE(event->entityId(), entity->id()); + QCOMPARE(event->componentId(), comp->id()); + QCOMPARE(event->componentMetaObject(), comp->metaObject()); + } } } @@ -1080,15 +1087,22 @@ void tst_Nodes::appendingComponentToEntity() QVERIFY(comp->parentNode() == entity.data()); QCOMPARE(entitySpy.events.size(), 1); QVERIFY(entitySpy.events.first().wasLocked()); - for (const auto event: { entitySpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(), - componentSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>() }) { + const auto event = entitySpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); QCOMPARE(event->type(), Qt3DCore::ComponentAdded); QCOMPARE(event->subjectId(), entity->id()); QCOMPARE(event->entityId(), entity->id()); QCOMPARE(event->componentId(), comp->id()); QCOMPARE(event->componentMetaObject(), comp->metaObject()); } + { + const auto event = componentSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); + QCOMPARE(event->type(), Qt3DCore::ComponentAdded); + QCOMPARE(event->subjectId(), comp->id()); + QCOMPARE(event->entityId(), entity->id()); + QCOMPARE(event->componentId(), comp->id()); + QCOMPARE(event->componentMetaObject(), comp->metaObject()); + } } } @@ -1123,14 +1137,22 @@ void tst_Nodes::removingComponentFromEntity() QCOMPARE(entitySpy.events.size(), 1); QVERIFY(entitySpy.events.first().wasLocked()); QCOMPARE(componentSpy.events.size(), 1); - for (const auto event: { entitySpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentRemovedChange>(), - componentSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentRemovedChange>() }) { + { + const auto event = entitySpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentRemovedChange>(); QCOMPARE(event->type(), Qt3DCore::ComponentRemoved); QCOMPARE(event->subjectId(), entity->id()); QCOMPARE(event->entityId(), entity->id()); QCOMPARE(event->componentId(), comp->id()); QCOMPARE(event->componentMetaObject(), comp->metaObject()); } + { + const auto event = componentSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentRemovedChange>(); + QCOMPARE(event->type(), Qt3DCore::ComponentRemoved); + QCOMPARE(event->subjectId(), comp->id()); + QCOMPARE(event->entityId(), entity->id()); + QCOMPARE(event->componentId(), comp->id()); + QCOMPARE(event->componentMetaObject(), comp->metaObject()); + } } } diff --git a/tests/auto/core/vector3d_sse/tst_vector3d_sse.cpp b/tests/auto/core/vector3d_sse/tst_vector3d_sse.cpp index be9fbc347..7ea79a5f5 100644 --- a/tests/auto/core/vector3d_sse/tst_vector3d_sse.cpp +++ b/tests/auto/core/vector3d_sse/tst_vector3d_sse.cpp @@ -668,6 +668,14 @@ private Q_SLOTS: // THEN QVERIFY(v0 == v1); } + { + // GIVEN + Vector3D_SSE v0(6.0f, 6.0f, 6.0f); + Vector3D_SSE v1(6.0f, 6.0f, 6.0f); + + // THEN + QVERIFY(v0 == v1); + } } void checkInequality() @@ -787,11 +795,6 @@ private Q_SLOTS: } } - void checkNormalized() - { - - } - void checkIsNull() { { diff --git a/tests/auto/core/vector4d_sse/tst_vector4d_sse.cpp b/tests/auto/core/vector4d_sse/tst_vector4d_sse.cpp index e7b58c8cf..ed9722ffb 100644 --- a/tests/auto/core/vector4d_sse/tst_vector4d_sse.cpp +++ b/tests/auto/core/vector4d_sse/tst_vector4d_sse.cpp @@ -823,6 +823,98 @@ private Q_SLOTS: QCOMPARE(v0.w(), v1.w()); } } + + void checkLengthSquared() + { + { + // GIVEN + Vector4D_SSE v0(10.0f, 10.0f, 10.0f, 10.0f); + + // THEN + QCOMPARE(v0.lengthSquared(), 400.0f); + } + { + // GIVEN + Vector4D_SSE v0(3.0f, 1.0f, 2.0f, 4.0f); + + // THEN + QCOMPARE(v0.lengthSquared(), 30.0f); + } + } + + void checkLength() + { + { + // GIVEN + Vector4D_SSE v0(3.0f, 0.0f, 0.0f, 0.0f); + + // THEN + QCOMPARE(v0.length(), 3.0f); + } + { + // GIVEN + Vector4D_SSE v0(0.0f, 10.0f, 0.0f, 0.0f); + + // THEN + QCOMPARE(v0.length(), 10.0f); + } + { + // GIVEN + Vector4D_SSE v0(0.0f, 0.0f, 9.0f, 0.0f); + + // THEN + QCOMPARE(v0.length(), 9.0f); + } + { + // GIVEN + Vector4D_SSE v0(0.0f, 0.0f, 0.0f, 8.0f); + + // THEN + QCOMPARE(v0.length(), 8.0f); + } + } + + void checkNormalize() + { + { + // GIVEN + Vector4D_SSE v0(10.0f, 0.0f, 0.0f, 0.0f); + + // WHEN + v0.normalize(); + + // THEN + QCOMPARE(v0, Vector4D_SSE(1.0f, 0.0f, 0.0f, 0.0f)); + } + { + // GIVEN + Vector4D_SSE v0(0.0f, 0.0f, 3.0f, 0.0f); + + // WHEN + v0.normalize(); + + // THEN + QCOMPARE(v0, Vector4D_SSE(0.0, 0.0f, 1.0f, 0.0f)); + } + } + + void checkIsNull() + { + { + // GIVEN + Vector4D_SSE v0; + + // THEN + QVERIFY(v0.isNull()); + } + { + // GIVEN + Vector4D_SSE v0(1.0f, 1.0f, 1.0f, 1.0f); + + // THEN + QVERIFY(!v0.isNull()); + } + } }; QTEST_APPLESS_MAIN(tst_Vector4D_SSE) |