diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2022-02-18 16:48:40 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-02-22 15:35:46 +0000 |
commit | b63072988b158588921c29ca0dabe99edb8b4776 (patch) | |
tree | a1ee4ee0b2231e63cdb027224fd3a15b3a04f699 | |
parent | d301b7972e506c31e52415d5d5361ef15846d7cc (diff) | |
download | qtconnectivity-b63072988b158588921c29ca0dabe99edb8b4776.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 Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp index 2d7db25a..75dd814a 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 @@ -507,7 +510,12 @@ void tst_QBluetoothSocket::tst_preferredSecurityFlags() #if defined(QT_ANDROID_BLUETOOTH) || defined(QT_OSX_BLUETOOTH) QCOMPARE(socket.preferredSecurityFlags(), QBluetooth::Security::Secure); #elif QT_CONFIG(bluez) - QCOMPARE(socket.preferredSecurityFlags(), QBluetooth::Security::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::Security::NoSecurity); #endif |