summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFabian Bumberger <fbumberger@rim.com>2013-12-13 18:04:45 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-20 16:15:29 +0100
commit23a3863de809a4051ae6db4942145cb0cb624d6c (patch)
tree1348e51ec170e748c3564f8cc1783c3d5c0b5b30 /tests
parent28ccba26be29722703dffff9f7482ed55caffdac (diff)
Check the local adapter's BluetoothAdress before doing the discovery
Task-number: QTBUG-35571 Change-Id: I8f2eea7a8437787d61a238c760e948f45738618a Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp20
-rw-r--r--tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp19
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
index fd923f0e..d20458fd 100644
--- a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
@@ -86,6 +86,8 @@ private slots:
void tst_properties();
+ void tst_invalidBtAddress();
+
void tst_startStopDeviceDiscoveries();
void tst_deviceDiscovery_data();
@@ -143,6 +145,24 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_properties()
QCOMPARE(discoveryAgent.inquiryType(), QBluetoothDeviceDiscoveryAgent::GeneralUnlimitedInquiry);
}
+void tst_QBluetoothDeviceDiscoveryAgent::tst_invalidBtAddress()
+{
+ QBluetoothDeviceDiscoveryAgent *discoveryAgent = new QBluetoothDeviceDiscoveryAgent(QBluetoothAddress("11:11:11:11:11:11"));
+
+ QCOMPARE(discoveryAgent->error(), QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError);
+ discoveryAgent->start();
+ QCOMPARE(discoveryAgent->isActive(), false);
+ delete discoveryAgent;
+
+ discoveryAgent = new QBluetoothDeviceDiscoveryAgent(QBluetoothAddress());
+ QCOMPARE(discoveryAgent->error(), QBluetoothDeviceDiscoveryAgent::NoError);
+ if (QBluetoothLocalDevice::allDevices().count() > 0) {
+ discoveryAgent->start();
+ QCOMPARE(discoveryAgent->isActive(), true);
+ }
+ delete discoveryAgent;
+}
+
void tst_QBluetoothDeviceDiscoveryAgent::deviceDiscoveryDebug(const QBluetoothDeviceInfo &info)
{
qDebug() << "Discovered device:" << info.address().toString() << info.name();
diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
index 1550642b..a55ba0c3 100644
--- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
@@ -76,6 +76,7 @@ public slots:
private slots:
void initTestCase();
+ void tst_invalidBtAddress();
void tst_serviceDiscovery_data();
void tst_serviceDiscovery();
void tst_serviceDiscoveryAdapters();
@@ -149,6 +150,24 @@ void tst_QBluetoothServiceDiscoveryAgent::initTestCase()
}
}
+void tst_QBluetoothServiceDiscoveryAgent::tst_invalidBtAddress()
+{
+ QBluetoothServiceDiscoveryAgent *discoveryAgent = new QBluetoothServiceDiscoveryAgent(QBluetoothAddress("11:11:11:11:11:11"));
+
+ QCOMPARE(discoveryAgent->error(), QBluetoothServiceDiscoveryAgent::InvalidBluetoothAdapterError);
+ discoveryAgent->start();
+ QCOMPARE(discoveryAgent->isActive(), false);
+ delete discoveryAgent;
+
+ discoveryAgent = new QBluetoothServiceDiscoveryAgent(QBluetoothAddress());
+ QCOMPARE(discoveryAgent->error(), QBluetoothServiceDiscoveryAgent::NoError);
+ if (QBluetoothLocalDevice::allDevices().count() > 0) {
+ discoveryAgent->start();
+ QCOMPARE(discoveryAgent->isActive(), true);
+ }
+ delete discoveryAgent;
+}
+
void tst_QBluetoothServiceDiscoveryAgent::serviceDiscoveryDebug(const QBluetoothServiceInfo &info)
{
qDebug() << "Discovered service on"