summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp')
-rw-r--r--tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
index 5ebb0b1d..334a950b 100644
--- a/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
+++ b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
@@ -63,7 +63,7 @@ private:
};
tst_QLowEnergyDescriptor::tst_QLowEnergyDescriptor() :
- globalControl(0), globalService(0)
+ globalControl(nullptr), globalService(nullptr)
{
QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
}
@@ -104,13 +104,13 @@ void tst_QLowEnergyDescriptor::initTestCase()
QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 50000);
// find first service with descriptor
- QLowEnergyController *controller = 0;
+ QLowEnergyController *controller = nullptr;
for (const QBluetoothDeviceInfo& remoteDeviceInfo : qAsConst(remoteLeDeviceInfos)) {
controller = QLowEnergyController::createCentral(remoteDeviceInfo, this);
qDebug() << "Connecting to" << remoteDeviceInfo.address();
controller->connectToDevice();
QTRY_IMPL(controller->state() != QLowEnergyController::ConnectingState,
- 20000);
+ 20000)
if (controller->state() != QLowEnergyController::ConnectedState) {
// any error and we skip
delete controller;
@@ -243,7 +243,8 @@ void tst_QLowEnergyDescriptor::tst_assignCompare()
QCOMPARE(target.uuid(), QBluetoothUuid());
QCOMPARE(target.value(), QByteArray());
- int index = -1;
+ int index = 0;
+ bool valueFound = false;
QList<QLowEnergyDescriptor> targets;
const QList<QLowEnergyCharacteristic> chars = globalService->characteristics();
for (const QLowEnergyCharacteristic &ch : chars) {
@@ -253,6 +254,7 @@ void tst_QLowEnergyDescriptor::tst_assignCompare()
// try to get a descriptor we can read
if (targets[i].type() == QBluetoothUuid::CharacteristicUserDescription) {
index = i;
+ valueFound = true;
break;
}
}
@@ -263,8 +265,6 @@ void tst_QLowEnergyDescriptor::tst_assignCompare()
if (targets.isEmpty())
QSKIP("No descriptor found despite prior indication.");
- QVERIFY(index != -1);
-
// test assignment operator
target = targets[index];
QVERIFY(target.isValid());
@@ -272,7 +272,7 @@ void tst_QLowEnergyDescriptor::tst_assignCompare()
QVERIFY(!target.name().isEmpty());
QVERIFY(target.handle() > 0);
QVERIFY(!target.uuid().isNull());
- QVERIFY(!target.value().isEmpty());
+ QVERIFY(!valueFound || !target.value().isEmpty());
QVERIFY(target == targets[index]);
QVERIFY(targets[index] == target);