diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2016-02-25 16:53:15 +0100 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2016-02-29 10:55:52 +0000 |
commit | cc385cae0fc43d9d4090280e9d2b5699759e2b1d (patch) | |
tree | ffc13b43a073f1b9047dc74f0e8a6fc15df0e427 /tests | |
parent | 2d197c6c1226cba097a5a0a100776c62a37472a7 (diff) |
QAxis: add value property
Change-Id: Ibfa241029b3906b4cbe94789c4b12565aec2a335
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/input/qaxis/tst_qaxis.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/auto/input/qaxis/tst_qaxis.cpp b/tests/auto/input/qaxis/tst_qaxis.cpp index ad91d5ec1..fc5481154 100644 --- a/tests/auto/input/qaxis/tst_qaxis.cpp +++ b/tests/auto/input/qaxis/tst_qaxis.cpp @@ -36,8 +36,9 @@ #include "testpostmanarbiter.h" // We need to call QNode::clone which is protected -// So we sublcass QNode instead of QObject -class tst_QAxis: public Qt3DCore::QNode +// We need to call QAxis::sceneChangeEvent which is protected +// So we sublcass QAxis instead of QObject +class tst_QAxis: public Qt3DInput::QAxis { Q_OBJECT public: @@ -88,6 +89,7 @@ private Q_SLOTS: QCOMPARE(axis->id(), clone->id()); QCOMPARE(axis->name(), clone->name()); QCOMPARE(axis->inputs().count(), clone->inputs().count()); + QCOMPARE(axis->value(), clone->value()); for (int i = 0, m = axis->inputs().count(); i < m; ++i) { QCOMPARE(axis->inputs().at(i)->id(), clone->inputs().at(i)->id()); @@ -142,6 +144,23 @@ private Q_SLOTS: arbiter.events.clear(); } + void checkValuePropertyChanged() + { + // GIVEN + QCOMPARE(value(), 0.0f); + + // Note: simulate backend change to frontend + // WHEN + Qt3DCore::QScenePropertyChangePtr valueChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId())); + valueChange->setPropertyName("value"); + valueChange->setValue(383.0f); + sceneChangeEvent(valueChange); + + // THEN + QCOMPARE(value(), 383.0f); + } + + protected: Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE { |