diff options
Diffstat (limited to 'tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp')
-rw-r--r-- | tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
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" |