From c231e60cd3aa982b10512c5c23bbca04223ed407 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Fri, 20 Sep 2013 15:29:39 +0200 Subject: Error handling for QBluetoothServer Task-number: QTBUG-32669 Change-Id: I0f12b19f7989972b7c8305f6e11a95f7f25a281d Reviewed-by: Alex Blasche --- tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp | 4 +--- tests/auto/qrfcommserver/tst_qrfcommserver.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp index a34f289d..e9ad44c1 100644 --- a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp +++ b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp @@ -755,10 +755,8 @@ void tst_QBluetoothSocket::tst_error() QCOMPARE(errorSpy.count(), 0); const QBluetoothSocket::SocketError e = socket.error(); - QVERIFY(e != QBluetoothSocket::ConnectionRefusedError - && e != QBluetoothSocket::HostNotFoundError + QVERIFY(e != QBluetoothSocket::HostNotFoundError && e != QBluetoothSocket::NetworkError - && e != QBluetoothSocket::RemoteHostClosedError && e != QBluetoothSocket::ServiceNotFoundError && e != QBluetoothSocket::UnknownSocketError); diff --git a/tests/auto/qrfcommserver/tst_qrfcommserver.cpp b/tests/auto/qrfcommserver/tst_qrfcommserver.cpp index d8324c33..cc64826c 100644 --- a/tests/auto/qrfcommserver/tst_qrfcommserver.cpp +++ b/tests/auto/qrfcommserver/tst_qrfcommserver.cpp @@ -78,6 +78,8 @@ private slots: void tst_receive_data(); void tst_receive(); + void tst_error(); + private: QBluetoothLocalDevice localDevice; }; @@ -311,6 +313,21 @@ void tst_QRfcommServer::tst_secureFlags() QCOMPARE(server.securityFlags(), QBluetooth::Encryption); } + +void tst_QRfcommServer::tst_error() +{ + QBluetoothServer server(QBluetoothServiceInfo::RfcommProtocol); + QSignalSpy errorSpy(&server, SIGNAL(error(QBluetoothServer::Error))); + QCOMPARE(errorSpy.count(), 0); + const QBluetoothServer::Error e = server.error(); + + QVERIFY(e != QBluetoothServer::UnknownError + && e != QBluetoothServer::PoweredOffError + && e != QBluetoothServer::InputOutputError + && e != QBluetoothServer::ServiceAlreadyRegisteredError + && e != QBluetoothServer::UnsupportedProtocolError); +} + QTEST_MAIN(tst_QRfcommServer) #include "tst_qrfcommserver.moc" -- cgit v1.2.3