summaryrefslogtreecommitdiffstats
path: root/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 21:57:01 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 21:57:01 +0200
commit3dcb548bd6fe4aa488ca0bac95e65a7a366c3eca (patch)
treed8e263e0341880d970832326c7c7cecfd05e67cd /tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp
parente957d4810b05d8453e163d7bcdcab42d3c60a7bb (diff)
parent2b3b5c899ebdb0fc11273af7370804f5f03ad9e8 (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.9' into tqtc/lts-5.15-opensourcev5.15.9-lts-lgpl
Diffstat (limited to 'tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp')
-rw-r--r--tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp20
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());