summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-08-22 17:59:06 +0200
committerIvan Solovev <ivan.solovev@qt.io>2022-08-26 12:49:54 +0200
commit5fee999b242fadc9efca5423aa1296486aa5a880 (patch)
treeaf7293183050bf696937b99f77bda5ef7f934c6f /tests
parent5bca1dec859068aac047b17c2fe49b2eb0d3368e (diff)
Bluetooth Windows: refactor getNativeCharacteristic
... to get rid of await() call. The function now requests the characteristics asynchronously and executes a custom callback, passing the selected characteristic as a parameter. After that the refactoring is quite simple: we put all the code after the getNativeCharacteristic() call into a lambda, and pass this lambda as a last parameter of the updated method. As a drive-by: improve tst_qlowenergycontroller_device::testNotificationAndIndication() stability by adding QTest::qWait() calls after disabling notification and indication, like it is done in other places. Task-number: QTBUG-105556 Pick-to: 6.4 6.3 6.2 Change-Id: I1164bbc677d3549ef930243fd645eed344e27b7c Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/qlowenergycontroller/tst_qlowenergycontroller_device.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/manual/qlowenergycontroller/tst_qlowenergycontroller_device.cpp b/tests/manual/qlowenergycontroller/tst_qlowenergycontroller_device.cpp
index ae4f315a..80dc1bef 100644
--- a/tests/manual/qlowenergycontroller/tst_qlowenergycontroller_device.cpp
+++ b/tests/manual/qlowenergycontroller/tst_qlowenergycontroller_device.cpp
@@ -613,7 +613,9 @@ void tst_qlowenergycontroller_device::testNotificationAndIndication()
service->writeDescriptor(cccd, newValue);
QTRY_VERIFY(cccdWritten);
- // check that there are no updates:
+ // wait for a moment in case there is a value change just happening,
+ // then check that there are no more notifications:
+ QTest::qWait(200);
oldvalue = characteristic.value();
for (int i = 0; i < 3; ++i) {
QTest::qWait(100);
@@ -641,7 +643,9 @@ void tst_qlowenergycontroller_device::testNotificationAndIndication()
service->writeDescriptor(cccd, newValue);
QTRY_VERIFY(cccdWritten);
- // check that there are no indications:
+ // wait for a moment in case there is a value change just happening,
+ // then check that there are no more indications:
+ QTest::qWait(200);
oldvalue = characteristic.value();
for (int i = 0; i < 3; ++i) {
QTest::qWait(100);