diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-09-30 10:47:48 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-09-30 17:04:45 +0100 |
commit | 9c951154256734b36328142e1078382dc2d7ae01 (patch) | |
tree | 60bf432a557511b0a08b2f2dfff8276065e59150 /tests/auto/render/meshfunctors/tst_meshfunctors.cpp | |
parent | 205ba7689c3c6c547543cf4d5d7ec968cce9a7a5 (diff) | |
parent | aee10edf33ccb1faf3179b23b44a2ad48bf4d0f0 (diff) |
Merge branch '5.9' into 5.10
Conflicts:
src/animation/backend/animationutils.cpp
src/animation/backend/animationutils_p.h
src/render/geometry/qmesh.cpp
tests/auto/animation/animation.pro
Change-Id: Ifb57bfb0b12b3ebf9ee177d4ea684134455b4143
Diffstat (limited to 'tests/auto/render/meshfunctors/tst_meshfunctors.cpp')
-rw-r--r-- | tests/auto/render/meshfunctors/tst_meshfunctors.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/tests/auto/render/meshfunctors/tst_meshfunctors.cpp b/tests/auto/render/meshfunctors/tst_meshfunctors.cpp index bf5f0d55f..fd430c5d8 100644 --- a/tests/auto/render/meshfunctors/tst_meshfunctors.cpp +++ b/tests/auto/render/meshfunctors/tst_meshfunctors.cpp @@ -27,8 +27,12 @@ ****************************************************************************/ #include <QtTest/QtTest> +#include <Qt3DCore/qcomponent.h> #include <Qt3DRender/qgeometryfactory.h> #include <Qt3DRender/qgeometry.h> +#include <Qt3DRender/qmesh.h> +#include <Qt3DRender/private/qmesh_p.h> +#include <Qt3DCore/qaspectengine.h> class MeshFunctorA : public Qt3DRender::QGeometryFactory { @@ -117,8 +121,46 @@ private Q_SLOTS: QVERIFY(*functorB == *functorB); QVERIFY(*functorASub == *functorASub); } + + void checkMeshFunctorEquality() + { + // GIVEN + Qt3DCore::QAspectEngine engine; + auto meshA = new Qt3DRender::QMesh(); + meshA->setSource(QUrl::fromLocalFile(QLatin1String("/foo"))); + meshA->setMeshName(QLatin1String("bar")); + + auto meshB = new Qt3DRender::QMesh(); + meshB->setSource(QUrl::fromLocalFile(QLatin1String("/foo"))); + meshB->setMeshName(QLatin1String("baz")); + + auto meshC = new Qt3DRender::QMesh(); + meshC->setSource(QUrl::fromLocalFile(QLatin1String("/baz"))); + meshC->setMeshName(QLatin1String("bar")); + + auto meshD = new Qt3DRender::QMesh(); + meshD->setSource(QUrl::fromLocalFile(QLatin1String("/foo"))); + meshD->setMeshName(QLatin1String("bar")); + + const Qt3DRender::MeshLoaderFunctor functorA(meshA, &engine); + const Qt3DRender::MeshLoaderFunctor functorB(meshB, &engine); + const Qt3DRender::MeshLoaderFunctor functorC(meshC, &engine); + const Qt3DRender::MeshLoaderFunctor functorD(meshD, &engine); + + // WHEN + const bool selfEquality = (functorA == functorA); + const bool sameSource = (functorA == functorB); + const bool sameMeshName = (functorA == functorC); + const bool perfectMatch = (functorA == functorD); + + // THEN + QCOMPARE(selfEquality, true); + QCOMPARE(sameSource, false); + QCOMPARE(sameMeshName, false); + QCOMPARE(perfectMatch, true); + } }; -QTEST_APPLESS_MAIN(tst_MeshFunctors) +QTEST_MAIN(tst_MeshFunctors) #include "tst_meshfunctors.moc" |