summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-05-09 12:18:50 +1000
committerRohan McGovern <rohan.mcgovern@nokia.com>2011-05-18 10:46:48 +1000
commit719ba0ea3ae612ad48630101f4a1b7fadd2d2787 (patch)
tree40b053f94ff7f3b873dd87e71bccda82bd779319 /tests/auto/qnetworkreply/tst_qnetworkreply.cpp
parent5f88d1fd0879aa9b16262dc99c8091ef947b4b09 (diff)
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 (cherry picked from commit bbfefe1b764cd41b7e677f26621fb6e76a67f9d7)
Diffstat (limited to 'tests/auto/qnetworkreply/tst_qnetworkreply.cpp')
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 1ecd5d51fa..85bf0a8524 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -779,7 +779,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";
@@ -951,7 +953,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) {
@@ -1010,7 +1013,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()
@@ -1033,9 +1037,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;
@@ -1194,7 +1198,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);