diff options
Diffstat (limited to 'tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp')
-rw-r--r-- | tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp index e6728eab..b6ab0e53 100644 --- a/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp +++ b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp @@ -105,7 +105,7 @@ void tst_QLowEnergyDescriptor::initTestCase() // find first service with descriptor QLowEnergyController *controller = 0; - foreach (const QBluetoothDeviceInfo& remoteDeviceInfo, remoteLeDeviceInfos) { + for (const QBluetoothDeviceInfo& remoteDeviceInfo : qAsConst(remoteLeDeviceInfos)) { controller = new QLowEnergyController(remoteDeviceInfo, this); qDebug() << "Connecting to" << remoteDeviceInfo.address(); controller->connectToDevice(); @@ -128,7 +128,8 @@ void tst_QLowEnergyDescriptor::initTestCase() QCOMPARE(stateSpy.at(1).at(0).value<QLowEnergyController::ControllerState>(), QLowEnergyController::DiscoveredState); - foreach (const QBluetoothUuid &leServiceUuid, controller->services()) { + const QList<QBluetoothUuid> leServiceUuids = controller->services(); + for (const QBluetoothUuid &leServiceUuid : leServiceUuids) { QLowEnergyService *leService = controller->createServiceObject(leServiceUuid, this); if (!leService) continue; @@ -137,8 +138,8 @@ void tst_QLowEnergyDescriptor::initTestCase() QTRY_VERIFY_WITH_TIMEOUT( leService->state() == QLowEnergyService::ServiceDiscovered, 10000); - QList<QLowEnergyCharacteristic> chars = leService->characteristics(); - foreach (const QLowEnergyCharacteristic &ch, chars) { + const QList<QLowEnergyCharacteristic> chars = leService->characteristics(); + for (const QLowEnergyCharacteristic &ch : chars) { if (!ch.descriptors().isEmpty()) { globalService = leService; globalControl = controller; @@ -239,7 +240,7 @@ void tst_QLowEnergyDescriptor::tst_assignCompare() QList<QLowEnergyDescriptor> targets; const QList<QLowEnergyCharacteristic> chars = globalService->characteristics(); - foreach (const QLowEnergyCharacteristic &ch, chars) { + for (const QLowEnergyCharacteristic &ch : chars) { if (!ch.descriptors().isEmpty()) { targets = ch.descriptors(); break; |