Add a test for QLocalSocket::open

This should have been done in the commit that introduced open
(953255abab), but was missing.

Change-Id: I1c2de4ad5fa42aa5b90646e7d4d7d1b1570a0f87
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Thiago Macieira 2013-07-07 10:22:15 -07:00 committed by The Qt Project
parent 87db2fdef3
commit 4a7e37b0a3

View File

@ -78,6 +78,8 @@ private slots:
void listenAndConnect_data();
void listenAndConnect();
void connectWithOpen();
void sendData_data();
void sendData();
@ -452,6 +454,27 @@ void tst_QLocalSocket::listenAndConnect()
QCOMPARE(spyNewConnection.count(), (canListen ? connections : 0));
}
void tst_QLocalSocket::connectWithOpen()
{
LocalServer server;
QVERIFY(server.listen("tst_qlocalsocket"));
LocalSocket socket;
socket.setServerName("tst_qlocalsocket");
QVERIFY(socket.open());
bool timedOut = true;
QVERIFY(server.waitForNewConnection(3000, &timedOut));
#if defined(QT_LOCALSOCKET_TCP)
QTest::qWait(250);
#endif
QVERIFY(!timedOut);
socket.close();
server.close();
}
void tst_QLocalSocket::sendData_data()
{
listenAndConnect_data();