summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-01-03 14:38:11 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-03 23:45:06 +0100
commit91371ffd3d00e10635f58d1e9efe8c1b3f467537 (patch)
tree50a6b7f885721b6db2c0a8fcbb2a547e216102fb /tests
parent3336383132b1aafeb74585d203e98e85811af55e (diff)
QtConnectivity: Fix test crashes/asserts/hangs.
- Fix crash caused by uninitialized d-ptr in local device default implementation (Windows). - Fix crash caused by uninitialized d-ptr in local device bluez implementation (Linux) if connection fails. - Verify local device validity before d-ptr is accessed in test - Fix crash in QNdefNfcUriRecord::uri() in case abbreviations[0] (==0) is accessed. - Terminate wait loops - Check signal spy before accessing first element. - Fix compiler warnings. Change-Id: I92d54b4dfcc05e8befb49f2bd72b60251641aa48 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Alex <alex.blasche@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp2
-rw-r--r--tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp2
-rw-r--r--tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp6
-rw-r--r--tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp5
4 files changed, 6 insertions, 9 deletions
diff --git a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
index 69853bd6..3f13e79f 100644
--- a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
+++ b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
@@ -195,6 +195,7 @@ void tst_QBluetoothLocalDevice::tst_hostModes()
QTRY_VERIFY(hostModeSpy.count() > 0);
}
// test the actual signal values.
+ QVERIFY(hostModeSpy.count() > 0);
QList<QVariant> arguments = hostModeSpy.takeFirst();
QBluetoothLocalDevice::HostMode hostMode = qvariant_cast<QBluetoothLocalDevice::HostMode>(arguments.at(0));
QCOMPARE(hostModeExpected, hostMode);
@@ -250,6 +251,7 @@ void tst_QBluetoothLocalDevice::tst_pairDevice()
QVERIFY(pairingSpy.isValid());
QVERIFY(pairingSpy.isEmpty());
+ QVERIFY(localDevice.isValid());
localDevice.requestPairing(deviceAddress, pairingExpected);
// async, wait for it
QTRY_VERIFY(pairingSpy.count() > 0);
diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
index cc2f0822..cc89390d 100644
--- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
@@ -214,7 +214,7 @@ static void dumpAttributeVariant(const QVariant &var, const QString indent)
}
}
-static void dumpServiceInfoAttributes(const QBluetoothServiceInfo &info)
+static inline void dumpServiceInfoAttributes(const QBluetoothServiceInfo &info)
{
foreach (quint16 id, info.attributes()) {
dumpAttributeVariant(info.attribute(id), QString("\t"));
diff --git a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
index 6b738de5..a59fa994 100644
--- a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
+++ b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
@@ -154,11 +154,8 @@ void tst_QBluetoothSocket::initTestCase()
sda->setUuidFilter(QBluetoothUuid(QString(ECHO_SERVICE_UUID)));
sda->start(QBluetoothServiceDiscoveryAgent::MinimalDiscovery);
- int connectTime = MaxConnectTime;
- while (!done_discovery) {
+ for (int connectTime = MaxConnectTime; !done_discovery && connectTime > 0; connectTime -= 1000)
QTest::qWait(1000);
- connectTime -= 1000;
- }
sda->stop();
@@ -676,6 +673,7 @@ void tst_QBluetoothSocket::tst_localPeer()
QFETCH(QString, peerName);
QFETCH(QBluetoothAddress, peerAddress);
QFETCH(quint16, peerPort);
+ Q_UNUSED(peerPort)
#ifndef Q_OS_SYMBIAN
QStringList args;
diff --git a/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp b/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp
index b14329f3..14d85617 100644
--- a/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp
+++ b/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp
@@ -135,11 +135,8 @@ void tst_QBluetoothTransferManager::initTestCase()
sda->setUuidFilter(QBluetoothUuid(QString(ECHO_SERVICE_UUID)));
sda->start(QBluetoothServiceDiscoveryAgent::MinimalDiscovery);
- int connectTime = MaxConnectTime;
- while (!done_discovery) {
+ for (int connectTime = MaxConnectTime; !done_discovery && connectTime > 0; connectTime -= 1000)
QTest::qWait(1000);
- connectTime -= 1000;
- }
sda->stop();