summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2010-12-06 10:16:51 +1000
committerLorn Potter <lorn.potter@nokia.com>2010-12-06 10:16:51 +1000
commit4c68069de37c6a48840a3404b9784a289250f1fd (patch)
tree3dfbd7e38f2860d410f419b12f81e13660d0e239
parent5b83e1d2fe412638e1d49a8f4fbd78b371a70f36 (diff)
add some declarative autotests
Task-number: MOBILITY-1722
-rw-r--r--plugins/declarative/systeminfo/qdeclarativedeviceinfo_p.h2
-rw-r--r--tests/auto/qdeclarativebatteryinfo/qdeclarativebatteryinfo.pro21
-rw-r--r--tests/auto/qdeclarativebatteryinfo/tst_qdeclarativebatteryinfo.cpp455
-rw-r--r--tests/auto/qdeclarativedeviceinfo/qdeclarativedeviceinfo.pro22
-rw-r--r--tests/auto/qdeclarativedeviceinfo/tst_qdeclarativedeviceinfo.cpp309
-rw-r--r--tests/auto/qdeclarativedisplayinfo/qdeclarativedisplayinfo.pro21
-rw-r--r--tests/auto/qdeclarativedisplayinfo/tst_qdeclarativedisplayinfo.cpp143
-rw-r--r--tests/auto/qdeclarativenetworkinfo/qdeclarativenetworkinfo.pro22
-rw-r--r--tests/auto/qdeclarativenetworkinfo/tst_qdeclarativenetworkinfo.cpp354
-rw-r--r--tests/auto/qdeclarativescreensaver/qdeclarativescreensaver.pro21
-rw-r--r--tests/auto/qdeclarativescreensaver/tst_qdeclarativescreensaver.cpp69
-rw-r--r--tests/auto/qdeclarativestorageinfo/qdeclarativestorageinfo.pro27
-rw-r--r--tests/auto/qdeclarativestorageinfo/tst_qdeclarativestorageinfo.cpp129
-rw-r--r--tests/auto/qdeclarativesysteminfo/qdeclarativesysteminfo.pro22
-rw-r--r--tests/auto/qdeclarativesysteminfo/tst_qdeclarativesysteminfo.cpp177
-rw-r--r--tests/auto/qsystembatteryinfo/qsystembatteryinfo.pro15
-rw-r--r--tests/auto/qsystembatteryinfo/tst_qsystembatteryinfo.cpp456
-rw-r--r--tests/auto/systeminfo.pro14
18 files changed, 2277 insertions, 2 deletions
diff --git a/plugins/declarative/systeminfo/qdeclarativedeviceinfo_p.h b/plugins/declarative/systeminfo/qdeclarativedeviceinfo_p.h
index 2383a4b5ac..3bf8606ee5 100644
--- a/plugins/declarative/systeminfo/qdeclarativedeviceinfo_p.h
+++ b/plugins/declarative/systeminfo/qdeclarativedeviceinfo_p.h
@@ -44,6 +44,8 @@
#define QDECLARATIVEDEVICEINFO_P_H
#include <QObject>
+#include "qmobilityglobal.h"
+
#include "qsystemdeviceinfo.h"
QT_BEGIN_HEADER
diff --git a/tests/auto/qdeclarativebatteryinfo/qdeclarativebatteryinfo.pro b/tests/auto/qdeclarativebatteryinfo/qdeclarativebatteryinfo.pro
new file mode 100644
index 0000000000..76149cab13
--- /dev/null
+++ b/tests/auto/qdeclarativebatteryinfo/qdeclarativebatteryinfo.pro
@@ -0,0 +1,21 @@
+TARGET = tst_qdeclarativebatteryinfo
+CONFIG+=testcase
+
+SOURCES += tst_qdeclarativebatteryinfo.cpp
+QT = core
+#DEFINES += TESTR
+
+HEADERS += ../../../plugins/declarative/systeminfo/qdeclarativebatteryinfo_p.h
+SOURCES += ../../../plugins/declarative/systeminfo/qdeclarativebatteryinfo.cpp
+
+
+INCLUDEPATH += ../../../src/systeminfo
+INCLUDEPATH += $$QT_MOBILITY_SOURCE_TREE/plugins/declarative/systeminfo
+
+include(../../../common.pri)
+CONFIG += mobility
+MOBILITY = systeminfo
+
+symbian {
+ TARGET.CAPABILITY = All -TCB -DRM
+}
diff --git a/tests/auto/qdeclarativebatteryinfo/tst_qdeclarativebatteryinfo.cpp b/tests/auto/qdeclarativebatteryinfo/tst_qdeclarativebatteryinfo.cpp
new file mode 100644
index 0000000000..a56585b0a6
--- /dev/null
+++ b/tests/auto/qdeclarativebatteryinfo/tst_qdeclarativebatteryinfo.cpp
@@ -0,0 +1,455 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=src/systeminfo
+
+#include <QtTest/QtTest>
+#include "qdeclarativebatteryinfo_p.h"
+#include <QDebug>
+
+QTM_USE_NAMESPACE
+Q_DECLARE_METATYPE(QSystemBatteryInfo::BatteryStatus);
+Q_DECLARE_METATYPE(QSystemBatteryInfo::ChargingState);
+Q_DECLARE_METATYPE(QSystemBatteryInfo::ChargerType);
+Q_DECLARE_METATYPE(QSystemBatteryInfo::EnergyUnit);
+
+/**
+ * Starts an event loop that runs until the given signal is received.
+ * Optionally the event loop can return earlier on a timeout.
+ *
+ * \return \p true if the requested signal was received
+ * \p false on timeout
+ */
+static bool waitForSignal(QObject *obj, const char *signal, int timeout = 0)
+{
+ QEventLoop loop;
+ QObject::connect(obj, signal, &loop, SLOT(quit()));
+ QTimer timer;
+ QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));
+ if (timeout > 0) {
+ QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ timer.setSingleShot(true);
+ timer.start(timeout);
+ }
+ loop.exec();
+ return timeoutSpy.isEmpty();
+}
+
+//class ChangeBatteryThread : public QThread
+//{
+//public:
+// void run()
+// {
+// QDeclarativeBatteryInfo bi;
+// QSystemBatteryInfoPrivate *bip = bi.priv;
+// }
+
+//};
+
+class tst_QDeclarativeBatteryInfo : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QDeclarativeBatteryInfo();
+ virtual ~tst_QDeclarativeBatteryInfo();
+
+ friend class QSystemBatteryInfo;
+
+private slots:
+ void initTestCase();
+
+ void tst_chargerType();
+ void tst_chargingState();
+
+ void tst_nominalCapacity();
+ void tst_remainingCapacityPercent();
+ void tst_remainingCapacity();
+
+ void tst_voltage();
+ void tst_remainingChargingTime();
+ void tst_currentFlow();
+ void tst_remainingCapacityBars();
+ void tst_maxBars();
+ void tst_batteryStatus();
+ void tst_energyMeasurementUnit();
+
+
+ //signal tests
+// void tst_batteryLevelChanged();
+// void tst_batteryStatusChanged();
+
+
+// void tst_chargingStateChanged();
+// void tst_chargerTypeChanged();
+
+// void tst_nominalCapacityChanged();
+// void tst_remainingCapacityPercentChanged();
+// void tst_remainingCapacityChanged();
+// void tst_voltageChanged();
+
+// void tst_currentFlowChanged();
+// void tst_cumulativeCurrentFlowChanged();
+// void tst_remainingCapacityBarsChanged();
+// void tst_remainingChargingTimeChanged();
+
+
+// //signals
+// void batteryLevelChanged(int level);
+// void batteryStatusChanged(QSystemBatteryInfo::BatteryStatus batteryStatus);
+
+
+// void chargingStateChanged(QSystemBatteryInfo::ChargingState chargingState);
+// void chargerTypeChanged(QSystemBatteryInfo::ChargerType chargerType);
+
+// void nominalCapacityChanged(int);
+// void remainingCapacityPercentChanged(int);
+// void remainingCapacityChanged(int);
+// void voltageChanged(int);
+
+// void currentFlowChanged(int);
+// void cumulativeCurrentFlowChanged(int);
+// void remainingCapacityBarsChanged(int);
+// void remainingChargingTimeChanged(int);
+
+
+// ChangeBatteryThread *changeBatteryThread;
+};
+
+tst_QDeclarativeBatteryInfo::tst_QDeclarativeBatteryInfo()
+{
+ // changeBatteryThread = new ChangeBatteryThread();
+}
+
+tst_QDeclarativeBatteryInfo::~tst_QDeclarativeBatteryInfo()
+{
+ //delete changeBatteryThread, changeBatteryThread = 0;
+}
+/*
+ SystemInfoConnection si;
+ QSystemBatteryInfoPrivate *bip = si.batteryInfoPrivate();
+*/
+
+void tst_QDeclarativeBatteryInfo::initTestCase()
+{
+ qRegisterMetaType<QSystemBatteryInfo::BatteryStatus>("QSystemBatteryInfo::BatteryStatus");
+ qRegisterMetaType<QSystemBatteryInfo::ChargingState>("QSystemBatteryInfo::ChargingState");
+ qRegisterMetaType<QSystemBatteryInfo::ChargerType>("QSystemBatteryInfo::ChargerType");
+ qRegisterMetaType<QSystemBatteryInfo::EnergyUnit>("QSystemBatteryInfo::EnergyUnit");
+}
+
+void tst_QDeclarativeBatteryInfo::tst_chargerType()
+{
+ QDeclarativeBatteryInfo bi;
+ QSystemBatteryInfo::ChargerType cType = bi.chargerType();
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ QVERIFY(cType == QSystemBatteryInfo::NoCharger
+ || cType == QSystemBatteryInfo::UnknownCharger);
+ } else {
+ QVERIFY(cType == QSystemBatteryInfo::WallCharger
+ || cType == QSystemBatteryInfo::USBCharger
+ || cType == QSystemBatteryInfo::USB_500mACharger
+ || cType == QSystemBatteryInfo::USB_100mACharger
+ || cType == QSystemBatteryInfo::VariableCurrentCharger);
+
+ }
+}
+
+void tst_QDeclarativeBatteryInfo::tst_chargingState()
+{
+ QDeclarativeBatteryInfo bi;
+ QSystemBatteryInfo::ChargingState cState = bi.chargingState();
+
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ QVERIFY(cState == QSystemBatteryInfo::NotCharging
+ || cState == QSystemBatteryInfo::ChargingError);
+ } else {
+ QVERIFY(cState == QSystemBatteryInfo::Charging
+ || cState == QSystemBatteryInfo::NotCharging);
+ }
+}
+
+ QDeclarativeBatteryInfo bi;
+void tst_QDeclarativeBatteryInfo::tst_nominalCapacity()
+{
+ QDeclarativeBatteryInfo bi;
+ int nom = bi.nominalCapacity();
+ QVERIFY(nom != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QDeclarativeBatteryInfo::tst_remainingCapacityPercent()
+{
+ QDeclarativeBatteryInfo bi;
+ int rem = bi.remainingCapacityPercent();
+ QVERIFY(rem != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QDeclarativeBatteryInfo::tst_remainingCapacity()
+{
+ QDeclarativeBatteryInfo bi;
+ int rem = bi.remainingCapacity();
+ QVERIFY(rem != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QDeclarativeBatteryInfo::tst_voltage()
+{
+ QDeclarativeBatteryInfo bi;
+ int volt = bi.voltage();
+ QVERIFY(volt != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QDeclarativeBatteryInfo::tst_remainingChargingTime()
+{
+ QDeclarativeBatteryInfo bi;
+ int rem = bi.remainingChargingTime();
+ QVERIFY(rem != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QDeclarativeBatteryInfo::tst_currentFlow()
+{
+ QDeclarativeBatteryInfo bi;
+ int flow = bi.currentFlow();
+ QVERIFY(flow != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QDeclarativeBatteryInfo::tst_remainingCapacityBars()
+{
+ QDeclarativeBatteryInfo bi;
+ int rem = bi.remainingCapacityBars();
+ QVERIFY(rem != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QDeclarativeBatteryInfo::tst_maxBars()
+{
+ QDeclarativeBatteryInfo bi;
+ int max = bi.maxBars();
+ QVERIFY(max != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QDeclarativeBatteryInfo::tst_batteryStatus()
+{
+ QDeclarativeBatteryInfo bi;
+ QSystemBatteryInfo::BatteryStatus bstatus = bi.batteryStatus();
+ QVERIFY(bstatus != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QDeclarativeBatteryInfo::tst_energyMeasurementUnit()
+{
+ QDeclarativeBatteryInfo bi;
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+////signal tests
+//void tst_QDeclarativeBatteryInfo::tst_batteryLevelChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::tst_batteryStatusChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::tst_chargingStateChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::tst_chargerTypeChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::tst_nominalCapacityChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::tst_remainingCapacityPercentChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::tst_remainingCapacityChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::tst_voltageChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::tst_currentFlowChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::tst_cumulativeCurrentFlowChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::tst_remainingCapacityBarsChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::tst_remainingChargingTimeChanged()
+//{
+// QDeclarativeBatteryInfo bi;
+
+//}
+
+////signals
+//void tst_QDeclarativeBatteryInfo::batteryLevelChanged(int level)
+//{
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::batteryStatusChanged(QSystemBatteryInfo::BatteryStatus batteryStatus)
+//{
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::chargingStateChanged(QSystemBatteryInfo::ChargingState chargingState)
+//{
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::chargerTypeChanged(QSystemBatteryInfo::ChargerType chargerType)
+//{
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::nominalCapacityChanged(int)
+//{
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::remainingCapacityPercentChanged(int)
+//{
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::remainingCapacityChanged(int)
+//{
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::voltageChanged(int)
+//{
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::currentFlowChanged(int)
+//{
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::cumulativeCurrentFlowChanged(int)
+//{
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::remainingCapacityBarsChanged(int)
+//{
+
+//}
+
+//void tst_QDeclarativeBatteryInfo::remainingChargingTimeChanged(int)
+//{
+
+//}
+
+
+QTEST_MAIN(tst_QDeclarativeBatteryInfo)
+#include "tst_qdeclarativebatteryinfo.moc"
diff --git a/tests/auto/qdeclarativedeviceinfo/qdeclarativedeviceinfo.pro b/tests/auto/qdeclarativedeviceinfo/qdeclarativedeviceinfo.pro
new file mode 100644
index 0000000000..9ba1e6c012
--- /dev/null
+++ b/tests/auto/qdeclarativedeviceinfo/qdeclarativedeviceinfo.pro
@@ -0,0 +1,22 @@
+TARGET = tst_qdeclarativedeviceinfo
+CONFIG+=testcase
+
+QT = core network
+QT += declarative
+
+SOURCES += tst_qdeclarativedeviceinfo.cpp
+
+HEADERS += ../../../plugins/declarative/systeminfo/qdeclarativedeviceinfo_p.h
+
+SOURCES += ../../../plugins/declarative/systeminfo/qdeclarativedeviceinfo.cpp
+
+INCLUDEPATH += ../../../src/systeminfo
+INCLUDEPATH += $$QT_MOBILITY_SOURCE_TREE/plugins/declarative/systeminfo
+
+include(../../../common.pri)
+CONFIG += mobility
+MOBILITY = systeminfo
+
+symbian {
+ TARGET.CAPABILITY = All -TCB -DRM
+}
diff --git a/tests/auto/qdeclarativedeviceinfo/tst_qdeclarativedeviceinfo.cpp b/tests/auto/qdeclarativedeviceinfo/tst_qdeclarativedeviceinfo.cpp
new file mode 100644
index 0000000000..57992b6f4f
--- /dev/null
+++ b/tests/auto/qdeclarativedeviceinfo/tst_qdeclarativedeviceinfo.cpp
@@ -0,0 +1,309 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=src/systeminfo
+
+#include <QtTest/QtTest>
+#include "qdeclarativedeviceinfo_p.h"
+#include <QDebug>
+
+QTM_USE_NAMESPACE
+Q_DECLARE_METATYPE(QSystemDeviceInfo::BatteryStatus);
+Q_DECLARE_METATYPE(QSystemDeviceInfo::PowerState);
+Q_DECLARE_METATYPE(QSystemDeviceInfo::InputMethodFlags);
+Q_DECLARE_METATYPE(QSystemDeviceInfo::Profile);
+Q_DECLARE_METATYPE(QSystemDeviceInfo::SimStatus);
+
+Q_DECLARE_METATYPE(QSystemDeviceInfo::KeyboardTypeFlags);
+
+class tst_QDeclarativeDeviceInfo : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+ void initTestCase();
+ void tst_inputMethodType();
+
+ void tst_imei();
+ void tst_imsi();
+ void tst_manufacturer();
+ void tst_model();
+ void tst_productName();
+
+ void tst_batteryLevel();
+ void tst_batteryStatus();
+
+ void tst_currentProfile();
+
+ void tst_simStatus();
+
+ void tst_isDeviceLocked();
+
+ void tst_currentPowerState();
+
+ void tst_currentBluetoothPowerState();
+
+ void tst_keyboardType();
+ void tst_isWirelessKeyboardConnected();
+ void tst_isKeyboardFlipOpen();
+ void tst_keypadLightOn();
+ void tst_uniqueID();
+ void tst_lockStatus();
+
+};
+/*
+signal todo:
+// void profileChanged(QSystemDeviceInfo::Profile);
+ void batteryLevelChanged(QSystemDeviceInfo::BatteryLevel);
+ void batteryLevelCritical(qint32);
+ void powerStateChanged(QSystemDeviceInfo::PowerState);
+ */
+
+void tst_QDeclarativeDeviceInfo::initTestCase()
+{
+ qRegisterMetaType<QSystemDeviceInfo::BatteryStatus>("QSystemDeviceInfo::BatteryStatus");
+ qRegisterMetaType<QSystemDeviceInfo::PowerState>("QSystemDeviceInfo::PowerState");
+
+ qRegisterMetaType<QSystemDeviceInfo::InputMethodFlags>("QSystemDeviceInfo::InputMethodFlags");
+ qRegisterMetaType<QSystemDeviceInfo::Profile>("QSystemDeviceInfo::Profile");
+
+ qRegisterMetaType<QSystemDeviceInfo::SimStatus>("QSystemDeviceInfo::SimStatus");
+
+ qRegisterMetaType<QSystemDeviceInfo::KeyboardTypeFlags>("QSystemDeviceInfo::KeyboardTypeFlags");
+ qRegisterMetaType<QSystemDeviceInfo::LockType>("QSystemDeviceInfo::LockType");
+
+}
+
+void tst_QDeclarativeDeviceInfo::tst_inputMethodType()
+{
+ QDeclarativeDeviceInfo di;
+ QVERIFY( di.inputMethodType() != 0
+ || di.inputMethodType() == 0);
+}
+
+void tst_QDeclarativeDeviceInfo::tst_imei()
+{
+ QDeclarativeDeviceInfo di;
+ QString imeiStr =di.imei();
+ QVERIFY(!imeiStr.isEmpty() || imeiStr.isEmpty());
+
+}
+
+void tst_QDeclarativeDeviceInfo::tst_imsi()
+{
+ QDeclarativeDeviceInfo di;
+ QString imsiStr = di.imsi();
+ QVERIFY(!imsiStr.isEmpty() || imsiStr.isEmpty());
+
+}
+
+void tst_QDeclarativeDeviceInfo::tst_manufacturer()
+{
+ QDeclarativeDeviceInfo di;
+ QString manu = di.manufacturer();
+ QVERIFY(!manu.isEmpty() || manu.isEmpty());
+
+}
+
+void tst_QDeclarativeDeviceInfo::tst_model()
+{
+ QDeclarativeDeviceInfo di;
+ QString model = di.model();
+ QVERIFY(!model.isEmpty() || model.isEmpty());
+
+}
+
+void tst_QDeclarativeDeviceInfo::tst_productName()
+{
+ QDeclarativeDeviceInfo di;
+ QString product = di.productName();
+ QVERIFY(!product.isEmpty() | product.isEmpty());
+
+}
+
+void tst_QDeclarativeDeviceInfo::tst_batteryLevel()
+{
+ QDeclarativeDeviceInfo di;
+ QVERIFY(di.batteryLevel() > -1);
+
+// until we simulate this, or wait the signalspy to olong, this will always fail
+// if(di.currentPowerState() == QSystemDeviceInfo::WallPowerChargingBattery) {
+// QSignalSpy batSpy(&di, SIGNAL(batteryLevelChanged(int)));
+// QVERIFY(!batSpy.isEmpty());
+// int level = batSpy.first().at(0).toInt();
+// QVERIFY( level > -1 || level < 101);
+// }
+}
+
+void tst_QDeclarativeDeviceInfo::tst_batteryStatus()
+{
+ QDeclarativeDeviceInfo di;
+ int level = di.batteryLevel();
+ if(level < 4) {
+ QVERIFY(di.batteryStatus() ==QSystemDeviceInfo::BatteryCritical );
+ } else if(level < 11) {
+ QVERIFY(di.batteryStatus() == QSystemDeviceInfo::BatteryVeryLow);
+ } else if(level < 41) {
+ QVERIFY(di.batteryStatus() == QSystemDeviceInfo::BatteryLow);
+ } else if(level > 40) {
+ QVERIFY(di.batteryStatus() == QSystemDeviceInfo::BatteryNormal);
+ }
+
+ // until we simulate this, or wait the signalspy to olong, this will always fail
+// if(di.currentPowerState() == QSystemDeviceInfo::WallPowerChargingBattery) {
+// QSignalSpy batSpy(&di, SIGNAL(batteryStatusChanged(QSystemDeviceInfo::BatteryStatus)));
+// QVERIFY(!batSpy.isEmpty());
+// QSystemDeviceInfo::BatteryStatus status = qvariant_cast<QSystemDeviceInfo::BatteryStatus>(batSpy.first().at(0));
+// QVERIFY( status == QSystemDeviceInfo::NoBatteryLevel
+// || status == QSystemDeviceInfo::BatteryCritical
+// || status == QSystemDeviceInfo::BatteryVeryLow
+// || status == QSystemDeviceInfo::BatteryLow
+// || status == QSystemDeviceInfo::BatteryNormal);
+// }
+}
+
+void tst_QDeclarativeDeviceInfo::tst_currentProfile()
+{
+ QDeclarativeDeviceInfo di;
+ QSystemDeviceInfo::Profile profile = di.currentProfile();
+ QVERIFY( profile == QSystemDeviceInfo::UnknownProfile
+ || profile == QSystemDeviceInfo::SilentProfile
+ || profile == QSystemDeviceInfo::NormalProfile
+ || profile == QSystemDeviceInfo::LoudProfile
+ || profile == QSystemDeviceInfo::VibProfile
+ || profile == QSystemDeviceInfo::OfflineProfile
+ || profile == QSystemDeviceInfo::PowersaveProfile
+ || profile == QSystemDeviceInfo::CustomProfile);
+}
+
+void tst_QDeclarativeDeviceInfo::tst_simStatus()
+{
+ QDeclarativeDeviceInfo di;
+ bool simStat = di.simStatus();
+ QVERIFY(simStat == true || simStat == false);
+
+}
+
+void tst_QDeclarativeDeviceInfo::tst_isDeviceLocked()
+{
+ QDeclarativeDeviceInfo di;
+ bool devLock = di.isDeviceLocked();
+ QVERIFY(devLock == true || devLock == false);
+}
+
+void tst_QDeclarativeDeviceInfo::tst_currentPowerState()
+{
+ QDeclarativeDeviceInfo di;
+ QSystemDeviceInfo::PowerState state = di.currentPowerState();
+ QVERIFY( state == QSystemDeviceInfo::UnknownPower
+ || state == QSystemDeviceInfo::BatteryPower
+ || state == QSystemDeviceInfo::WallPower
+ || state == QSystemDeviceInfo::WallPowerChargingBattery);
+}
+
+void tst_QDeclarativeDeviceInfo::tst_currentBluetoothPowerState()
+{
+ QDeclarativeDeviceInfo di;
+ bool state = di.currentPowerState();
+ QVERIFY(state || !state);
+}
+
+
+void tst_QDeclarativeDeviceInfo::tst_keyboardType()
+{
+ QDeclarativeDeviceInfo di;
+ QSystemDeviceInfo::KeyboardTypeFlags flags = di.keyboardType();
+
+ QVERIFY( (flags && QSystemDeviceInfo::UnknownKeyboard == QSystemDeviceInfo::UnknownKeyboard)
+ || (flags && QSystemDeviceInfo::SoftwareKeyboard == QSystemDeviceInfo::SoftwareKeyboard)
+ || (flags && QSystemDeviceInfo::ITUKeypad == QSystemDeviceInfo::ITUKeypad)
+ || (flags && QSystemDeviceInfo::HalfQwertyKeyboard == QSystemDeviceInfo::HalfQwertyKeyboard)
+ || (flags && QSystemDeviceInfo::FullQwertyKeyboard == QSystemDeviceInfo::FullQwertyKeyboard)
+ || (flags && QSystemDeviceInfo::WirelessKeyboard == QSystemDeviceInfo::WirelessKeyboard));
+}
+
+void tst_QDeclarativeDeviceInfo::tst_isWirelessKeyboardConnected()
+{
+ QDeclarativeDeviceInfo di;
+ bool on = di.isWirelessKeyboardConnected();
+ QVERIFY(on || !on);
+}
+
+void tst_QDeclarativeDeviceInfo::tst_isKeyboardFlipOpen()
+{
+ QDeclarativeDeviceInfo di;
+ bool on = di.isKeyboardFlipOpen();
+ QVERIFY(on || !on);
+}
+
+void tst_QDeclarativeDeviceInfo::tst_keypadLightOn()
+
+{
+ QDeclarativeDeviceInfo di;
+ bool on = di.keypadLightOn(QSystemDeviceInfo::PrimaryKeypad);
+ QVERIFY(on || !on);
+ on = di.keypadLightOn(QSystemDeviceInfo::SecondaryKeypad);
+ QVERIFY(on || !on);
+
+}
+
+void tst_QDeclarativeDeviceInfo::tst_uniqueID()
+{
+ QDeclarativeDeviceInfo di;
+ QUuid id = di.uniqueID();
+ QVERIFY(id.isNull()|| !id.isNull());
+}
+
+void tst_QDeclarativeDeviceInfo::tst_lockStatus()
+{
+ QDeclarativeDeviceInfo di;
+ QSystemDeviceInfo::LockType lock = di.lockStatus();
+ if (di.isDeviceLocked()) {
+ QVERIFY((lock == QSystemDeviceInfo::DeviceLocked)
+ || (lock == QSystemDeviceInfo::TouchAndKeyboardLocked));
+ } else {
+ QVERIFY( lock == QSystemDeviceInfo::UnknownLock);
+ }
+}
+
+QTEST_MAIN(tst_QDeclarativeDeviceInfo)
+#include "tst_qdeclarativedeviceinfo.moc"
diff --git a/tests/auto/qdeclarativedisplayinfo/qdeclarativedisplayinfo.pro b/tests/auto/qdeclarativedisplayinfo/qdeclarativedisplayinfo.pro
new file mode 100644
index 0000000000..320b5ccc67
--- /dev/null
+++ b/tests/auto/qdeclarativedisplayinfo/qdeclarativedisplayinfo.pro
@@ -0,0 +1,21 @@
+TARGET = tst_qdeclarativedisplayinfo
+CONFIG+=testcase
+
+SOURCES += tst_qdeclarativedisplayinfo.cpp
+QT = core network gui
+HEADERS += ../../../plugins/declarative/systeminfo/qdeclarativedisplayinfo_p.h \
+ ../../../src/systeminfo/qsystemdisplayinfo.cpp
+
+SOURCES += ../../../plugins/declarative/systeminfo/qdeclarativedisplayinfo.cpp \
+ ../../../src/systeminfo/qsystemdisplayinfo.h
+
+INCLUDEPATH += ../../../src/systeminfo
+INCLUDEPATH += $$QT_MOBILITY_SOURCE_TREE/plugins/declarative/systeminfo
+
+include(../../../common.pri)
+CONFIG += mobility
+MOBILITY = systeminfo
+
+symbian {
+ TARGET.CAPABILITY = All -TCB -DRM
+}
diff --git a/tests/auto/qdeclarativedisplayinfo/tst_qdeclarativedisplayinfo.cpp b/tests/auto/qdeclarativedisplayinfo/tst_qdeclarativedisplayinfo.cpp
new file mode 100644
index 0000000000..e3305797b8
--- /dev/null
+++ b/tests/auto/qdeclarativedisplayinfo/tst_qdeclarativedisplayinfo.cpp
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=src/systeminfo
+
+#include <QtTest/QtTest>
+#include <QDesktopWidget>
+
+#include "qdeclarativedisplayinfo_p.h"
+#include <QDesktopWidget>
+
+QTM_USE_NAMESPACE
+
+Q_DECLARE_METATYPE(QSystemDisplayInfo::DisplayOrientation);
+
+class tst_QDeclarativeDisplayInfo : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void tst_displayBrightness();
+ void tst_colorDepth();
+ void tst_getOrientation();
+ void tst_contrast();
+ void tst_getDPIWidth();
+ void tst_getDPIHeight();
+ void tst_physicalHeight();
+ void tst_physicalWidth();
+
+};
+
+void tst_QDeclarativeDisplayInfo::tst_displayBrightness()
+{
+ QDeclarativeDisplayInfo di;
+ QVERIFY(di.displayBrightness(0) > -2);
+ QVERIFY(di.displayBrightness(999) == -1);
+}
+
+void tst_QDeclarativeDisplayInfo::tst_colorDepth()
+{
+ QDeclarativeDisplayInfo di;
+ int depth = di.colorDepth(0);
+ QDesktopWidget wid;
+ if(wid.screenCount() > 1) {
+ QVERIFY(depth == 0
+ || depth == 8
+ || depth == 16
+ || depth == 24
+ || depth == 32
+ || depth == 64);
+ }
+ QVERIFY(di.colorDepth(999) == -1);
+}
+
+void tst_QDeclarativeDisplayInfo::tst_getOrientation()
+{
+ QSystemDisplayInfo::DisplayOrientation orient = QSystemDisplayInfo::Unknown;
+ QDeclarativeDisplayInfo di;
+ orient = di.getOrientation(0);
+ QRect availableGeometry = QApplication::desktop()->availableGeometry(0);
+
+ if(availableGeometry.width() > availableGeometry.height()) {
+ QVERIFY(orient == QDeclarativeDisplayInfo::Landscape
+ || orient == QDeclarativeDisplayInfo::InvertedLandscape);
+ } else {
+ QVERIFY(orient == QDeclarativeDisplayInfo::Portrait
+ || orient == QDeclarativeDisplayInfo::InvertedPortrait);
+ }
+}
+
+void tst_QDeclarativeDisplayInfo::tst_contrast()
+{
+ QDeclarativeDisplayInfo di;
+ QVERIFY(di.contrast(0) >= 0
+ && di.contrast(0)< 1.0 );
+ // contrast levels are between 0 and 1.0
+}
+
+void tst_QDeclarativeDisplayInfo::tst_getDPIWidth()
+{
+ QDeclarativeDisplayInfo di;
+ QVERIFY(di.getDPIWidth(0) > -1);
+}
+
+void tst_QDeclarativeDisplayInfo::tst_getDPIHeight()
+{
+ QDeclarativeDisplayInfo di;
+ QVERIFY(di.getDPIHeight(0) > -1);
+}
+
+void tst_QDeclarativeDisplayInfo::tst_physicalHeight()
+{
+ QDeclarativeDisplayInfo di;
+ QVERIFY(di.physicalHeight(0) > -1);
+}
+
+void tst_QDeclarativeDisplayInfo::tst_physicalWidth()
+{
+ QDeclarativeDisplayInfo di;
+ QVERIFY(di.physicalWidth(0) > -1);
+}
+
+
+QTEST_MAIN(tst_QDeclarativeDisplayInfo)
+#include "tst_qdeclarativedisplayinfo.moc"
diff --git a/tests/auto/qdeclarativenetworkinfo/qdeclarativenetworkinfo.pro b/tests/auto/qdeclarativenetworkinfo/qdeclarativenetworkinfo.pro
new file mode 100644
index 0000000000..809c352fee
--- /dev/null
+++ b/tests/auto/qdeclarativenetworkinfo/qdeclarativenetworkinfo.pro
@@ -0,0 +1,22 @@
+TARGET = tst_qdeclarativenetworkinfo
+CONFIG+=testcase
+
+QT = core network
+QT += declarative
+
+SOURCES += tst_qdeclarativenetworkinfo.cpp
+
+HEADERS += ../../../plugins/declarative/systeminfo/qdeclarativenetworkinfo_p.h
+
+SOURCES += ../../../plugins/declarative/systeminfo/qdeclarativenetworkinfo.cpp
+
+INCLUDEPATH += ../../../src/systeminfo
+INCLUDEPATH += $$QT_MOBILITY_SOURCE_TREE/plugins/declarative/systeminfo
+
+include(../../../common.pri)
+CONFIG += mobility
+MOBILITY = systeminfo
+
+symbian {
+ TARGET.CAPABILITY = All -TCB -DRM
+}
diff --git a/tests/auto/qdeclarativenetworkinfo/tst_qdeclarativenetworkinfo.cpp b/tests/auto/qdeclarativenetworkinfo/tst_qdeclarativenetworkinfo.cpp
new file mode 100644
index 0000000000..88b79d92fc
--- /dev/null
+++ b/tests/auto/qdeclarativenetworkinfo/tst_qdeclarativenetworkinfo.cpp
@@ -0,0 +1,354 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=src/systeminfo
+
+#include <QtTest/QtTest>
+#include "qdeclarativenetworkinfo_p.h"
+
+QTM_USE_NAMESPACE
+Q_DECLARE_METATYPE(QSystemNetworkInfo::NetworkStatus);
+Q_DECLARE_METATYPE(QSystemNetworkInfo::NetworkMode);
+
+
+class tst_QDeclarativeNetworkInfo : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+ void initTestCase();
+ void tst_networkStatus();
+
+ void tst_networkSignalStrength_data();
+ void tst_networkSignalStrength();
+ void tst_cellId();
+ void tst_locationAreaCode();
+
+ void tst_currentMobileCountryCode(); // Mobile Country Code
+ void tst_currentMobileNetworkCode(); // Mobile Network Code
+
+ void tst_homeMobileCountryCode();
+ void tst_homeMobileNetworkCode();
+
+ void tst_networkName();
+
+ void tst_macAddress_data();
+ void tst_macAddress();
+
+ void tst_interfaceForMode();
+ void tst_currentMode();
+};
+//signal todo:
+// void networkStatusChanged(QSystemNetworkInfo::NetworkMode netmode, QSystemNetworkInfo::CellNetworkStatus netStatus);
+
+void tst_QDeclarativeNetworkInfo::initTestCase()
+{
+ qRegisterMetaType<QSystemNetworkInfo::NetworkStatus>("QSystemNetworkInfo::NetworkStatus");
+ qRegisterMetaType<QSystemNetworkInfo::NetworkMode>("QSystemNetworkInfo::NetworkMode");
+}
+
+
+void tst_QDeclarativeNetworkInfo::tst_networkStatus()
+{
+ QSystemNetworkInfo ni;
+ QList<QSystemNetworkInfo::NetworkMode> modeList;
+ modeList << QSystemNetworkInfo::GsmMode;
+ modeList << QSystemNetworkInfo::CdmaMode;
+ modeList << QSystemNetworkInfo::WcdmaMode;
+ modeList << QSystemNetworkInfo::WlanMode;
+ modeList << QSystemNetworkInfo::EthernetMode;
+ modeList << QSystemNetworkInfo::BluetoothMode;
+ modeList << QSystemNetworkInfo::WimaxMode;
+
+ modeList << QSystemNetworkInfo::GprsMode;
+ modeList << QSystemNetworkInfo::EdgeMode;
+ modeList << QSystemNetworkInfo::HspaMode;
+ modeList << QSystemNetworkInfo::LteMode;
+
+ foreach(QSystemNetworkInfo::NetworkMode mode, modeList) {
+ QSystemNetworkInfo::NetworkStatus status = ni.networkStatus(mode);
+
+ QVERIFY( status == QSystemNetworkInfo::UndefinedStatus
+ || status == QSystemNetworkInfo::NoNetworkAvailable
+ || status == QSystemNetworkInfo::EmergencyOnly
+ || status == QSystemNetworkInfo::Searching
+ || status == QSystemNetworkInfo::Busy
+ || status == QSystemNetworkInfo::Connected
+ || status == QSystemNetworkInfo::HomeNetwork
+ || status == QSystemNetworkInfo::Denied
+ || status == QSystemNetworkInfo::Roaming);
+ }
+
+}
+
+void tst_QDeclarativeNetworkInfo::tst_networkSignalStrength_data()
+{
+ QTest::addColumn<QSystemNetworkInfo::NetworkMode>("mode");
+
+ QTest::newRow("GsmMode") << QSystemNetworkInfo::GsmMode;
+ QTest::newRow("CdmaMode") << QSystemNetworkInfo::CdmaMode;
+ QTest::newRow("WcdmaMode") << QSystemNetworkInfo::WcdmaMode;
+ QTest::newRow("WlanMode") << QSystemNetworkInfo::WlanMode;
+ QTest::newRow("EthernetMode") << QSystemNetworkInfo::EthernetMode;
+ QTest::newRow("BluetoothMode") << QSystemNetworkInfo::BluetoothMode;
+ QTest::newRow("WimaxMode") << QSystemNetworkInfo::WimaxMode;
+
+ QTest::newRow("GprsMode") << QSystemNetworkInfo::GprsMode;
+ QTest::newRow("EdgeMode") << QSystemNetworkInfo::EdgeMode;
+ QTest::newRow("HspaMode") << QSystemNetworkInfo::HspaMode;
+ QTest::newRow("LteMode") << QSystemNetworkInfo::LteMode;
+}
+
+void tst_QDeclarativeNetworkInfo::tst_networkSignalStrength()
+{
+ {
+ QFETCH(QSystemNetworkInfo::NetworkMode, mode);
+ QSystemNetworkInfo ni;
+ qint32 strength = ni.networkSignalStrength(mode);
+ QVERIFY( strength > -2
+ && strength < 101);
+ }
+}
+
+void tst_QDeclarativeNetworkInfo::tst_cellId()
+{
+ QSystemNetworkInfo ni;
+ qint32 id = ni.cellId();
+ QVERIFY(id > -2);
+}
+
+void tst_QDeclarativeNetworkInfo::tst_locationAreaCode()
+{
+ QSystemNetworkInfo ni;
+ qint32 lac = ni.locationAreaCode();
+ QVERIFY(lac > -2);
+}
+
+
+void tst_QDeclarativeNetworkInfo::tst_currentMobileCountryCode()
+{
+ QSystemNetworkInfo ni;
+// qDebug() << ni.currentMobileCountryCode();
+ if(QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::GsmMode)
+ || QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::CdmaMode)
+ || QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::WcdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::GsmMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::CdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::WcdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::GprsMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::EdgeMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::HspaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::LteMode)
+ ) {
+ QVERIFY(!ni.currentMobileCountryCode().isEmpty());
+ bool ok;
+ int cc = ni.currentMobileCountryCode().toInt(&ok);
+ QVERIFY(ok);
+ QVERIFY(ni.currentMobileCountryCode().count() == 3);
+ } else {
+ QVERIFY(ni.currentMobileCountryCode().isEmpty());
+ }
+}
+
+void tst_QDeclarativeNetworkInfo::tst_currentMobileNetworkCode()
+{
+ QSystemNetworkInfo ni;
+ if(QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::GsmMode)
+ || QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::CdmaMode)
+ || QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::WcdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::GsmMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::CdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::WcdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::GprsMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::EdgeMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::HspaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::LteMode)
+ ) {
+ QVERIFY(!ni.currentMobileNetworkCode().isEmpty());
+ bool ok;
+ int cc = ni.currentMobileCountryCode().toInt(&ok);
+ QVERIFY(ok);
+ QVERIFY((ni.currentMobileCountryCode().count() == 3)
+ || (ni.currentMobileCountryCode().count() == 2));
+ } else {
+ QVERIFY(ni.currentMobileNetworkCode().isEmpty());
+ }
+}
+
+
+void tst_QDeclarativeNetworkInfo::tst_homeMobileCountryCode()
+{
+ QSystemNetworkInfo ni;
+ if(QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::GsmMode)
+ || QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::CdmaMode)
+ || QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::WcdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::GsmMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::CdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::WcdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::GprsMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::EdgeMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::HspaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::LteMode)
+ ) {
+ QVERIFY(!ni.homeMobileCountryCode().isEmpty());
+ bool ok;
+ int cc = ni.currentMobileCountryCode().toInt(&ok);
+ QVERIFY(ok);
+ QVERIFY(ni.currentMobileCountryCode().count() == 3);
+ } else {
+ QVERIFY(ni.homeMobileCountryCode().isEmpty());
+ }
+}
+
+void tst_QDeclarativeNetworkInfo::tst_homeMobileNetworkCode()
+{
+ QSystemNetworkInfo ni;
+ if(QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::GsmMode)
+ || QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::CdmaMode)
+ || QSystemNetworkInfo::HomeNetwork == ni.networkStatus(QSystemNetworkInfo::WcdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::GsmMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::CdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::WcdmaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::GprsMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::EdgeMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::HspaMode)
+ || QSystemNetworkInfo::Roaming == ni.networkStatus(QSystemNetworkInfo::LteMode)
+ ) {
+ QVERIFY(!ni.homeMobileNetworkCode().isEmpty());
+ bool ok;
+ int cc = ni.currentMobileCountryCode().toInt(&ok);
+ QVERIFY(ok);
+ QVERIFY((ni.currentMobileCountryCode().count() == 3)
+ || (ni.currentMobileCountryCode().count() == 2));
+ } else {
+ QVERIFY(ni.homeMobileNetworkCode().isEmpty());
+ }
+}
+
+void tst_QDeclarativeNetworkInfo::tst_networkName()
+{
+ QSystemNetworkInfo ni;
+ QList<QSystemNetworkInfo::NetworkMode> modeList;
+ modeList << QSystemNetworkInfo::GsmMode;
+ modeList << QSystemNetworkInfo::CdmaMode;
+ modeList << QSystemNetworkInfo::WcdmaMode;
+ modeList << QSystemNetworkInfo::WlanMode;
+ modeList << QSystemNetworkInfo::EthernetMode;
+ modeList << QSystemNetworkInfo::BluetoothMode;
+ modeList << QSystemNetworkInfo::WimaxMode;
+
+ modeList << QSystemNetworkInfo::GprsMode;
+ modeList << QSystemNetworkInfo::EdgeMode;
+ modeList << QSystemNetworkInfo::HspaMode;
+ modeList << QSystemNetworkInfo::LteMode;
+
+ foreach(QSystemNetworkInfo::NetworkMode mode, modeList) {
+ QVERIFY(!ni.networkName(mode).isEmpty()
+ ||ni.networkName(mode).isEmpty());
+ }
+}
+
+
+void tst_QDeclarativeNetworkInfo::tst_macAddress_data()
+{
+ tst_networkSignalStrength_data();
+}
+
+void tst_QDeclarativeNetworkInfo::tst_macAddress()
+{
+ QFETCH(QSystemNetworkInfo::NetworkMode, mode);
+ QSystemNetworkInfo ni;
+ QString mac = ni.macAddress(mode);
+ if (!mac.isEmpty()) {
+ QVERIFY(mac.length() == 17);
+ QVERIFY(mac.contains(":"));
+ }
+}
+
+void tst_QDeclarativeNetworkInfo::tst_interfaceForMode()
+{
+ QSystemNetworkInfo ni;
+ QList<QSystemNetworkInfo::NetworkMode> modeList;
+ modeList << QSystemNetworkInfo::GsmMode;
+ modeList << QSystemNetworkInfo::CdmaMode;
+ modeList << QSystemNetworkInfo::WcdmaMode;
+ modeList << QSystemNetworkInfo::WlanMode;
+ modeList << QSystemNetworkInfo::EthernetMode;
+ modeList << QSystemNetworkInfo::BluetoothMode;
+ modeList << QSystemNetworkInfo::WimaxMode;
+
+ modeList << QSystemNetworkInfo::GprsMode;
+ modeList << QSystemNetworkInfo::EdgeMode;
+ modeList << QSystemNetworkInfo::HspaMode;
+ modeList << QSystemNetworkInfo::LteMode;
+
+ foreach(QSystemNetworkInfo::NetworkMode mode, modeList) {
+ QVERIFY(!ni.interfaceForMode(mode).name().isEmpty()
+ || !ni.interfaceForMode(mode).isValid());
+ }
+
+}
+
+void tst_QDeclarativeNetworkInfo::tst_currentMode()
+{
+ QSystemNetworkInfo ni;
+ QSystemNetworkInfo::NetworkMode mode = ni.currentMode();
+
+ QVERIFY( mode == QSystemNetworkInfo::UnknownMode
+ || mode == QSystemNetworkInfo::GsmMode
+ || mode == QSystemNetworkInfo::CdmaMode
+ || mode == QSystemNetworkInfo::WcdmaMode
+ || mode == QSystemNetworkInfo::WlanMode
+ || mode == QSystemNetworkInfo::EthernetMode
+ || mode == QSystemNetworkInfo::BluetoothMode
+ || mode == QSystemNetworkInfo::WimaxMode
+
+ || mode == QSystemNetworkInfo::GprsMode
+ || mode == QSystemNetworkInfo::EdgeMode
+ || mode == QSystemNetworkInfo::HspaMode
+ || mode == QSystemNetworkInfo::LteMode
+ );
+}
+
+
+QTEST_MAIN(tst_QDeclarativeNetworkInfo)
+#include "tst_qdeclarativenetworkinfo.moc"
diff --git a/tests/auto/qdeclarativescreensaver/qdeclarativescreensaver.pro b/tests/auto/qdeclarativescreensaver/qdeclarativescreensaver.pro
new file mode 100644
index 0000000000..418683970d
--- /dev/null
+++ b/tests/auto/qdeclarativescreensaver/qdeclarativescreensaver.pro
@@ -0,0 +1,21 @@
+TARGET = tst_qdeclarativescreensaver
+CONFIG+=testcase
+QT = gui core network
+QT += declarative
+
+INCLUDEPATH += ../../../src/systeminfo
+INCLUDEPATH += $$QT_MOBILITY_SOURCE_TREE/plugins/declarative/systeminfo
+
+SOURCES += tst_qdeclarativescreensaver.cpp
+HEADERS += ../../../plugins/declarative/systeminfo/qdeclarativescreensaver_p.h
+
+SOURCES += ../../../plugins/declarative/systeminfo/qdeclarativescreensaver.cpp
+
+include(../../../common.pri)
+CONFIG += mobility
+MOBILITY = systeminfo
+
+symbian {
+ TARGET.CAPABILITY = All -TCB -DRM
+}
+
diff --git a/tests/auto/qdeclarativescreensaver/tst_qdeclarativescreensaver.cpp b/tests/auto/qdeclarativescreensaver/tst_qdeclarativescreensaver.cpp
new file mode 100644
index 0000000000..029321fcb7
--- /dev/null
+++ b/tests/auto/qdeclarativescreensaver/tst_qdeclarativescreensaver.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=src/systeminfo
+
+#include <QtTest/QtTest>
+#include "qdeclarativescreensaver_p.h"
+
+QTM_USE_NAMESPACE
+class tst_QDeclarativeScreenSaver : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void tst_setScreenSaverDelayed();
+};
+
+void tst_QDeclarativeScreenSaver::tst_setScreenSaverDelayed()
+{
+ QDeclarativeScreenSaver si;
+ si.setScreenSaverDelayed(true);
+ bool enabled = si.screenSaverDelayed();
+ QVERIFY(enabled);
+ si.setScreenSaverDelayed(false);
+ enabled = si.screenSaverDelayed();
+ QVERIFY(!enabled);
+
+}
+
+QTEST_MAIN(tst_QDeclarativeScreenSaver)
+#include "tst_qdeclarativescreensaver.moc"
diff --git a/tests/auto/qdeclarativestorageinfo/qdeclarativestorageinfo.pro b/tests/auto/qdeclarativestorageinfo/qdeclarativestorageinfo.pro
new file mode 100644
index 0000000000..8b48b9ef87
--- /dev/null
+++ b/tests/auto/qdeclarativestorageinfo/qdeclarativestorageinfo.pro
@@ -0,0 +1,27 @@
+HEADERS +=
+TARGET = tst_qdeclarativestorageinfo
+CONFIG+=testcase
+
+QT = core network
+QT += declarative
+
+SOURCES += tst_qdeclarativestorageinfo.cpp
+
+HEADERS += ../../../plugins/declarative/systeminfo/qdeclarativestorageinfo_p.h \
+ ../../../src/systeminfo/qsystemstorageinfo.cpp
+
+SOURCES += ../../../plugins/declarative/systeminfo/qdeclarativestorageinfo.cpp \
+ ../../../src/systeminfo/qsystemstorageinfo.h
+
+INCLUDEPATH += ../../../src/systeminfo
+INCLUDEPATH += $$QT_MOBILITY_SOURCE_TREE/plugins/declarative/systeminfo
+
+include(../../../common.pri)
+CONFIG += mobility
+MOBILITY = systeminfo
+
+symbian {
+ TARGET.CAPABILITY = All -TCB -DRM
+}
+
+
diff --git a/tests/auto/qdeclarativestorageinfo/tst_qdeclarativestorageinfo.cpp b/tests/auto/qdeclarativestorageinfo/tst_qdeclarativestorageinfo.cpp
new file mode 100644
index 0000000000..3e6bf60bae
--- /dev/null
+++ b/tests/auto/qdeclarativestorageinfo/tst_qdeclarativestorageinfo.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=src/systeminfo
+
+#include <QtTest/QtTest>
+#include "qdeclarativestorageinfo_p.h"
+
+QTM_USE_NAMESPACE
+Q_DECLARE_METATYPE(QSystemStorageInfo::DriveType);
+Q_DECLARE_METATYPE(QSystemStorageInfo::StorageState);
+
+class tst_QDeclarativeStorageInfo : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+
+ void tst_totalDiskSpace();
+ void tst_availableDiskSpace();
+ void tst_logicalDrives();
+ void tst_typeForDrive();
+ void tst_getStorageState();
+
+};
+
+void tst_QDeclarativeStorageInfo::initTestCase()
+{
+ qRegisterMetaType<QSystemStorageInfo::DriveType>("QSystemStorageInfo::VolumeType");
+}
+
+void tst_QDeclarativeStorageInfo::tst_totalDiskSpace()
+{
+ QDeclarativeStorageInfo mi;
+ QStringList volList = mi.logicalDrives();
+ foreach(QString vol, volList) {
+ QVERIFY(mi.totalDiskSpace(vol) > -1);
+ }
+}
+
+void tst_QDeclarativeStorageInfo::tst_availableDiskSpace()
+{
+ QDeclarativeStorageInfo mi;
+ QStringList volList = mi.logicalDrives();
+ foreach(QString vol, volList) {
+ QVERIFY(mi.availableDiskSpace(vol) > -1);
+ }
+}
+
+void tst_QDeclarativeStorageInfo::tst_logicalDrives()
+{
+ QDeclarativeStorageInfo mi;
+ QVERIFY(mi.logicalDrives().count() > -1);
+}
+
+void tst_QDeclarativeStorageInfo::tst_typeForDrive()
+{
+ QDeclarativeStorageInfo mi;
+ QStringList volList = mi.logicalDrives();
+ foreach(QString vol, volList) {
+ QSystemStorageInfo::DriveType type = mi.typeForDrive(vol);
+
+ QVERIFY(type == QSystemStorageInfo::NoDrive
+ || type == QSystemStorageInfo::CdromDrive
+ || type == QSystemStorageInfo::InternalDrive
+ || type == QSystemStorageInfo::RemoteDrive
+ || type == QSystemStorageInfo::RemovableDrive
+ || type == QSystemStorageInfo::InternalFlashDrive
+ || type == QSystemStorageInfo::RamDrive
+ );
+ }
+}
+
+void tst_QDeclarativeStorageInfo::tst_getStorageState()
+{
+ QDeclarativeStorageInfo mi;
+ QStringList volList = mi.logicalDrives();
+ foreach(QString vol, volList) {
+ QSystemStorageInfo::StorageState state = mi.getStorageState(vol);
+ QVERIFY(state == QSystemStorageInfo::UnknownStorageState
+ || state == QSystemStorageInfo::NormalStorageState
+ || state == QSystemStorageInfo::LowStorageState
+ || state == QSystemStorageInfo::VeryLowStorageState
+ || state == QSystemStorageInfo::CriticalStorageState);
+ }
+}
+
+
+QTEST_MAIN(tst_QDeclarativeStorageInfo)
+#include "tst_qdeclarativestorageinfo.moc"
diff --git a/tests/auto/qdeclarativesysteminfo/qdeclarativesysteminfo.pro b/tests/auto/qdeclarativesysteminfo/qdeclarativesysteminfo.pro
new file mode 100644
index 0000000000..89d8bd855f
--- /dev/null
+++ b/tests/auto/qdeclarativesysteminfo/qdeclarativesysteminfo.pro
@@ -0,0 +1,22 @@
+TARGET = tst_qdeclarativesysteminfo
+CONFIG+=testcase
+
+SOURCES += tst_qdeclarativesysteminfo.cpp
+QT = core network
+QT += declarative
+
+HEADERS += ../../../plugins/declarative/systeminfo/qdeclarativegeneralinfo_p.h
+
+SOURCES += ../../../plugins/declarative/systeminfo/qdeclarativegeneralinfo.cpp
+
+INCLUDEPATH += ../../../src/systeminfo
+INCLUDEPATH += $$QT_MOBILITY_SOURCE_TREE/plugins/declarative/systeminfo
+
+
+include(../../../common.pri)
+CONFIG += mobility
+MOBILITY = systeminfo
+
+symbian {
+ TARGET.CAPABILITY = All -TCB -DRM
+}
diff --git a/tests/auto/qdeclarativesysteminfo/tst_qdeclarativesysteminfo.cpp b/tests/auto/qdeclarativesysteminfo/tst_qdeclarativesysteminfo.cpp
new file mode 100644
index 0000000000..25e1b298d5
--- /dev/null
+++ b/tests/auto/qdeclarativesysteminfo/tst_qdeclarativesysteminfo.cpp
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=src/systeminfo
+
+#include <QtTest/QtTest>
+#include "qdeclarativegeneralinfo_p.h"
+#include <QDebug>
+
+QTM_USE_NAMESPACE
+Q_DECLARE_METATYPE(QSystemInfo::Version);
+Q_DECLARE_METATYPE(QSystemInfo::Feature);
+
+class tst_QDeclarativeSystemInfo : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+
+ void tst_currentLanguage();
+ void tst_availableLanguages();
+
+ void tst_versions_data();
+ void tst_versions();
+
+ void tst_countryCode();
+
+ void tst_hasFeatures_data();
+ void tst_hasFeatures();
+
+ void tst_detailFeatures_data();
+ void tst_detailFeatures();
+};
+
+void tst_QDeclarativeSystemInfo::initTestCase()
+{
+ qRegisterMetaType<QSystemInfo::Version>("QSystemInfo::Version");
+ qRegisterMetaType<QSystemInfo::Feature>("QSystemInfo::Feature");
+}
+
+void tst_QDeclarativeSystemInfo::tst_currentLanguage()
+{
+ QDeclarativeGeneralInfo si;
+ QVERIFY(!si.currentLanguage().isEmpty());
+ QCOMPARE(si.currentLanguage().length(), 2);
+ QVERIFY(si.currentLanguage() == si.currentLanguage().toLower());
+
+}
+
+void tst_QDeclarativeSystemInfo::tst_availableLanguages()
+{
+ QDeclarativeGeneralInfo si;
+ QVERIFY(!si.availableLanguages().isEmpty());
+ QStringList available = si.availableLanguages();
+ foreach(QString lang, available) {
+ QCOMPARE(lang.length(), 2);
+ QVERIFY(lang == lang.toLower());
+ }
+}
+
+void tst_QDeclarativeSystemInfo::tst_versions_data()
+{
+ QTest::addColumn<QSystemInfo::Version>("version");
+ QTest::addColumn<QString>("parameter");
+
+ QTest::newRow("Os") << QSystemInfo::Os << "";
+ QTest::newRow("QtCore") << QSystemInfo::QtCore << "";
+ QTest::newRow("Firmware") << QSystemInfo::Firmware << "";
+
+}
+
+void tst_QDeclarativeSystemInfo::tst_versions()
+{
+ {
+ QFETCH(QSystemInfo::Version, version);
+ QFETCH(QString, parameter);
+ QDeclarativeGeneralInfo si;
+ QString vers = si.version(version, parameter);
+ QVERIFY(!vers.isEmpty()
+ || vers.isEmpty());
+ }
+}
+
+void tst_QDeclarativeSystemInfo::tst_countryCode()
+{
+ QDeclarativeGeneralInfo si;
+ QVERIFY(!si.currentCountryCode().isEmpty());
+ QCOMPARE(si.currentCountryCode().length(),2);
+ QVERIFY(si.currentCountryCode() == si.currentCountryCode().toUpper());
+}
+
+void tst_QDeclarativeSystemInfo::tst_hasFeatures_data()
+{
+ QTest::addColumn<QSystemInfo::Feature>("feature");
+
+ QTest::newRow("Bluetooth") << QSystemInfo::BluetoothFeature;
+ QTest::newRow("CameraFeature") << QSystemInfo::CameraFeature;
+ QTest::newRow("FmradioFeature") << QSystemInfo::FmradioFeature;
+ QTest::newRow("IrFeature") << QSystemInfo::IrFeature;
+ QTest::newRow("LedFeature") << QSystemInfo::LedFeature;
+ QTest::newRow("MemcardFeature") << QSystemInfo::MemcardFeature;
+ QTest::newRow("UsbFeature") << QSystemInfo::UsbFeature;
+ QTest::newRow("VibFeature") << QSystemInfo::VibFeature;
+ QTest::newRow("WlanFeature") << QSystemInfo::WlanFeature;
+ QTest::newRow("SimFeature") << QSystemInfo::SimFeature;
+ QTest::newRow("LocationFeature") << QSystemInfo::LocationFeature;
+ QTest::newRow("VideoOutFeature") << QSystemInfo::VideoOutFeature;
+ QTest::newRow("HapticsFeature") << QSystemInfo::HapticsFeature;
+}
+
+void tst_QDeclarativeSystemInfo::tst_hasFeatures()
+{
+ {
+ QFETCH(QSystemInfo::Feature, feature);
+ QDeclarativeGeneralInfo si;
+ qWarning() << si.hasFeatureSupported(feature);
+ QVERIFY(si.hasFeatureSupported(feature) == false
+ || si.hasFeatureSupported(feature) == true);
+ }
+}
+
+void tst_QDeclarativeSystemInfo::tst_detailFeatures_data()
+{
+ tst_hasFeatures_data();
+}
+
+void tst_QDeclarativeSystemInfo::tst_detailFeatures()
+{
+// {
+// QFETCH(QSystemInfo::Feature, feature);
+// QDeclarativeGeneralInfo si;
+// QVERIFY(!si.getDetailOfFeature(feature).isEmpty());
+// }
+}
+
+
+QTEST_MAIN(tst_QDeclarativeSystemInfo)
+#include "tst_qdeclarativesysteminfo.moc"
diff --git a/tests/auto/qsystembatteryinfo/qsystembatteryinfo.pro b/tests/auto/qsystembatteryinfo/qsystembatteryinfo.pro
new file mode 100644
index 0000000000..ccf258613f
--- /dev/null
+++ b/tests/auto/qsystembatteryinfo/qsystembatteryinfo.pro
@@ -0,0 +1,15 @@
+TARGET = tst_qsystembatteryinfo
+CONFIG+=testcase
+
+SOURCES += tst_qsystembatteryinfo.cpp
+QT = core
+DEFINES += TESTR
+INCLUDEPATH += ../../../src/systeminfo
+
+include(../../../common.pri)
+CONFIG += mobility
+MOBILITY = systeminfo
+
+symbian {
+ TARGET.CAPABILITY = All -TCB -DRM
+}
diff --git a/tests/auto/qsystembatteryinfo/tst_qsystembatteryinfo.cpp b/tests/auto/qsystembatteryinfo/tst_qsystembatteryinfo.cpp
new file mode 100644
index 0000000000..1539c5301b
--- /dev/null
+++ b/tests/auto/qsystembatteryinfo/tst_qsystembatteryinfo.cpp
@@ -0,0 +1,456 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=src/systeminfo
+
+#include <QtTest/QtTest>
+#include "qsysteminfo.h"
+//#include "qsysteminfo_simulator_p.h"
+#include <QDebug>
+
+QTM_USE_NAMESPACE
+Q_DECLARE_METATYPE(QSystemBatteryInfo::BatteryStatus);
+Q_DECLARE_METATYPE(QSystemBatteryInfo::ChargingState);
+Q_DECLARE_METATYPE(QSystemBatteryInfo::ChargerType);
+Q_DECLARE_METATYPE(QSystemBatteryInfo::EnergyUnit);
+
+/**
+ * Starts an event loop that runs until the given signal is received.
+ * Optionally the event loop can return earlier on a timeout.
+ *
+ * \return \p true if the requested signal was received
+ * \p false on timeout
+ */
+static bool waitForSignal(QObject *obj, const char *signal, int timeout = 0)
+{
+ QEventLoop loop;
+ QObject::connect(obj, signal, &loop, SLOT(quit()));
+ QTimer timer;
+ QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));
+ if (timeout > 0) {
+ QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ timer.setSingleShot(true);
+ timer.start(timeout);
+ }
+ loop.exec();
+ return timeoutSpy.isEmpty();
+}
+
+//class ChangeBatteryThread : public QThread
+//{
+//public:
+// void run()
+// {
+// QSystemBatteryInfo bi;
+// QSystemBatteryInfoPrivate *bip = bi.priv;
+// }
+
+//};
+
+class tst_QSystemBatteryInfo : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QSystemBatteryInfo();
+ virtual ~tst_QSystemBatteryInfo();
+
+ friend class QSystemBatteryInfo;
+
+private slots:
+ void initTestCase();
+
+ void tst_chargerType();
+ void tst_chargingState();
+
+ void tst_nominalCapacity();
+ void tst_remainingCapacityPercent();
+ void tst_remainingCapacity();
+
+ void tst_voltage();
+ void tst_remainingChargingTime();
+ void tst_currentFlow();
+ void tst_remainingCapacityBars();
+ void tst_maxBars();
+ void tst_batteryStatus();
+ void tst_energyMeasurementUnit();
+
+
+ //signal tests
+// void tst_batteryLevelChanged();
+// void tst_batteryStatusChanged();
+
+
+// void tst_chargingStateChanged();
+// void tst_chargerTypeChanged();
+
+// void tst_nominalCapacityChanged();
+// void tst_remainingCapacityPercentChanged();
+// void tst_remainingCapacityChanged();
+// void tst_voltageChanged();
+
+// void tst_currentFlowChanged();
+// void tst_cumulativeCurrentFlowChanged();
+// void tst_remainingCapacityBarsChanged();
+// void tst_remainingChargingTimeChanged();
+
+
+// //signals
+// void batteryLevelChanged(int level);
+// void batteryStatusChanged(QSystemBatteryInfo::BatteryStatus batteryStatus);
+
+
+// void chargingStateChanged(QSystemBatteryInfo::ChargingState chargingState);
+// void chargerTypeChanged(QSystemBatteryInfo::ChargerType chargerType);
+
+// void nominalCapacityChanged(int);
+// void remainingCapacityPercentChanged(int);
+// void remainingCapacityChanged(int);
+// void voltageChanged(int);
+
+// void currentFlowChanged(int);
+// void cumulativeCurrentFlowChanged(int);
+// void remainingCapacityBarsChanged(int);
+// void remainingChargingTimeChanged(int);
+
+
+// ChangeBatteryThread *changeBatteryThread;
+};
+
+tst_QSystemBatteryInfo::tst_QSystemBatteryInfo()
+{
+ // changeBatteryThread = new ChangeBatteryThread();
+}
+
+tst_QSystemBatteryInfo::~tst_QSystemBatteryInfo()
+{
+ //delete changeBatteryThread, changeBatteryThread = 0;
+}
+/*
+ SystemInfoConnection si;
+ QSystemBatteryInfoPrivate *bip = si.batteryInfoPrivate();
+*/
+
+void tst_QSystemBatteryInfo::initTestCase()
+{
+ qRegisterMetaType<QSystemBatteryInfo::BatteryStatus>("QSystemBatteryInfo::BatteryStatus");
+ qRegisterMetaType<QSystemBatteryInfo::ChargingState>("QSystemBatteryInfo::ChargingState");
+ qRegisterMetaType<QSystemBatteryInfo::ChargerType>("QSystemBatteryInfo::ChargerType");
+ qRegisterMetaType<QSystemBatteryInfo::EnergyUnit>("QSystemBatteryInfo::EnergyUnit");
+}
+
+void tst_QSystemBatteryInfo::tst_chargerType()
+{
+ QSystemBatteryInfo bi;
+ QSystemBatteryInfo::ChargerType cType = bi.chargerType();
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ QVERIFY(cType == QSystemBatteryInfo::NoCharger
+ || cType == QSystemBatteryInfo::UnknownCharger);
+ } else {
+ QVERIFY(cType == QSystemBatteryInfo::WallCharger
+ || cType == QSystemBatteryInfo::USBCharger
+ || cType == QSystemBatteryInfo::USB_500mACharger
+ || cType == QSystemBatteryInfo::USB_100mACharger
+ || cType == QSystemBatteryInfo::VariableCurrentCharger);
+
+ }
+}
+
+void tst_QSystemBatteryInfo::tst_chargingState()
+{
+ QSystemBatteryInfo bi;
+ QSystemBatteryInfo::ChargingState cState = bi.chargingState();
+
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ QVERIFY(cState == QSystemBatteryInfo::NotCharging
+ || cState == QSystemBatteryInfo::ChargingError);
+ } else {
+ QVERIFY(cState == QSystemBatteryInfo::Charging
+ || cState == QSystemBatteryInfo::NotCharging);
+ }
+}
+
+ QSystemBatteryInfo bi;
+void tst_QSystemBatteryInfo::tst_nominalCapacity()
+{
+ QSystemBatteryInfo bi;
+ int nom = bi.nominalCapacity();
+ QVERIFY(nom != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QSystemBatteryInfo::tst_remainingCapacityPercent()
+{
+ QSystemBatteryInfo bi;
+ int rem = bi.remainingCapacityPercent();
+ QVERIFY(rem != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QSystemBatteryInfo::tst_remainingCapacity()
+{
+ QSystemBatteryInfo bi;
+ int rem = bi.remainingCapacity();
+ QVERIFY(rem != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QSystemBatteryInfo::tst_voltage()
+{
+ QSystemBatteryInfo bi;
+ int volt = bi.voltage();
+ QVERIFY(volt != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QSystemBatteryInfo::tst_remainingChargingTime()
+{
+ QSystemBatteryInfo bi;
+ int rem = bi.remainingChargingTime();
+ QVERIFY(rem != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QSystemBatteryInfo::tst_currentFlow()
+{
+ QSystemBatteryInfo bi;
+ int flow = bi.currentFlow();
+ QVERIFY(flow != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QSystemBatteryInfo::tst_remainingCapacityBars()
+{
+ QSystemBatteryInfo bi;
+ int rem = bi.remainingCapacityBars();
+ QVERIFY(rem != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QSystemBatteryInfo::tst_maxBars()
+{
+ QSystemBatteryInfo bi;
+ int max = bi.maxBars();
+ QVERIFY(max != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QSystemBatteryInfo::tst_batteryStatus()
+{
+ QSystemBatteryInfo bi;
+ QSystemBatteryInfo::BatteryStatus bstatus = bi.batteryStatus();
+ QVERIFY(bstatus != -1);
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+void tst_QSystemBatteryInfo::tst_energyMeasurementUnit()
+{
+ QSystemBatteryInfo bi;
+ if (bi.batteryStatus() == QSystemBatteryInfo::BatteryUnknown) {
+ } else {
+
+ }
+}
+
+////signal tests
+//void tst_QSystemBatteryInfo::tst_batteryLevelChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+//void tst_QSystemBatteryInfo::tst_batteryStatusChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+//void tst_QSystemBatteryInfo::tst_chargingStateChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+//void tst_QSystemBatteryInfo::tst_chargerTypeChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+//void tst_QSystemBatteryInfo::tst_nominalCapacityChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+//void tst_QSystemBatteryInfo::tst_remainingCapacityPercentChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+//void tst_QSystemBatteryInfo::tst_remainingCapacityChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+//void tst_QSystemBatteryInfo::tst_voltageChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+//void tst_QSystemBatteryInfo::tst_currentFlowChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+//void tst_QSystemBatteryInfo::tst_cumulativeCurrentFlowChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+//void tst_QSystemBatteryInfo::tst_remainingCapacityBarsChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+//void tst_QSystemBatteryInfo::tst_remainingChargingTimeChanged()
+//{
+// QSystemBatteryInfo bi;
+
+//}
+
+////signals
+//void tst_QSystemBatteryInfo::batteryLevelChanged(int level)
+//{
+
+//}
+
+//void tst_QSystemBatteryInfo::batteryStatusChanged(QSystemBatteryInfo::BatteryStatus batteryStatus)
+//{
+
+//}
+
+//void tst_QSystemBatteryInfo::chargingStateChanged(QSystemBatteryInfo::ChargingState chargingState)
+//{
+
+//}
+
+//void tst_QSystemBatteryInfo::chargerTypeChanged(QSystemBatteryInfo::ChargerType chargerType)
+//{
+
+//}
+
+//void tst_QSystemBatteryInfo::nominalCapacityChanged(int)
+//{
+
+//}
+
+//void tst_QSystemBatteryInfo::remainingCapacityPercentChanged(int)
+//{
+
+//}
+
+//void tst_QSystemBatteryInfo::remainingCapacityChanged(int)
+//{
+
+//}
+
+//void tst_QSystemBatteryInfo::voltageChanged(int)
+//{
+
+//}
+
+//void tst_QSystemBatteryInfo::currentFlowChanged(int)
+//{
+
+//}
+
+//void tst_QSystemBatteryInfo::cumulativeCurrentFlowChanged(int)
+//{
+
+//}
+
+//void tst_QSystemBatteryInfo::remainingCapacityBarsChanged(int)
+//{
+
+//}
+
+//void tst_QSystemBatteryInfo::remainingChargingTimeChanged(int)
+//{
+
+//}
+
+
+QTEST_MAIN(tst_QSystemBatteryInfo)
+#include "tst_qsystembatteryinfo.moc"
diff --git a/tests/auto/systeminfo.pro b/tests/auto/systeminfo.pro
index 6917000abc..2845272a91 100644
--- a/tests/auto/systeminfo.pro
+++ b/tests/auto/systeminfo.pro
@@ -8,9 +8,19 @@ SUBDIRS += qsysteminfo \
qsystemdisplayinfo \
qsystemstorageinfo \
qsystemnetworkinfo \
- qsystemscreensaver
+ qsystemscreensaver \
+ qsystembatteryinfo
maemo6: {
- #maemo6 spesific autotests
+ #maemo6 specific autotests
SUBDIRS += maemo6
}
+contains(QT_CONFIG,declarative) {
+SUBDIRS += qdeclarativebatteryinfo \
+ qdeclarativedeviceinfo \
+# qdeclarativedisplayinfo \
+ qdeclarativesysteminfo \
+ qdeclarativenetworkinfo \
+ qdeclarativescreensaver \
+# qdeclarativestorageinfo
+}