summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2011-11-08 08:27:13 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-08 06:08:43 +0100
commitfa6e82c412f604f0306004d7adda309d2d5d773b (patch)
tree1b272dba3a11595eda0d470636dc59c4b9554f80 /tests
parent7a009686f962ff3e8bdb460a81b9d74277d2ce7d (diff)
downloadqtsensors-fa6e82c412f604f0306004d7adda309d2d5d773b.tar.gz
add more code coverage.
qt_metacast was not tested. add Q_ASSERT instead of conditional checking for object. Change-Id: Ib8eaa0583d0f8f71b144941a34b1fe9109e85b7a Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qsensorgestures/qsensorgestures.pro1
-rw-r--r--tests/auto/qsensorgestures/tst_qsensorgesturetest.cpp29
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qsensorgestures/qsensorgestures.pro b/tests/auto/qsensorgestures/qsensorgestures.pro
index 5bccd76..a29e3c4 100644
--- a/tests/auto/qsensorgestures/qsensorgestures.pro
+++ b/tests/auto/qsensorgestures/qsensorgestures.pro
@@ -6,6 +6,7 @@ QT += core testlib sensors
QT -= gui
SOURCES += tst_qsensorgesturetest.cpp
+DEFINES += QT_NO_QOBJECT_CHECK
PLUGIN_1_HEADERS = \
diff --git a/tests/auto/qsensorgestures/tst_qsensorgesturetest.cpp b/tests/auto/qsensorgestures/tst_qsensorgesturetest.cpp
index 9b82e72..b5f4a0f 100644
--- a/tests/auto/qsensorgestures/tst_qsensorgesturetest.cpp
+++ b/tests/auto/qsensorgestures/tst_qsensorgesturetest.cpp
@@ -141,6 +141,7 @@ private Q_SLOTS:
void tst_sensor_gesture_threaded();
void tst_sensor_gesture();
+ void tst_sensor_gesture_metacast();
void tst_recognizer();
@@ -488,6 +489,25 @@ void Tst_qsensorgestureTest::tst_sensor_gesture()
gesture3 = 0;
}
+void Tst_qsensorgestureTest::tst_sensor_gesture_metacast()
+{
+ QSensorGesture *gesture = new QSensorGesture(QStringList() << "QtSensors.test", this);
+ // exercise qt_metacast
+ QVERIFY(!gesture->inherits(""));
+ QVERIFY(gesture->inherits("QObject"));
+
+#if defined(QT_NO_QOBJECT_CHECK)
+ QObject *o = qobject_cast<QObject *>(gesture);
+ QVERIFY(o);
+
+ // this will fail in the compile time check for
+ // the Q_OBJECT macro in qobjectdefs.h unless QT_NO_QOBJECT_CHECK is defined,
+ QSensorGesture *gest = qobject_cast<QSensorGesture *>(o);
+ QVERIFY(!gest->gestureSignals().isEmpty());
+#endif
+ delete gesture;
+}
+
void Tst_qsensorgestureTest::tst_recognizer()
{
@@ -574,6 +594,15 @@ void Tst_qsensorgestureTest::tst_sensorgesture_noid()
QCOMPARE(gesture->invalidIds() ,QStringList() << "QtSensors.noid");
+ QSensorGestureManager manager;
+ QStringList recognizerSignalsList = manager.recognizerSignals( "QtSensors.noid");
+ QVERIFY(recognizerSignalsList.isEmpty());
+
+ QVERIFY(!recognizerSignalsList.contains("QtSensors.noid"));
+
+ QSensorGestureRecognizer *fakeRecognizer = manager.sensorGestureRecognizer("QtSensors.noid");
+ QVERIFY(!fakeRecognizer);
+
delete gesture;
gesture = 0;
}