summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsensor
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qsensor')
-rw-r--r--tests/auto/qsensor/test_backends.h5
-rw-r--r--tests/auto/qsensor/tst_qsensor.cpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qsensor/test_backends.h b/tests/auto/qsensor/test_backends.h
index 0d8e2bab..a36a8586 100644
--- a/tests/auto/qsensor/test_backends.h
+++ b/tests/auto/qsensor/test_backends.h
@@ -58,6 +58,7 @@ void unregister_test_backends();
#include <qrotationsensor.h>
#include <qtapsensor.h>
#include <qirproximitysensor.h>
+#include <qtiltsensor.h>
#define PREPARE_SENSORINTERFACE_DECLS(SensorClass, ReadingClass, FilterClass, readingcode)\
class SensorClass ## _impl : public QSensorBackend\
@@ -132,6 +133,10 @@ PREPARE_SENSORINTERFACE(QTapSensor, QTapReading, QTapFilter, {
PREPARE_SENSORINTERFACE(QIRProximitySensor, QIRProximityReading, QIRProximityFilter, {
reading->setReflectance(0.5);
})
+PREPARE_SENSORINTERFACE(QTiltSensor, QTiltReading, QTiltFilter, {
+ reading->setYRotation(1.0);
+ reading->setXRotation(1.0);
+})
#define TEST_SENSORINTERFACE(SensorClass, ReadingClass, readingcode)\
do {\
diff --git a/tests/auto/qsensor/tst_qsensor.cpp b/tests/auto/qsensor/tst_qsensor.cpp
index abb0a6d8..5b4c40b8 100644
--- a/tests/auto/qsensor/tst_qsensor.cpp
+++ b/tests/auto/qsensor/tst_qsensor.cpp
@@ -892,6 +892,11 @@ private slots:
QCOMPARE(reading->isDoubleTap(), true);
})
+ TEST_SENSORINTERFACE(QTiltSensor, QTiltReading, {
+ QCOMPARE(reading->yRotation(), 1.0);
+ QCOMPARE(reading->xRotation(), 1.0);
+ })
+
TEST_SENSORINTERFACE(QIRProximitySensor, QIRProximityReading, {
QCOMPARE(reading->reflectance(), 0.5);
})