summaryrefslogtreecommitdiffstats
path: root/tests/auto/render/meshfunctors/tst_meshfunctors.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-10-05 20:34:44 +0200
committerLiang Qi <liang.qi@qt.io>2017-10-05 20:47:59 +0200
commit8e67fb1f148b2f3c795d230faad7aee20389878a (patch)
tree34358c0ee9ab4816d20d58d84bdab20093b1d423 /tests/auto/render/meshfunctors/tst_meshfunctors.cpp
parentba5bc93b95d28a28a72e60281f765a6f031129a5 (diff)
parentd4fb24c0871320667640f100b743f34f702db6cf (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: src/animation/backend/channelmapper_p.h Change-Id: I4e0f59c6648925ba45d30ccc2405524a9e901a0e
Diffstat (limited to 'tests/auto/render/meshfunctors/tst_meshfunctors.cpp')
-rw-r--r--tests/auto/render/meshfunctors/tst_meshfunctors.cpp44
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 c0e871d62..1904169fb 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"