diff options
Diffstat (limited to 'tests/auto/extras/qfirstpersoncameracontroller/tst_qfirstpersoncameracontroller.cpp')
-rw-r--r-- | tests/auto/extras/qfirstpersoncameracontroller/tst_qfirstpersoncameracontroller.cpp | 40 |
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..ab43ff2e5 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(float))); + 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(float))); + 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); + + } } }; |