summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2022-02-18 16:48:40 +0200
committerJuha Vuolle <juha.vuolle@insta.fi>2022-02-24 08:29:32 +0200
commit9b165d89c14acb5d67383a956a779fba7708b716 (patch)
tree32965b3d0d329e0a11481a84e11a458c734e3df8
parent6198f70308ee1da16274aada6781824a691566e1 (diff)
downloadqtconnectivity-9b165d89c14acb5d67383a956a779fba7708b716.tar.gz
Accommodate different bluez socket types in autotest [secFlags]
The bluezdbus and bluez socket are initialized to different security flag values. Adjust the test according to which backend is in use. Change-Id: I05f7c10743de8b02e701bcee891fa3be12d4975f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit bc83b98295c36c28367a64722188164cde1f796b) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r--tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
index a7b5ef1f..9e0dfc54 100644
--- a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
+++ b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
@@ -35,6 +35,9 @@
#include <qbluetoothserviceinfo.h>
#include <qbluetoothservicediscoveryagent.h>
#include <qbluetoothlocaldevice.h>
+#if QT_CONFIG(bluez)
+#include <QtBluetooth/private/bluez5_helper_p.h>
+#endif
QT_USE_NAMESPACE
@@ -506,7 +509,12 @@ void tst_QBluetoothSocket::tst_preferredSecurityFlags()
#if defined(QT_ANDROID_BLUETOOTH) | defined(QT_OSX_BLUETOOTH)
QCOMPARE(socket.preferredSecurityFlags(), QBluetooth::Secure);
#elif QT_CONFIG(bluez)
- QCOMPARE(socket.preferredSecurityFlags(), QBluetooth::Authorization);
+ // The bluezdbus socket uses "NoSecurity" by default, whereas the non-dbus bluez
+ // socket uses "Authorization" by default
+ if (bluetoothdVersion() >= QVersionNumber(5, 42))
+ QCOMPARE(socket.preferredSecurityFlags(), QBluetooth::Security::NoSecurity);
+ else
+ QCOMPARE(socket.preferredSecurityFlags(), QBluetooth::Security::Authorization);
#else
QCOMPARE(socket.preferredSecurityFlags(), QBluetooth::NoSecurity);
#endif