diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-04-23 15:08:37 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-04-23 15:08:37 (GMT) |
commit | 4ec0d20bda2d7c4dfd1da41d52404481f5ecd42c (patch) | |
tree | e1ea07496c1e9e83305c412e31b718f9d31092d9 /tests | |
parent | ff4864e079accef109a8a45e9754f7ac34718ec5 (diff) | |
parent | 5a46b82feea371868a9c793f6df14d92654c2423 (diff) | |
download | Qt-4ec0d20bda2d7c4dfd1da41d52404481f5ecd42c.zip Qt-4ec0d20bda2d7c4dfd1da41d52404481f5ecd42c.tar.gz Qt-4ec0d20bda2d7c4dfd1da41d52404481f5ecd42c.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index f741b96..deabda6 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -95,6 +95,7 @@ private slots: void longPath(); void waitForDisconnect(); + void waitForDisconnectByServer(); void removeServer(); @@ -112,6 +113,8 @@ tst_QLocalSocket::tst_QLocalSocket() #endif )) qWarning() << "lackey executable doesn't exists!"; + + QLocalServer::removeServer("tst_localsocket"); } tst_QLocalSocket::~tst_QLocalSocket() @@ -783,6 +786,25 @@ void tst_QLocalSocket::waitForDisconnect() QVERIFY(timer.elapsed() < 2000); } +void tst_QLocalSocket::waitForDisconnectByServer() +{ + QString name = "tst_localsocket"; + LocalServer server; + QVERIFY(server.listen(name)); + LocalSocket socket; + QSignalSpy spy(&socket, SIGNAL(disconnected())); + QVERIFY(spy.isValid()); + socket.connectToServer(name); + QVERIFY(socket.waitForConnected(3000)); + QVERIFY(server.waitForNewConnection(3000)); + QLocalSocket *serverSocket = server.nextPendingConnection(); + QVERIFY(serverSocket); + serverSocket->close(); + QVERIFY(serverSocket->state() == QLocalSocket::UnconnectedState); + QVERIFY(socket.waitForDisconnected(3000)); + QCOMPARE(spy.count(), 1); +} + void tst_QLocalSocket::removeServer() { // this is a hostile takeover, but recovering from a crash results in the same |