summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWolfgang Beck <wolfgang.beck@nokia.com>2012-03-16 10:07:53 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-16 07:03:35 +0100
commite24ce0c822bfb9bb38b8c9518e346ed2c4fa51e3 (patch)
treec8c728b90c4c42de083b9e4a15f58b342c388269 /tests
parent1947edb4497b2b49ace8e6813cbc61ca3d221d81 (diff)
downloadqtsensors-e24ce0c822bfb9bb38b8c9518e346ed2c4fa51e3.tar.gz
Remove QSettings usage
Change-Id: Ifec28d4de4af4c5a114c66faaababaaeb57ad357 Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qsensor/tst_qsensor.cpp25
1 files changed, 4 insertions, 21 deletions
diff --git a/tests/auto/qsensor/tst_qsensor.cpp b/tests/auto/qsensor/tst_qsensor.cpp
index 2c1dd9a..45b2ab3 100644
--- a/tests/auto/qsensor/tst_qsensor.cpp
+++ b/tests/auto/qsensor/tst_qsensor.cpp
@@ -44,9 +44,9 @@
#include <QObject>
#include <QTest>
#include <QDebug>
-#include <QSettings>
#include <QFile>
#include <QSignalSpy>
+#include <QSensorManager>
#include "qsensor.h"
#include "test_sensor.h"
@@ -123,14 +123,10 @@ public:
private slots:
void initTestCase()
{
- QSettings settings(QLatin1String("Nokia"), QLatin1String("Sensors"));
- settings.clear();
}
void cleanupTestCase()
{
- QSettings settings(QLatin1String("Nokia"), QLatin1String("Sensors"));
- settings.clear();
#ifdef WAIT_AT_END
QFile _stdin;
@@ -181,10 +177,7 @@ private slots:
void testBadDefaultFromConfig()
{
- QSettings settings(QLatin1String("Nokia"), QLatin1String("Sensors"));
- settings.setValue(QString(QLatin1String("Default/%1")).arg(QString::fromLatin1(TestSensor::type)), QByteArray("bogus id"));
- settings.sync();
-
+ QSensorManager::setDefaultBackend(QByteArray(TestSensor::type), QByteArray("bogus id"));
QByteArray expected = testsensorimpl::id;
QByteArray actual = QSensor::defaultSensorForType(TestSensor::type);
QCOMPARE(actual, expected);
@@ -192,15 +185,10 @@ private slots:
void testGoodDefaultFromConfig()
{
- QSettings settings(QLatin1String("Nokia"), QLatin1String("Sensors"));
- settings.setValue(QString(QLatin1String("Default/%1")).arg(QString::fromLatin1(TestSensor::type)), QByteArray(testsensorimpl::id));
- settings.sync();
-
+ QSensorManager::setDefaultBackend(QByteArray(TestSensor::type), QByteArray(testsensorimpl::id));
QByteArray expected = testsensorimpl::id;
QByteArray actual = QSensor::defaultSensorForType(TestSensor::type);
QCOMPARE(actual, expected);
-
- settings.clear();
}
void testNoSensorsForType()
@@ -245,18 +233,13 @@ private slots:
void testBadDefaultCreation()
{
- QSettings settings(QLatin1String("Nokia"), QLatin1String("Sensors"));
- settings.setValue(QString(QLatin1String("Default/%1")).arg(QString::fromLatin1(TestSensor::type)), QByteArray("test sensor 2"));
- settings.sync();
-
+ QSensorManager::setDefaultBackend(QByteArray(TestSensor::type), QByteArray("test sensor 2"));
TestSensor sensor;
QTest::ignoreMessage(QtWarningMsg, "Can't create backend \"test sensor 2\" ");
sensor.connectToBackend();
QByteArray expected = testsensorimpl::id;
QByteArray actual = sensor.identifier();
QCOMPARE(actual, expected);
-
- settings.clear();
}
void testBadCreation()