diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2022-04-14 14:54:09 +0300 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2022-05-02 21:11:41 +0300 |
commit | 6e4415588cd31a3767a5ca3f1711a4016dbdd70c (patch) | |
tree | bfe7e585596200e84fec15330bc740a33726ce6f /tests | |
parent | b1ffbc38e364470286c5da69e93c2709ec238a8f (diff) |
Bluetooth pairing mode improvements on Windows
Windows QBluetoothLocalDevice does not distinguish between "Paired"
and "AuthorizedPaired" pairing modes as there does not seem to be
APIs to do it.
The current implementation has few shortcomings addressed by this
commit:
- Document the behavior
- Use the actual pairing mode as signal value instead of using
what was requested. On current implementation the "pairingFinished()"
signal and "pairingStatus()" method call may give different values
- Perform pairing/unparing only if this could mean a change; requesting
'Paired' is same as requesting 'AuthorizedPaired'
Fixes: QTBUG-102412
Change-Id: I57801744432978c70cfdba5e58e8f85acfab92f2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp index d541bd0c..4052029a 100644 --- a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp +++ b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp @@ -411,11 +411,14 @@ void tst_QBluetoothLocalDevice::tst_pairDevice() QBluetoothAddress address = qvariant_cast<QBluetoothAddress>(arguments.at(0)); QBluetoothLocalDevice::Pairing pairingResult = qvariant_cast<QBluetoothLocalDevice::Pairing>(arguments.at(1)); QCOMPARE(deviceAddress, address); + // Verify that the local device pairing status and the signal value match + QCOMPARE(pairingResult, localDevice.pairingStatus(deviceAddress)); +#ifndef Q_OS_WIN + // On Windows the resulting pairing mode may differ from test's "expected" QCOMPARE(pairingResult, pairingExpected); - } - - if (!expectErrorSignal) QCOMPARE(localDevice.pairingStatus(deviceAddress), pairingExpected); +#endif + } } void tst_QBluetoothLocalDevice::tst_pairingStatus_data() |