summaryrefslogtreecommitdiffstats
path: root/tests/auto/extras
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2017-01-25 15:40:47 +0100
committerKevin Ottens <kevin.ottens@kdab.com>2017-01-27 14:59:09 +0000
commit3a895576bf188e15d5ff03e704e192a87d4c16a0 (patch)
treef5eaa75dfb2fe523cc0b472385566e6f5f3d4bc2 /tests/auto/extras
parent633c2efcc5b7d6d4943985e9ea0a9b6ff90becbf (diff)
Add (ac|de)celeration to QFirstPersonCameraController
Those two properties were added to the QML variant but not the C++ one. Let's fix this. Change-Id: Ibd0765993f42a7562bd922f2db5456c1fa6d6ad1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests/auto/extras')
-rw-r--r--tests/auto/extras/qfirstpersoncameracontroller/tst_qfirstpersoncameracontroller.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/extras/qfirstpersoncameracontroller/tst_qfirstpersoncameracontroller.cpp b/tests/auto/extras/qfirstpersoncameracontroller/tst_qfirstpersoncameracontroller.cpp
index 22046051b..2cf4d7ba2 100644
--- a/tests/auto/extras/qfirstpersoncameracontroller/tst_qfirstpersoncameracontroller.cpp
+++ b/tests/auto/extras/qfirstpersoncameracontroller/tst_qfirstpersoncameracontroller.cpp
@@ -48,6 +48,8 @@ private Q_SLOTS:
QVERIFY(firstPersonCameraController.camera() == nullptr);
QCOMPARE(firstPersonCameraController.linearSpeed(), 10.0f);
QCOMPARE(firstPersonCameraController.lookSpeed(), 180.0f);
+ QCOMPARE(firstPersonCameraController.acceleration(), -1.0f);
+ QCOMPARE(firstPersonCameraController.deceleration(), -1.0f);
}
void checkPropertyChanges()
@@ -120,6 +122,44 @@ private Q_SLOTS:
QCOMPARE(spy.count(), 0);
}
+ {
+ // WHEN
+ QSignalSpy spy(&firstPersonCameraController, SIGNAL(accelerationChanged()));
+ const float newValue = 0.001f;
+ firstPersonCameraController.setAcceleration(newValue);
+
+ // THEN
+ QCOMPARE(firstPersonCameraController.acceleration(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ firstPersonCameraController.setAcceleration(newValue);
+
+ // THEN
+ QCOMPARE(firstPersonCameraController.acceleration(), newValue);
+ QCOMPARE(spy.count(), 0);
+
+ }
+ {
+ // WHEN
+ QSignalSpy spy(&firstPersonCameraController, SIGNAL(decelerationChanged()));
+ const float newValue = 0.001f;
+ firstPersonCameraController.setDeceleration(newValue);
+
+ // THEN
+ QCOMPARE(firstPersonCameraController.deceleration(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ firstPersonCameraController.setDeceleration(newValue);
+
+ // THEN
+ QCOMPARE(firstPersonCameraController.deceleration(), newValue);
+ QCOMPARE(spy.count(), 0);
+
+ }
}
};