summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-11-03 17:38:42 +0100
committerAndy Nichols <andy.nichols@theqtcompany.com>2015-11-16 09:17:32 +0000
commit56658260b8a47b90157eefa8569decb72a71c1c5 (patch)
treef43a9b2a77e7294221a719fccf08041ec3fe0136 /tests
parent7c408322b4678d302e57615bbc58053ae78ad3e5 (diff)
Unit tests for Geometry updated
Change-Id: Iac97033ac00bdea74c724f96b9596f7ff436ebb3 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/render/geometry/tst_geometry.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/render/geometry/tst_geometry.cpp b/tests/auto/render/geometry/tst_geometry.cpp
index 1ff1a2ba5..d36a27749 100644
--- a/tests/auto/render/geometry/tst_geometry.cpp
+++ b/tests/auto/render/geometry/tst_geometry.cpp
@@ -39,6 +39,7 @@
#include <Qt3DRender/qgeometry.h>
#include <Qt3DRender/qattribute.h>
#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRender/qboundingvolumespecifier.h>
class tst_RenderGeometry : public QObject
{
@@ -61,6 +62,7 @@ private Q_SLOTS:
geometry.addAttribute(&attr3);
geometry.addAttribute(&attr4);
geometry.setVerticesPerPatch(4);
+ geometry.boundingVolumeSpecifier()->setPositionAttribute(&attr1);
// WHEN
renderGeometry.setPeer(&geometry);
@@ -70,6 +72,7 @@ private Q_SLOTS:
QCOMPARE(renderGeometry.isDirty(), true);
QCOMPARE(renderGeometry.attributes().count(), 4);
QCOMPARE(renderGeometry.verticesPerPatch(), 4);
+ QCOMPARE(renderGeometry.boundingPositionAttribute(), attr1.id());
for (int i = 0; i < 4; ++i)
QCOMPARE(geometry.attributes().at(i)->id(), renderGeometry.attributes().at(i));
@@ -85,6 +88,7 @@ private Q_SLOTS:
QVERIFY(renderGeometry.attributes().isEmpty());
QVERIFY(renderGeometry.peerUuid().isNull());
QCOMPARE(renderGeometry.verticesPerPatch(), 0);
+ QCOMPARE(renderGeometry.boundingPositionAttribute(), Qt3DCore::QNodeId());
// GIVEN
Qt3DRender::QGeometry geometry;
@@ -92,6 +96,7 @@ private Q_SLOTS:
Qt3DRender::QAttribute attr2;
Qt3DRender::QAttribute attr4;
Qt3DRender::QAttribute attr3;
+ geometry.boundingVolumeSpecifier()->setPositionAttribute(&attr1);
geometry.addAttribute(&attr1);
geometry.addAttribute(&attr2);
@@ -107,6 +112,7 @@ private Q_SLOTS:
QCOMPARE(renderGeometry.isDirty(), false);
QVERIFY(renderGeometry.attributes().isEmpty());
QCOMPARE(renderGeometry.verticesPerPatch(), 0);
+ QCOMPARE(renderGeometry.boundingPositionAttribute(), Qt3DCore::QNodeId());
}
void checkPropertyChanges()
@@ -150,6 +156,17 @@ private Q_SLOTS:
// THEN
QCOMPARE(renderGeometry.verticesPerPatch(), 3);
QVERIFY(!renderGeometry.isDirty());
+
+ // WHEN
+ const Qt3DCore::QNodeId boundingAttrId = Qt3DCore::QNodeId::createId();
+ updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange->setValue(QVariant::fromValue(boundingAttrId));
+ updateChange->setPropertyName("boundingVolumeSpecifierPositionAttribute");
+ renderGeometry.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(renderGeometry.boundingPositionAttribute(), boundingAttrId);
+ QVERIFY(!renderGeometry.isDirty());
}
};