diff options
author | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2009-05-20 13:01:04 (GMT) |
---|---|---|
committer | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2009-05-20 13:01:04 (GMT) |
commit | f0d465e39eee9f819d0453b1bf66b3b0462383e2 (patch) | |
tree | 15ef4d800d5e66ec02a3da5297929f00d856b569 /tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp | |
parent | d5348b5fc3a6efe13fd1dbe585b28addfa4344b3 (diff) | |
download | Qt-f0d465e39eee9f819d0453b1bf66b3b0462383e2.zip Qt-f0d465e39eee9f819d0453b1bf66b3b0462383e2.tar.gz Qt-f0d465e39eee9f819d0453b1bf66b3b0462383e2.tar.bz2 |
I made test more stable. There was no sens to check hardcoded size of
header + file. Now test check only size of the real file content,
assuming that it is rather boring (9,5MB of '\0'). It simply skip
header.
Reviewed by Peter Hartmann
Diffstat (limited to 'tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp')
-rw-r--r-- | tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp index f501e78..5ab5064 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -795,14 +795,14 @@ void tst_QSocks5SocketEngine::downloadBigFile() if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); - QCOMPARE(bytesAvailable, qint64(10000309)); + QCOMPARE(bytesAvailable, qint64(10000000)); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - qDebug("\t\t%.1fMB/%.1fs: %.1fMB/s", + /*qDebug("\t\t%.1fMB/%.1fs: %.1fMB/s", bytesAvailable / (1024.0 * 1024.0), stopWatch.elapsed() / 1024.0, - (bytesAvailable / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); + (bytesAvailable / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));*/ delete tmpSocket; tmpSocket = 0; @@ -816,7 +816,10 @@ void tst_QSocks5SocketEngine::exitLoopSlot() void tst_QSocks5SocketEngine::downloadBigFileSlot() { - bytesAvailable += tmpSocket->readAll().size(); + QByteArray tmp=tmpSocket->readAll(); + int correction=tmp.indexOf((char)0,0); //skip header + if (correction==-1) correction=0; + bytesAvailable += (tmp.size()-correction); if (bytesAvailable >= 10000000) QTestEventLoop::instance().exitLoop(); } |