diff options
author | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2014-12-03 13:08:48 +0100 |
---|---|---|
committer | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2014-12-03 16:37:26 +0100 |
commit | ff28b5529c7620f57130f24ce4fd6d55ab49c0af (patch) | |
tree | c6f73dca05edccf597df5c046c01a509426f9994 | |
parent | 43536fcb2970bcf3fa67b36777a9cf16ff46363d (diff) |
QBluetoothLocalDevice - isValid, tests (OS X and iOS)
Cancel the previous modification - even if BT is off, the device is
valid unless we create it with some address (in the 'OFF' state I can
not verify any address and the device is considered invalid).
Enable (back) auto-test - if BT is off we just skip the test (as it's done
in other test functions).
Change-Id: I8b013af6a73eab9699a91834e197716836b00e78
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_osx.mm | 6 | ||||
-rw-r--r-- | tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro | 1 | ||||
-rw-r--r-- | tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp | 8 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_osx.mm b/src/bluetooth/qbluetoothlocaldevice_osx.mm index 7e5cb12a..38f15b8c 100644 --- a/src/bluetooth/qbluetoothlocaldevice_osx.mm +++ b/src/bluetooth/qbluetoothlocaldevice_osx.mm @@ -120,11 +120,7 @@ QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice QT_BT_MAC_AUTORELEASEPOOL; HostController defaultController([[IOBluetoothHostController defaultController] retain]); - if (!defaultController || [defaultController powerState] != kBluetoothHCIPowerStateON) { - // IOBluetooth can return non-null host controller without working adapter. - // Unfortunately, a local device in such a state is totally useless: - // you can not access any information like address/name or change the device - // state to powered on. So it's not valid. + if (!defaultController) { qCCritical(QT_BT_OSX) << "QBluetoothLocalDevicePrivate(), failed to " "init a host controller object"; return; diff --git a/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro b/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro index f0d658ff..a95f9a63 100644 --- a/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro +++ b/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro @@ -4,5 +4,4 @@ CONFIG += testcase QT = core concurrent bluetooth testlib osx:QT += widgets -osx:CONFIG += insignificant_test DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp index 65aff3fb..b2e43068 100644 --- a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp +++ b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp @@ -241,6 +241,14 @@ void tst_QBluetoothLocalDevice::tst_name() } void tst_QBluetoothLocalDevice::tst_isValid() { +#ifdef Q_OS_OSX + // On OS X we can have a valid device (device.isValid() == true), + // that has neither a name nor a valid address - this happens + // if a Bluetooth adapter is OFF. + if (!QBluetoothLocalDevice::allDevices().count()) + QSKIP("Skipping test due to missing Bluetooth device"); +#endif + QBluetoothLocalDevice localDevice; QBluetoothAddress invalidAddress("FF:FF:FF:FF:FF:FF"); |