summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2018-01-19 07:42:06 +0100
committerPaul Lemire <paul.lemire@kdab.com>2018-01-22 06:08:41 +0000
commit2ca0dbadaac328826807c6b9bf2b46dbb955e3d2 (patch)
tree6aa5007706cfe514cc6dcb16f9c6276fa808576a /tests
parentfac6dcc70de922dc3f3dd105e9d725092e6fd808 (diff)
QMesh: add a status property
This will allow to monitor the loading of the mesh. Change-Id: I52ad7a7d556c64bfdb04173be932d6fe79bf5ae2 Task-number: QTBUG-60927 Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/render/qmesh/tst_qmesh.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/render/qmesh/tst_qmesh.cpp b/tests/auto/render/qmesh/tst_qmesh.cpp
index 127371750..67d938add 100644
--- a/tests/auto/render/qmesh/tst_qmesh.cpp
+++ b/tests/auto/render/qmesh/tst_qmesh.cpp
@@ -38,6 +38,20 @@
#include <Qt3DCore/qnodecreatedchange.h>
#include "testpostmanarbiter.h"
+class MyQMesh : public Qt3DRender::QMesh
+{
+ Q_OBJECT
+public:
+ explicit MyQMesh(Qt3DCore::QNode *parent = nullptr)
+ : Qt3DRender::QMesh(parent)
+ {}
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) final
+ {
+ Qt3DRender::QMesh::sceneChangeEvent(change);
+ }
+};
+
class tst_QMesh : public QObject
{
Q_OBJECT
@@ -52,6 +66,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(mesh.source(), QUrl());
QCOMPARE(mesh.meshName(), QString());
+ QCOMPARE(mesh.status(), Qt3DRender::QMesh::None);
}
void checkPropertyChanges()
@@ -241,6 +256,28 @@ private Q_SLOTS:
}
+ void checkStatusUpdate()
+ {
+ // GIVEN
+ qRegisterMetaType<Qt3DRender::QMesh::Status>("Status");
+ MyQMesh mesh;
+ QSignalSpy spy(&mesh, SIGNAL(statusChanged(Status)));
+
+ // THEN
+ QCOMPARE(mesh.status(), Qt3DRender::QMesh::None);
+
+ // WHEN
+ const Qt3DRender::QMesh::Status newStatus = Qt3DRender::QMesh::Error;
+ Qt3DCore::QPropertyUpdatedChangePtr e(new Qt3DCore::QPropertyUpdatedChange(mesh.id()));
+ e->setPropertyName("status");
+ e->setValue(QVariant::fromValue(newStatus));
+ mesh.sceneChangeEvent(e);
+
+ // THEN
+ QCOMPARE(mesh.status(), newStatus);
+ QCOMPARE(spy.count(), 1);
+ }
+
};
QTEST_MAIN(tst_QMesh)