summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-04-07 13:16:42 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-04-08 07:11:30 +0200
commit330efe20f7e97caf0162ae29b940508f95c0e3c5 (patch)
treea1ff464ca19f6516f80291c0f4729f9382cf186c /tests
parentf90c82488a57079fe7568f4eaba23a631686f30f (diff)
Replace count() comparisons against 0 with isEmpty()
Pick-to: 6.3 Change-Id: I0a14c1737cda87fa30d207bdf5b2a697214b7e70 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp20
-rw-r--r--tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp4
-rw-r--r--tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp12
-rw-r--r--tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp6
-rw-r--r--tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp14
-rw-r--r--tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp2
-rw-r--r--tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp22
-rw-r--r--tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp6
-rw-r--r--tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp2
-rw-r--r--tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp2
-rw-r--r--tests/manual/qlowenergycontroller/tst_qlowenergycontroller_device.cpp2
11 files changed, 46 insertions, 46 deletions
diff --git a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
index adea75bd..80dd1e6f 100644
--- a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
@@ -109,11 +109,11 @@ void tst_QBluetoothDeviceDiscoveryAgent::initTestCase()
QVERIFY(hostModeSpy.isEmpty());
device->powerOn();
int connectTime = 5000; // ms
- while (hostModeSpy.count() < 1 && connectTime > 0) {
+ while (hostModeSpy.isEmpty() && connectTime > 0) {
QTest::qWait(500);
connectTime -= 500;
}
- QVERIFY(hostModeSpy.count() > 0);
+ QVERIFY(!hostModeSpy.isEmpty());
}
QBluetoothLocalDevice::HostMode hostMode= device->hostMode();
QVERIFY(hostMode == QBluetoothLocalDevice::HostConnectable
@@ -134,7 +134,7 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_invalidBtAddress()
discoveryAgent = new QBluetoothDeviceDiscoveryAgent(QBluetoothAddress());
QCOMPARE(discoveryAgent->error(), QBluetoothDeviceDiscoveryAgent::NoError);
- if (QBluetoothLocalDevice::allDevices().count() > 0) {
+ if (!QBluetoothLocalDevice::allDevices().isEmpty()) {
discoveryAgent->start();
QCOMPARE(discoveryAgent->isActive(), true);
}
@@ -182,7 +182,7 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_startStopDeviceDiscoveries()
// Wait for up to MaxWaitForCancelTime for the cancel to finish
int waitTime = MaxWaitForCancelTime;
- while (cancelSpy.count() == 0 && waitTime > 0) {
+ while (cancelSpy.isEmpty() && waitTime > 0) {
QTest::qWait(100);
waitTime-=100;
}
@@ -206,7 +206,7 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_startStopDeviceDiscoveries()
// Wait for up to MaxWaitForCancelTime for the cancel to finish
waitTime = MaxWaitForCancelTime;
- while (cancelSpy.count() == 0 && waitTime > 0) {
+ while (cancelSpy.isEmpty() && waitTime > 0) {
QTest::qWait(100);
waitTime-=100;
}
@@ -223,7 +223,7 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_startStopDeviceDiscoveries()
QVERIFY(errorSpy.isEmpty());
// Don't expect finished signal and no error
- QVERIFY(finishedSpy.count() == 0);
+ QVERIFY(finishedSpy.isEmpty());
QVERIFY(discoveryAgent.error() == discoveryAgent.NoError);
QVERIFY(discoveryAgent.errorString().isEmpty());
@@ -260,7 +260,7 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_startStopDeviceDiscoveries()
// Wait for up to MaxWaitForCancelTime for the cancel to finish
waitTime = MaxWaitForCancelTime;
- while (cancelSpy.count() == 0 && waitTime > 0) {
+ while (cancelSpy.isEmpty() && waitTime > 0) {
QTest::qWait(100);
waitTime-=100;
}
@@ -289,7 +289,7 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_startStopDeviceDiscoveries()
// Wait for up to MaxScanTime for the cancel to finish
waitTime = MaxScanTime;
- while (finishedSpy.count() == 0 && waitTime > 0) {
+ while (finishedSpy.isEmpty() && waitTime > 0) {
QTest::qWait(1000);
waitTime-=1000;
}
@@ -344,7 +344,7 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_deviceDiscovery()
// Wait for up to MaxScanTime for the scan to finish
int scanTime = MaxScanTime;
- while (finishedSpy.count() == 0 && scanTime > 0) {
+ while (finishedSpy.isEmpty() && scanTime > 0) {
QTest::qWait(15000);
scanTime -= 15000;
}
@@ -378,7 +378,7 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_deviceDiscovery()
}
if (!remoteDevice.isNull())
- QVERIFY(discoveredSpy.count() > 0);
+ QVERIFY(!discoveredSpy.isEmpty());
// All returned QBluetoothDeviceInfo should be valid.
while (!discoveredSpy.isEmpty()) {
const QBluetoothDeviceInfo info =
diff --git a/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp b/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp
index 689d1052..25c6218f 100644
--- a/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp
+++ b/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp
@@ -452,10 +452,10 @@ void tst_QBluetoothDeviceInfo::tst_serviceUuids()
QList<QBluetoothUuid> servicesList;
servicesList.append(QBluetoothUuid::ProtocolUuid::L2cap);
servicesList.append(QBluetoothUuid::ProtocolUuid::Rfcomm);
- QVERIFY(servicesList.count() > 0);
+ QVERIFY(!servicesList.isEmpty());
deviceInfo.setServiceUuids(servicesList);
- QVERIFY(deviceInfo.serviceUuids().count() > 0);
+ QVERIFY(!deviceInfo.serviceUuids().isEmpty());
deviceInfo.setServiceUuids(QList<QBluetoothUuid>());
QCOMPARE(deviceInfo.serviceUuids().count(), 0);
}
diff --git a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
index 269dc0fe..32e272af 100644
--- a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
+++ b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
@@ -130,7 +130,7 @@ void tst_QBluetoothLocalDevice::tst_powerOn()
localDevice.powerOn();
// async, wait for it
- QTRY_VERIFY(hostModeSpy.count() > 0);
+ QTRY_VERIFY(!hostModeSpy.isEmpty());
QBluetoothLocalDevice::HostMode hostMode= localDevice.hostMode();
// we should not be powered off
QVERIFY(hostMode == QBluetoothLocalDevice::HostConnectable
@@ -164,7 +164,7 @@ void tst_QBluetoothLocalDevice::tst_powerOff()
localDevice.setHostMode(QBluetoothLocalDevice::HostPoweredOff);
// async, wait for it
- QTRY_VERIFY(hostModeSpy.count() > 0);
+ QTRY_VERIFY(!hostModeSpy.isEmpty());
// we should not be powered off
QVERIFY(localDevice.hostMode() == QBluetoothLocalDevice::HostPoweredOff);
@@ -214,13 +214,13 @@ void tst_QBluetoothLocalDevice::tst_hostModes()
// wait for the device to switch bluetooth mode.
QTest::qWait(1000);
if (hostModeExpected != localDevice.hostMode()) {
- QTRY_VERIFY(hostModeSpy.count() > 0);
+ QTRY_VERIFY(!hostModeSpy.isEmpty());
}
// test the actual signal values.
if (expectSignal)
- QVERIFY(hostModeSpy.count() > 0);
+ QVERIFY(!hostModeSpy.isEmpty());
else
- QVERIFY(hostModeSpy.count() == 0);
+ QVERIFY(hostModeSpy.isEmpty());
if (expectSignal) {
QList<QVariant> arguments = hostModeSpy.takeLast();
@@ -262,7 +262,7 @@ void tst_QBluetoothLocalDevice::tst_isValid()
QBluetoothAddress invalidAddress("FF:FF:FF:FF:FF:FF");
const QList<QBluetoothHostInfo> devices = QBluetoothLocalDevice::allDevices();
- if (devices.count()) {
+ if (!devices.isEmpty()) {
QVERIFY(localDevice.isValid());
bool defaultFound = false;
for (int i = 0; i<devices.count(); i++) {
diff --git a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp
index 13e525d9..bc964ef7 100644
--- a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp
+++ b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp
@@ -99,7 +99,7 @@ void tst_QBluetoothServer::setHostMode(const QBluetoothAddress &localAdapter,
}
int connectTime = 5000; // ms
- while (hostModeSpy.count() < 1 && connectTime > 0) {
+ while (hostModeSpy.isEmpty() && connectTime > 0) {
QTest::qWait(500);
connectTime -= 500;
}
@@ -204,7 +204,7 @@ void tst_QBluetoothServer::tst_receive()
QCOMPARE(server.serverAddress(), QBluetoothAddress());
#endif
QCOMPARE(server.serverPort(), quint16(0));
- QVERIFY(errorSpy.count() > 0);
+ QVERIFY(!errorSpy.isEmpty());
QVERIFY(!server.isListening());
if (!localDeviceAvailable) {
QVERIFY(server.error() != QBluetoothServer::NoError);
@@ -218,7 +218,7 @@ void tst_QBluetoothServer::tst_receive()
QVERIFY(result);
#if !QT_CONFIG(winrt_bt)
- QVERIFY(QBluetoothLocalDevice::allDevices().count());
+ QVERIFY(!QBluetoothLocalDevice::allDevices().isEmpty());
#endif
QCOMPARE(server.error(), QBluetoothServer::NoError);
QCOMPARE(server.serverAddress(), address);
diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
index 3a58de2a..e1ef9591 100644
--- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
@@ -127,7 +127,7 @@ void tst_QBluetoothServiceDiscoveryAgent::initTestCase()
// Wait for up to MaxScanTime for the scan to finish
int scanTime = MaxScanTime;
- while (finishedSpy.count() == 0 && scanTime > 0) {
+ while (finishedSpy.isEmpty() && scanTime > 0) {
QTest::qWait(1000);
scanTime -= 1000;
}
@@ -177,7 +177,7 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_invalidBtAddress()
discoveryAgent = new QBluetoothServiceDiscoveryAgent(QBluetoothAddress());
QCOMPARE(discoveryAgent->error(), QBluetoothServiceDiscoveryAgent::NoError);
- if (QBluetoothLocalDevice::allDevices().count() > 0) {
+ if (!QBluetoothLocalDevice::allDevices().isEmpty()) {
discoveryAgent->start();
QCOMPARE(discoveryAgent->isActive(), true);
}
@@ -352,7 +352,7 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscoveryAdapters()
discoveryAgent.start();
int scanTime = MaxScanTime;
- while (finishedSpy.count() == 0 && scanTime > 0) {
+ while (finishedSpy.isEmpty() && scanTime > 0) {
QTest::qWait(1000);
scanTime -= 1000;
}
@@ -416,7 +416,7 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery()
// Wait for up to MaxScanTime for the scan to finish
int scanTime = 20000;
- while (finishedSpy.count() == 0 && scanTime > 0) {
+ while (finishedSpy.isEmpty() && scanTime > 0) {
QTest::qWait(1000);
scanTime -= 1000;
}
@@ -435,7 +435,7 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery()
QVERIFY(errorSpy.isEmpty());
- //if (discoveryAgent.discoveredServices().count() && expected_failures++ <2){
+ //if (!discoveryAgent.discoveredServices().isEmpty() && expected_failures++ <2){
if (discoveredSpy.isEmpty()) {
qDebug() << "Device failed to return any results, skipping device" << discoveryAgent.discoveredServices().count();
return;
@@ -472,9 +472,9 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery()
}
if (servicesFound)
- QVERIFY(discoveryAgent.discoveredServices().count() != 0);
+ QVERIFY(!discoveryAgent.discoveredServices().isEmpty());
discoveryAgent.clear();
- QVERIFY(discoveryAgent.discoveredServices().count() == 0);
+ QVERIFY(discoveryAgent.discoveredServices().isEmpty());
discoveryAgent.stop();
QVERIFY(!discoveryAgent.isActive());
diff --git a/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp b/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp
index 4317c8cb..65194909 100644
--- a/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp
+++ b/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp
@@ -282,7 +282,7 @@ void tst_QBluetoothServiceInfo::tst_assignment()
copyInfo.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, QBluetoothUuid(uuid));
QVERIFY(copyInfo.contains(QBluetoothServiceInfo::ProtocolDescriptorList));
QVERIFY(copyInfo.isComplete());
- QVERIFY(copyInfo.attributes().count() > 0);
+ QVERIFY(!copyInfo.attributes().isEmpty());
copyInfo.removeAttribute(QBluetoothServiceInfo::ProtocolDescriptorList);
QVERIFY(!copyInfo.contains(QBluetoothServiceInfo::ProtocolDescriptorList));
diff --git a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
index 7fdae313..24f3ae4c 100644
--- a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
+++ b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
@@ -118,7 +118,7 @@ void tst_QBluetoothSocket::initTestCase()
{
// setup Bluetooth env
const QList<QBluetoothHostInfo> foundDevices = QBluetoothLocalDevice::allDevices();
- if (!foundDevices.count()) {
+ if (foundDevices.isEmpty()) {
qWarning() << "Missing local device";
return;
} else {
@@ -264,12 +264,12 @@ void tst_QBluetoothSocket::tst_serviceConnection()
stateSpy.clear();
int connectTime = MaxConnectTime;
- while (connectedSpy.count() == 0 && errorSpy.count() == 0 && connectTime > 0) {
+ while (connectedSpy.isEmpty() && errorSpy.isEmpty() && connectTime > 0) {
QTest::qWait(1000);
connectTime -= 1000;
}
- if (errorSpy.count() != 0) {
+ if (!errorSpy.isEmpty()) {
qDebug() << errorSpy.takeFirst().at(0).toInt();
QSKIP("Connection error");
}
@@ -305,11 +305,11 @@ void tst_QBluetoothSocket::tst_serviceConnection()
QCOMPARE(socket.isOpen(), false);
QCOMPARE(socket.openMode(), QIODevice::NotOpen);
- QVERIFY(stateSpy.count() >= 1);
+ QVERIFY(!stateSpy.isEmpty());
QCOMPARE(stateSpy.takeFirst().at(0).value<QBluetoothSocket::SocketState>(), QBluetoothSocket::SocketState::ClosingState);
int disconnectTime = MaxConnectTime;
- while (disconnectedSpy.count() == 0 && disconnectTime > 0) {
+ while (disconnectedSpy.isEmpty() && disconnectTime > 0) {
QTest::qWait(1000);
disconnectTime -= 1000;
}
@@ -365,7 +365,7 @@ void tst_QBluetoothSocket::tst_clientCommunication()
stateSpy.clear();
int connectTime = MaxConnectTime;
- while (connectedSpy.count() == 0 && connectTime > 0) {
+ while (connectedSpy.isEmpty() && connectTime > 0) {
QTest::qWait(1000);
connectTime -= 1000;
}
@@ -401,7 +401,7 @@ void tst_QBluetoothSocket::tst_clientCommunication()
QCOMPARE(dataWritten, qint64(line.length()));
int readWriteTime = MaxReadWriteTime;
- while ((bytesWrittenSpy.count() == 0 || readyReadSpy.count() == 0) && readWriteTime > 0) {
+ while ((bytesWrittenSpy.isEmpty() || readyReadSpy.isEmpty()) && readWriteTime > 0) {
QTest::qWait(1000);
readWriteTime -= 1000;
}
@@ -410,7 +410,7 @@ void tst_QBluetoothSocket::tst_clientCommunication()
QCOMPARE(bytesWrittenSpy.at(0).at(0).toLongLong(), qint64(line.length()));
readWriteTime = MaxReadWriteTime;
- while ((readyReadSpy.count() == 0) && readWriteTime > 0) {
+ while (readyReadSpy.isEmpty() && readWriteTime > 0) {
QTest::qWait(1000);
readWriteTime -= 1000;
}
@@ -450,14 +450,14 @@ void tst_QBluetoothSocket::tst_clientCommunication()
QCOMPARE(dataWritten, qint64(joined.length()));
int readWriteTime = MaxReadWriteTime;
- while ((bytesWrittenSpy.count() == 0 || readyReadSpy.count() == 0) && readWriteTime > 0) {
+ while ((bytesWrittenSpy.isEmpty() || readyReadSpy.isEmpty()) && readWriteTime > 0) {
QTest::qWait(1000);
readWriteTime -= 1000;
}
QCOMPARE(bytesWrittenSpy.count(), 1);
QCOMPARE(bytesWrittenSpy.at(0).at(0).toLongLong(), qint64(joined.length()));
- QVERIFY(readyReadSpy.count() > 0);
+ QVERIFY(!readyReadSpy.isEmpty());
if (socket.openMode() & QIODevice::Unbuffered)
QVERIFY(socket.bytesAvailable() <= qint64(joined.length()));
@@ -482,7 +482,7 @@ void tst_QBluetoothSocket::tst_clientCommunication()
QCOMPARE(socket.openMode(), QIODevice::NotOpen);
int disconnectTime = MaxConnectTime;
- while (disconnectedSpy.count() == 0 && disconnectTime > 0) {
+ while (disconnectedSpy.isEmpty() && disconnectTime > 0) {
QTest::qWait(1000);
disconnectTime -= 1000;
}
diff --git a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
index 27a89dd6..125aa3dd 100644
--- a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
+++ b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
@@ -113,7 +113,7 @@ void tst_QLowEnergyCharacteristic::initTestCase()
QVERIFY(spy.isEmpty());
devAgent->start();
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 100000);
+ QTRY_VERIFY_WITH_TIMEOUT(!spy.isEmpty(), 100000);
// find first service with descriptor
QLowEnergyController *controller = 0;
@@ -263,7 +263,7 @@ void tst_QLowEnergyCharacteristic::tst_assignCompare()
globalService->characteristic(chars[i].uuid());
QVERIFY(specific.isValid());
QCOMPARE(specific, chars[i]);
- if (chars[i].descriptors().count() > 0) {
+ if (!chars[i].descriptors().isEmpty()) {
indexWithDescriptor = i;
break;
}
@@ -285,7 +285,7 @@ void tst_QLowEnergyCharacteristic::tst_assignCompare()
if (target.properties() & QLowEnergyCharacteristic::Read)
QVERIFY(!target.value().isEmpty());
if (!noDescriptors)
- QVERIFY(target.descriptors().count() > 0);
+ QVERIFY(!target.descriptors().isEmpty());
QVERIFY(target == chars[indexWithDescriptor]);
QVERIFY(chars[indexWithDescriptor] == target);
diff --git a/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp b/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp
index 6a949d86..9b0249d9 100644
--- a/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp
+++ b/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp
@@ -448,7 +448,7 @@ void TestQLowEnergyControllerGattServer::serverCommunication()
customService->writeCharacteristic(customChar5, "1", QLowEnergyService::WriteSigned);
// error might happen immediately or once event loop comes back
- bool wasError = ((spy->count() > 0) || spy->wait(3000)); //
+ bool wasError = (!spy->isEmpty() || spy->wait(3000)); //
if (!wasError) {
// Signed write is done twice to test the sign counter stuff.
diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
index 3afb78b3..5b7e1c9e 100644
--- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
+++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
@@ -144,7 +144,7 @@ void tst_QLowEnergyController::initTestCase()
bool deviceFound = false;
devAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);
- QTRY_VERIFY_WITH_TIMEOUT(finishedSpy.count() > 0, 30000);
+ QTRY_VERIFY_WITH_TIMEOUT(!finishedSpy.isEmpty(), 30000);
const QList<QBluetoothDeviceInfo> infos = devAgent->discoveredDevices();
for (const QBluetoothDeviceInfo &info : infos) {
#ifndef Q_OS_MAC
diff --git a/tests/manual/qlowenergycontroller/tst_qlowenergycontroller_device.cpp b/tests/manual/qlowenergycontroller/tst_qlowenergycontroller_device.cpp
index d24ceffc..7c8b67ec 100644
--- a/tests/manual/qlowenergycontroller/tst_qlowenergycontroller_device.cpp
+++ b/tests/manual/qlowenergycontroller/tst_qlowenergycontroller_device.cpp
@@ -164,7 +164,7 @@ void tst_qlowenergycontroller_device::discoverTestServer()
// Start device discovery
mDevAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);
- QTRY_VERIFY_WITH_TIMEOUT(finishedSpy.count() > 0 || canceledSpy.count() > 0, 80000);
+ QTRY_VERIFY_WITH_TIMEOUT(!finishedSpy.isEmpty() || !canceledSpy.isEmpty(), 80000);
// Verify that we have found a matching server device
bool deviceFound = false;