summaryrefslogtreecommitdiffstats
path: root/tests/auto/core
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-24 03:04:10 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-24 03:04:10 +0200
commitf74a1c905764e27dbce4966e430c45f46be08e64 (patch)
tree90741503d55e9dbaf46367ee9cf0be3b3456132d /tests/auto/core
parente1772c0a015ffac562b64e2c958a09d0ca074cd1 (diff)
parent29541954dc1ab128295487f25067876d9967b2f9 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'tests/auto/core')
-rw-r--r--tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp49
-rw-r--r--tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp49
2 files changed, 98 insertions, 0 deletions
diff --git a/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp b/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp
index 144df6711..12eaab263 100644
--- a/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp
+++ b/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp
@@ -474,6 +474,55 @@ private Q_SLOTS:
QCOMPARE(row.w(), 44.0f);
}
}
+
+ void checkVectorMapVector()
+ {
+ {
+ // GIVEN
+ QMatrix4x4 tmpMat;
+ QVector3D tmpVec3(1.0f, 0.0f, 0.0f);
+ tmpMat.rotate(90.f, 0.f, 1.f, 0.f);
+
+ Matrix4x4_AVX2 mat(tmpMat);
+ Vector3D vec3(tmpVec3);
+
+ // WHEN
+ const Vector3D resultingVec = mat.mapVector(vec3);
+
+ // THEN
+ QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3));
+ }
+ {
+ // GIVEN
+ QMatrix4x4 tmpMat;
+ QVector3D tmpVec3(0.0f, 0.0f, -1.0f);
+ tmpMat.rotate(90.f, 0.f, 1.f, 0.f);
+
+ Matrix4x4_AVX2 mat(tmpMat);
+ Vector3D vec3(tmpVec3);
+
+ // WHEN
+ const Vector3D resultingVec = mat.mapVector(vec3);
+
+ // THEN
+ QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3));
+ }
+ {
+ // GIVEN
+ QMatrix4x4 tmpMat;
+ QVector3D tmpVec3(3.0f, -3.0f, -1.0f);
+ tmpMat.rotate(90.f, 0.33f, 0.33f, 0.33f);
+
+ Matrix4x4_AVX2 mat(tmpMat);
+ Vector3D vec3(tmpVec3);
+
+ // WHEN
+ const Vector3D resultingVec = mat.mapVector(vec3);
+
+ // THEN
+ QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3));
+ }
+ }
};
QTEST_MAIN(tst_Matrix4x4_AVX2)
diff --git a/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp b/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp
index bbd6596d4..dccf90d10 100644
--- a/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp
+++ b/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp
@@ -471,6 +471,55 @@ private Q_SLOTS:
QCOMPARE(row.w(), 44.0f);
}
}
+
+ void checkVectorMapVector()
+ {
+ {
+ // GIVEN
+ QMatrix4x4 tmpMat;
+ QVector3D tmpVec3(1.0f, 0.0f, 0.0f);
+ tmpMat.rotate(90.f, 0.f, 1.f, 0.f);
+
+ Matrix4x4_SSE mat(tmpMat);
+ Vector3D vec3(tmpVec3);
+
+ // WHEN
+ const Vector3D resultingVec = mat.mapVector(vec3);
+
+ // THEN
+ QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3));
+ }
+ {
+ // GIVEN
+ QMatrix4x4 tmpMat;
+ QVector3D tmpVec3(0.0f, 0.0f, -1.0f);
+ tmpMat.rotate(90.f, 0.f, 1.f, 0.f);
+
+ Matrix4x4_SSE mat(tmpMat);
+ Vector3D vec3(tmpVec3);
+
+ // WHEN
+ const Vector3D resultingVec = mat.mapVector(vec3);
+
+ // THEN
+ QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3));
+ }
+ {
+ // GIVEN
+ QMatrix4x4 tmpMat;
+ QVector3D tmpVec3(3.0f, -3.0f, -1.0f);
+ tmpMat.rotate(90.f, 0.33f, 0.33f, 0.33f);
+
+ Matrix4x4_SSE mat(tmpMat);
+ Vector3D vec3(tmpVec3);
+
+ // WHEN
+ const Vector3D resultingVec = mat.mapVector(vec3);
+
+ // THEN
+ QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3));
+ }
+ }
};
QTEST_MAIN(tst_Matrix4x4_SSE)