diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2021-12-19 13:10:07 +0100 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2021-12-29 14:16:06 +0100 |
commit | 138f6f0a4e18cdcd88c9ce69653f1d3d34b91491 (patch) | |
tree | 715d9587d729d9ee2759e462eda6c356dc2d9571 | |
parent | 0ee4082e37cb0f23a5f5aa69fa3291d270e5b1f8 (diff) | |
download | qtconnectivity-138f6f0a4e18cdcd88c9ce69653f1d3d34b91491.tar.gz |
tst_QBluetoothServiceInfo::tst_assignment - fix for Monterey
To register a service record 'bluetoothd' now (on Monterey) wants us
to have ServiceClassIDList. This fixes the test from RfcommProtocol,
but not L2CAP (which we consider non-working in such form).
Task-number: QTBUG-98955
Change-Id: I4c8c9e4ca38f0ac86b7fb6cb039b430688b4b359
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
(cherry picked from commit b4621669c7bff244ad490a21e3faf1ec51ba28a4)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r-- | tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp b/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp index f89802d2..895529c7 100644 --- a/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp +++ b/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp @@ -38,6 +38,8 @@ #include <qbluetoothuuid.h> #include <QtBluetooth/QBluetoothServer> +#include <QtCore/qoperatingsystemversion.h> + QT_USE_NAMESPACE Q_DECLARE_METATYPE(QBluetoothUuid::ProtocolUuid) @@ -187,6 +189,11 @@ void tst_QBluetoothServiceInfo::tst_assignment_data() #if defined(QT_ANDROID_BLUETOOTH) || defined(Q_OS_WIN) l2cpSupported = false; #endif + +#if defined(Q_OS_MACOS) + l2cpSupported = QOperatingSystemVersion::current() <= QOperatingSystemVersion::MacOSBigSur; +#endif + QTest::newRow("assignment_data_l2cp") << QUuid(0x67c8770b, 0x44f1, 0x410a, 0xab, 0x9a, 0xf9, 0xb5, 0x44, 0x6f, 0x13, 0xee) << QBluetoothUuid::L2cap << QBluetoothServiceInfo::L2capProtocol << l2cpSupported; @@ -348,6 +355,19 @@ void tst_QBluetoothServiceInfo::tst_assignment() serviceInfo.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList); +#if defined(Q_OS_MACOS) + // bluetoothd on Monterey does not want to register a record if there is no + // ServiceClassIDList provided. + if (QOperatingSystemVersion::current() > QOperatingSystemVersion::MacOSBigSur) { + // Nothing seems to help with L2CAP though: + if (serviceInfoProtocol == QBluetoothServiceInfo::RfcommProtocol) { + QBluetoothServiceInfo::Sequence classIds; + classIds << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ServiceClassUuid::SerialPort)); + copyInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classIds); + } + } +#endif // Q_OS_MACOS + QVERIFY(copyInfo.registerService()); QVERIFY(copyInfo.isRegistered()); QVERIFY(serviceInfo.isRegistered()); |