diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qsensor/test_backends.h | 16 | ||||
-rw-r--r-- | tests/auto/qsensor/tst_qsensor.cpp | 18 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qsensor/test_backends.h b/tests/auto/qsensor/test_backends.h index a36a858..b76d412 100644 --- a/tests/auto/qsensor/test_backends.h +++ b/tests/auto/qsensor/test_backends.h @@ -48,12 +48,16 @@ void register_test_backends(); void unregister_test_backends(); #include <qaccelerometer.h> +#include <qaltimeter.h> #include <qambientlightsensor.h> +#include <qambienttemperaturesensor.h> #include <qcompass.h> #include <qgyroscope.h> +#include <qholstersensor.h> #include <qlightsensor.h> #include <qmagnetometer.h> #include <qorientationsensor.h> +#include <qpressuresensor.h> #include <qproximitysensor.h> #include <qrotationsensor.h> #include <qtapsensor.h> @@ -96,9 +100,15 @@ PREPARE_SENSORINTERFACE(QAccelerometer, QAccelerometerReading, QAccelerometerFil reading->setY(1.0); reading->setZ(1.0); }) +PREPARE_SENSORINTERFACE(QAltimeter, QAltimeterReading, QAltimeterFilter, { + reading->setAltitude(8848); +}) PREPARE_SENSORINTERFACE(QAmbientLightSensor, QAmbientLightReading, QAmbientLightFilter, { reading->setLightLevel(QAmbientLightReading::Twilight); }) +PREPARE_SENSORINTERFACE(QAmbientTemperatureSensor, QAmbientTemperatureReading, QAmbientTemperatureFilter, { + reading->setTemperature(30); +}) PREPARE_SENSORINTERFACE(QCompass, QCompassReading, QCompassFilter, { reading->setAzimuth(1.0); reading->setCalibrationLevel(1.0); @@ -108,6 +118,9 @@ PREPARE_SENSORINTERFACE(QGyroscope, QGyroscopeReading, QGyroscopeFilter, { reading->setY(1.0); reading->setZ(1.0); }) +PREPARE_SENSORINTERFACE(QHolsterSensor, QHolsterReading, QHolsterFilter, { + reading->setHolstered(true); +}) PREPARE_SENSORINTERFACE(QLightSensor, QLightReading, QLightFilter, { reading->setLux(1.0); }) @@ -120,6 +133,9 @@ PREPARE_SENSORINTERFACE(QMagnetometer, QMagnetometerReading, QMagnetometerFilter PREPARE_SENSORINTERFACE(QOrientationSensor, QOrientationReading, QOrientationFilter, { reading->setOrientation(QOrientationReading::LeftUp); }) +PREPARE_SENSORINTERFACE(QPressureSensor, QPressureReading, QPressureFilter, { + reading->setPressure(1.0); +}) PREPARE_SENSORINTERFACE(QProximitySensor, QProximityReading, QProximityFilter, { reading->setClose(true); }) diff --git a/tests/auto/qsensor/tst_qsensor.cpp b/tests/auto/qsensor/tst_qsensor.cpp index a4591aa..a410f71 100644 --- a/tests/auto/qsensor/tst_qsensor.cpp +++ b/tests/auto/qsensor/tst_qsensor.cpp @@ -847,10 +847,18 @@ private slots: QCOMPARE(reading->z(), 1.0); }) + TEST_SENSORINTERFACE(QAltimeter, QAltimeterReading, { + QCOMPARE(reading->altitude(), 8848.0); + }) + TEST_SENSORINTERFACE(QAmbientLightSensor, QAmbientLightReading, { QCOMPARE(reading->lightLevel(), QAmbientLightReading::Twilight); }) + TEST_SENSORINTERFACE(QAmbientTemperatureSensor, QAmbientTemperatureReading, { + QCOMPARE(reading->temperature(), 30.0); + }) + TEST_SENSORINTERFACE(QCompass, QCompassReading, { QCOMPARE(reading->azimuth(), 1.0); QCOMPARE(reading->calibrationLevel(), 1.0); @@ -862,6 +870,10 @@ private slots: QCOMPARE(reading->z(), 1.0); }) + TEST_SENSORINTERFACE(QHolsterSensor, QHolsterReading, { + QCOMPARE(reading->holstered(), true); + }) + TEST_SENSORINTERFACE(QLightSensor, QLightReading, { QCOMPARE(reading->lux(), 1.0); }) @@ -877,6 +889,10 @@ private slots: QCOMPARE(reading->orientation(), QOrientationReading::LeftUp); }) + TEST_SENSORINTERFACE(QPressureSensor, QPressureReading, { + QCOMPARE(reading->pressure(), 1.0); + }) + TEST_SENSORINTERFACE(QProximitySensor, QProximityReading, { QCOMPARE(reading->close(), true); }) @@ -959,6 +975,7 @@ private slots: QVERIFY(!sensor.isFeatureSupported(QSensor::Buffering)); QVERIFY(!sensor.isFeatureSupported(QSensor::GeoValues)); QVERIFY(!sensor.isFeatureSupported(QSensor::FieldOfView)); + QVERIFY(!sensor.isFeatureSupported(QSensor::AccelerationMode)); // Connect to backend - according to the testsensorimpl implementation, AlwaysOn and // GeoValues should be supported afterwards @@ -968,6 +985,7 @@ private slots: QVERIFY(!sensor.isFeatureSupported(QSensor::Buffering)); QVERIFY(sensor.isFeatureSupported(QSensor::GeoValues)); QVERIFY(!sensor.isFeatureSupported(QSensor::FieldOfView)); + QVERIFY(!sensor.isFeatureSupported(QSensor::AccelerationMode)); } }; |