summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp20
-rw-r--r--tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp19
-rw-r--r--tests/auto/qnearfieldtagtype2/tst_qnearfieldtagtype2.cpp8
-rw-r--r--tests/btclient/btclient.c12
4 files changed, 49 insertions, 10 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"
diff --git a/tests/auto/qnearfieldtagtype2/tst_qnearfieldtagtype2.cpp b/tests/auto/qnearfieldtagtype2/tst_qnearfieldtagtype2.cpp
index 87e6a41d..6fac6571 100644
--- a/tests/auto/qnearfieldtagtype2/tst_qnearfieldtagtype2.cpp
+++ b/tests/auto/qnearfieldtagtype2/tst_qnearfieldtagtype2.cpp
@@ -163,14 +163,14 @@ void tst_QNearFieldTagType2::staticMemoryModel()
QCOMPARE(readBlock, QByteArray(4, 0x55) + initialBlock.mid(4));
// Write 0xaa
- id = target->writeBlock(i, QByteArray(4, 0xaa));
+ id = target->writeBlock(i, QByteArray(4, char(0xaa)));
QVERIFY(target->waitForRequestCompleted(id));
QVERIFY(target->requestResponse(id).toBool());
id = target->readBlock(i);
QVERIFY(target->waitForRequestCompleted(id));
readBlock = target->requestResponse(id).toByteArray();
- QCOMPARE(readBlock, QByteArray(4, 0xaa) + initialBlock.mid(4));
+ QCOMPARE(readBlock, QByteArray(4, char(0xaa)) + initialBlock.mid(4));
}
}
}
@@ -240,14 +240,14 @@ void tst_QNearFieldTagType2::dynamicMemoryModel()
QCOMPARE(readBlock, QByteArray(4, 0x55) + initialBlock.mid(4));
// Write 0xaa
- id = target->writeBlock(i, QByteArray(4, 0xaa));
+ id = target->writeBlock(i, QByteArray(4, char(0xaa)));
QVERIFY(target->waitForRequestCompleted(id));
QVERIFY(target->requestResponse(id).toBool());
id = target->readBlock(i);
QVERIFY(target->waitForRequestCompleted(id));
readBlock = target->requestResponse(id).toByteArray();
- QCOMPARE(readBlock, QByteArray(4, 0xaa) + initialBlock.mid(4));
+ QCOMPARE(readBlock, QByteArray(4, char(0xaa)) + initialBlock.mid(4));
}
// change to sector 0
diff --git a/tests/btclient/btclient.c b/tests/btclient/btclient.c
index 17c220b0..e6f6f0b0 100644
--- a/tests/btclient/btclient.c
+++ b/tests/btclient/btclient.c
@@ -118,11 +118,11 @@ struct fdlist {
struct fdlist *head = 0;
-void removefd(struct fdlist *fdl, int fd){
+void removefd(struct fdlist *fdl, int fd) {
struct fdlist *prev = fdl;
while(fdl && fdl->fd != fd) {
prev = fdl;
- fdl = fdl->next;
+ fdl = fdl->next;
}
assert(fdl);
@@ -482,7 +482,7 @@ void registerService()
// change path to use any
strcpy(rindex(path, '/'), "/any");
- printf("Using path: %s\n", path);
+ printf("Using path: %s\n", path);
dbus_message_unref(msg);
@@ -538,9 +538,9 @@ void registerService()
int main(int argc, char **argv)
{
- int socket;
+ int socket;
#define MAX_POLL 256
- struct pollfd fds[MAX_POLL];
+ struct pollfd fds[MAX_POLL];
UNUSED(argc);
UNUSED(argv);
@@ -558,7 +558,7 @@ int main(int argc, char **argv)
while(1){
int n = mkpoll(head, fds, MAX_POLL);
- if(poll(fds, n, -1)){
+ if (poll(fds, n, -1)) {
struct fdlist *fdl = head;
int i;