summaryrefslogtreecommitdiffstats
path: root/tests/auto/qbluetoothlocaldevice
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2017-08-07 13:23:52 +0200
committerOliver Wolff <oliver.wolff@qt.io>2017-08-30 13:33:16 +0000
commitd7af5496668da92bfa48564053bfc039cef6ecea (patch)
tree558c8c0298332d5159d13c0b445443dc6c91778c /tests/auto/qbluetoothlocaldevice
parent43a382c16d1c5c80e7a97577a6eb3511dff8c359 (diff)
winrt: Use config feature when checking for winrt backend in auto tests
As the winrt backend may also be used on desktop Windows, checking for the operating system does no longer work. While touching these lines deprecated OS X checks were fixed as well. Task-number: QTBUG-61566 Change-Id: I247979aa63de6a71ac4908bda946d7db1e29b6c3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests/auto/qbluetoothlocaldevice')
-rw-r--r--tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro2
-rw-r--r--tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp10
2 files changed, 8 insertions, 4 deletions
diff --git a/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro b/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro
index 20739987..1c4da732 100644
--- a/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro
+++ b/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro
@@ -2,5 +2,5 @@ SOURCES += tst_qbluetoothlocaldevice.cpp
TARGET=tst_qbluetoothlocaldevice
CONFIG += testcase
-QT = core concurrent bluetooth testlib
+QT = core concurrent bluetooth-private testlib
osx:QT += widgets
diff --git a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
index fcba4c3a..ea1abef2 100644
--- a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
+++ b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
@@ -31,6 +31,7 @@
#include <QDebug>
#include <QVariant>
+#include <private/qtbluetoothglobal_p.h>
#include <qbluetoothaddress.h>
#include <qbluetoothlocaldevice.h>
@@ -236,7 +237,7 @@ void tst_QBluetoothLocalDevice::tst_name()
}
void tst_QBluetoothLocalDevice::tst_isValid()
{
-#ifdef Q_OS_OSX
+#if defined(Q_OS_MACOS) || QT_CONFIG(winrt_bt)
// 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.
@@ -270,7 +271,7 @@ void tst_QBluetoothLocalDevice::tst_isValid()
QVERIFY(!invalidLocalDevice.isValid());
QCOMPARE(invalidLocalDevice.address(), QBluetoothAddress());
QCOMPARE(invalidLocalDevice.name(), QString());
-#ifndef Q_OS_WINRT
+#if !QT_CONFIG(winrt_bt)
QCOMPARE(invalidLocalDevice.pairingStatus(QBluetoothAddress()), QBluetoothLocalDevice::Unpaired );
QCOMPARE(invalidLocalDevice.hostMode(), QBluetoothLocalDevice::HostPoweredOff);
#else
@@ -393,7 +394,7 @@ void tst_QBluetoothLocalDevice::tst_pairingStatus_data()
QTest::addColumn<QBluetoothAddress>("deviceAddress");
QTest::addColumn<QBluetoothLocalDevice::Pairing>("pairingExpected");
-#ifndef Q_OS_WINRT
+#if !QT_CONFIG(winrt_bt)
QTest::newRow("UnPaired Device: DUMMY") << QBluetoothAddress("11:00:00:00:00:00")
<< QBluetoothLocalDevice::Unpaired;
QTest::newRow("Invalid device") << QBluetoothAddress() << QBluetoothLocalDevice::Unpaired;
@@ -411,6 +412,9 @@ void tst_QBluetoothLocalDevice::tst_pairingStatus()
QFETCH(QBluetoothAddress, deviceAddress);
QFETCH(QBluetoothLocalDevice::Pairing, pairingExpected);
+ if (!QBluetoothLocalDevice::allDevices().count())
+ QSKIP("Skipping test due to missing Bluetooth device");
+
QBluetoothLocalDevice localDevice;
QCOMPARE(pairingExpected, localDevice.pairingStatus(deviceAddress));
}