diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-09 02:18:50 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-10 07:28:37 (GMT) |
commit | bbfefe1b764cd41b7e677f26621fb6e76a67f9d7 (patch) | |
tree | 50c6955e0c1bf6a2d9e7fa0dfa0e19e90744e253 /tests/auto/qnetworkreply | |
parent | 6f5751c45868a6dde51647462a331d49f848f2f0 (diff) | |
download | Qt-bbfefe1b764cd41b7e677f26621fb6e76a67f9d7.zip Qt-bbfefe1b764cd41b7e677f26621fb6e76a67f9d7.tar.gz Qt-bbfefe1b764cd41b7e677f26621fb6e76a67f9d7.tar.bz2 |
Remove Q_ASSERT's from QNetworkReply autotest
Rather than aborting in debug builds and failing mysteriously in release
builds, report fatal errors in all builds.
Change-Id: I020b06e19b7ffc8ae4413e1756259f4ca608f253
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests/auto/qnetworkreply')
-rw-r--r-- | tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index b5bbd84..610ca1f 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -739,7 +739,9 @@ public: QTcpSocket* waitForNextConnectionSocket() { waitForNewConnection(-1); if (doSsl) { - Q_ASSERT(sslSocket); + if (!sslSocket) + qFatal("%s: sslSocket should not be null after calling waitForNewConnection()", + Q_FUNC_INFO); return sslSocket; } else { //qDebug() << "returning nextPendingConnection"; @@ -911,7 +913,8 @@ protected: while (dataIndex < wantedSize) { const int remainingBytes = wantedSize - measuredSentBytes; const int bytesToWrite = qMin(remainingBytes, static_cast<int>(BlockSize)); - Q_ASSERT(bytesToWrite); + if (bytesToWrite <= 0) + qFatal("%s: attempt to write %d bytes", Q_FUNC_INFO, bytesToWrite); measuredSentBytes += writeNextData(client, bytesToWrite); while (client->bytesToWrite() > 0) { @@ -970,7 +973,8 @@ public: // Wait for data to be readyRead bool ok = connect(&senderObj, SIGNAL(dataReady()), this, SLOT(slotDataReady())); - Q_ASSERT(ok); + if (!ok) + qFatal("%s: Cannot connect dataReady signal", Q_FUNC_INFO); } void wrapUp() @@ -993,9 +997,9 @@ protected: void timerEvent(QTimerEvent *) { //qDebug() << "RateControlledReader: timerEvent bytesAvailable=" << device->bytesAvailable(); - if (readBufferSize > 0) { - // This asserts passes all the time, except in the final flush. - //Q_ASSERT(device->bytesAvailable() <= readBufferSize); + if (readBufferSize > 0 && device->bytesAvailable() > readBufferSize) { + // This passes all the time, except in the final flush. + //qFatal("%s: Too many bytes available", Q_FUNC_INFO); } qint64 bytesRead = 0; @@ -1122,7 +1126,7 @@ QString tst_QNetworkReply::runSimpleRequest(QNetworkAccessManager::Operation op, break; default: - Q_ASSERT_X(false, "tst_QNetworkReply", "Invalid/unknown operation requested"); + qFatal("%s: Invalid/unknown operation requested", Q_FUNC_INFO); } reply->setParent(this); |