diff options
-rw-r--r-- | tests/auto/qbluetoothsocket/qbluetoothsocket.pro | 8 | ||||
-rw-r--r-- | tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp | 25 |
2 files changed, 32 insertions, 1 deletions
diff --git a/tests/auto/qbluetoothsocket/qbluetoothsocket.pro b/tests/auto/qbluetoothsocket/qbluetoothsocket.pro index 3c0f9e44..01a836fd 100644 --- a/tests/auto/qbluetoothsocket/qbluetoothsocket.pro +++ b/tests/auto/qbluetoothsocket/qbluetoothsocket.pro @@ -9,4 +9,10 @@ osx:QT += widgets OTHER_FILES += \ README.txt -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +osx { + DEFINES += QT_OSX_BLUETOOTH +} else:android:!android-no-sdk { + DEFINES += QT_ANDROID_BLUETOOTH +} config_bluez:qtHaveModule(dbus) { + DEFINES += QT_BLUEZ_BLUETOOTH +} diff --git a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp index eafa3e80..7af7cf5e 100644 --- a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp +++ b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp @@ -81,6 +81,8 @@ private slots: void tst_error(); + void tst_preferredSecurityFlags(); + public slots: void serviceDiscovered(const QBluetoothServiceInfo &info); void finished(); @@ -499,6 +501,29 @@ void tst_QBluetoothSocket::tst_error() QVERIFY(socket.errorString() == QString()); } +void tst_QBluetoothSocket::tst_preferredSecurityFlags() +{ + QBluetoothSocket socket; + + //test default values +#if defined(QT_ANDROID_BLUETOOTH) | defined(QT_OSX_BLUETOOTH) + QCOMPARE(socket.preferredSecurityFlags(), QBluetooth::Secure); +#elif defined(QT_BLUEZ_BLUETOOTH) + QCOMPARE(socket.preferredSecurityFlags(), QBluetooth::Authorization); +#else + QCOMPARE(socket.preferredSecurityFlags(), QBluetooth::NoSecurity); +#endif + + socket.setPreferredSecurityFlags(QBluetooth::Authentication|QBluetooth::Encryption); + +#if defined(QT_OSX_BLUETOOTH) + QCOMPARE(socket.preferredSecurityFlags(), QBluetooth::Secure); +#else + QCOMPARE(socket.preferredSecurityFlags(), + QBluetooth::Encryption|QBluetooth::Authentication); +#endif +} + QTEST_MAIN(tst_QBluetoothSocket) #include "tst_qbluetoothsocket.moc" |