diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qsensor/tst_qsensor.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qsensor/tst_qsensor.cpp b/tests/auto/qsensor/tst_qsensor.cpp index 92cb281..8025ab2 100644 --- a/tests/auto/qsensor/tst_qsensor.cpp +++ b/tests/auto/qsensor/tst_qsensor.cpp @@ -353,6 +353,28 @@ private slots: QCOMPARE(actual, expected); } + // Test that a previously-set, valid data rate is retained + { + TestSensor sensor; + sensor.setDataRate(100); + sensor.setProperty("doThis", "rates"); + sensor.connectToBackend(); + int actual = sensor.dataRate(); + int expected = 100; + QCOMPARE(actual, expected); + } + + // Test that a previously-set, invalid data rate is reset to 0 + { + TestSensor sensor; + sensor.setDataRate(50); + sensor.setProperty("doThis", "rates"); + sensor.connectToBackend(); + int actual = sensor.dataRate(); + int expected = 0; + QCOMPARE(actual, expected); + } + { TestSensor sensor; sensor.setProperty("doThis", "rates(0)"); |