diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2010-06-15 05:38:54 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2010-06-15 05:38:54 (GMT) |
commit | 37d71b2653b9f31ee73fdd09b0d2be757d4537bd (patch) | |
tree | 5877aa8f77e34db7ab6d9c58180d32952c65b49c /tests/auto | |
parent | eaa981c943293bf346a041aa4ad3d254e99ebd78 (diff) | |
parent | dd2be9c7e7540870ddc532f02bd83860273cbbd6 (diff) | |
download | Qt-37d71b2653b9f31ee73fdd09b0d2be757d4537bd.zip Qt-37d71b2653b9f31ee73fdd09b0d2be757d4537bd.tar.gz Qt-37d71b2653b9f31ee73fdd09b0d2be757d4537bd.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into qt-4.7-from-4.6
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qimagereader/tst_qimagereader.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 49 |
2 files changed, 41 insertions, 12 deletions
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index aadee5b..1fe1332 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -1884,14 +1884,14 @@ void tst_QImageReader::testIgnoresFormatAndExtension() QFETCH(QString, expected); QList<QByteArray> formats = QImageReader::supportedImageFormats(); - QString fileNameBase = "images/" + name + "."; + QString fileNameBase = prefix + name + "."; foreach (const QByteArray &f, formats) { if (f == extension) continue; QFile tmp(QDir::tempPath() + "/" + name + "_" + expected + "." + f); - QFile::copy(fileNameBase + extension, QFileInfo(tmp).absoluteFilePath()); + QVERIFY(QFile::copy(fileNameBase + extension, QFileInfo(tmp).absoluteFilePath())); QString format; QImage image; diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index d2cba6e..9c09917 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -115,7 +115,8 @@ private slots: void writeToClientAndDisconnect(); void debug(); void bytesWrittenSignal(); - + void syncDisconnectNotify(); + void asyncDisconnectNotify(); #ifdef Q_OS_SYMBIAN private: @@ -996,16 +997,9 @@ void tst_QLocalSocket::writeToClientAndDisconnect() clientSocket->close(); server.close(); - // Wait for the client to notice the broken connection. - int timeout = 5000; - do { - const int timestep = 100; - QTest::qWait(timestep); - timeout -= timestep; - } while (!readChannelFinishedSpy.count() && timeout > 0); - - QCOMPARE(readChannelFinishedSpy.count(), 1); + QTRY_COMPARE(readChannelFinishedSpy.count(), 1); QCOMPARE(client.read(buffer, sizeof(buffer)), (qint64)sizeof(buffer)); + client.waitForDisconnected(); QCOMPARE(client.state(), QLocalSocket::UnconnectedState); } @@ -1061,6 +1055,41 @@ void tst_QLocalSocket::bytesWrittenSignal() QVERIFY(writeThread.wait(2000)); } +void tst_QLocalSocket::syncDisconnectNotify() +{ +#ifdef Q_OS_SYMBIAN + unlink("syncDisconnectNotify"); +#endif + + QLocalServer server; + QVERIFY(server.listen("syncDisconnectNotify")); + QLocalSocket client; + client.connectToServer("syncDisconnectNotify"); + QVERIFY(server.waitForNewConnection()); + QLocalSocket* serverSocket = server.nextPendingConnection(); + QVERIFY(serverSocket); + delete serverSocket; + QCOMPARE(client.waitForReadyRead(), false); +} + +void tst_QLocalSocket::asyncDisconnectNotify() +{ +#ifdef Q_OS_SYMBIAN + unlink("asyncDisconnectNotify"); +#endif + + QLocalServer server; + QVERIFY(server.listen("asyncDisconnectNotify")); + QLocalSocket client; + QSignalSpy disconnectedSpy(&client, SIGNAL(disconnected())); + client.connectToServer("asyncDisconnectNotify"); + QVERIFY(server.waitForNewConnection()); + QLocalSocket* serverSocket = server.nextPendingConnection(); + QVERIFY(serverSocket); + delete serverSocket; + QTRY_VERIFY(!disconnectedSpy.isEmpty()); +} + #ifdef Q_OS_SYMBIAN void tst_QLocalSocket::unlink(QString name) { |