From: Jason McDonald Date: Mon, 9 May 2011 02:18:50 +0000 (+1000) Subject: Remove Q_ASSERT's from QNetworkReply autotest X-Git-Tag: qt-v5.0.0-alpha1~4297^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=719ba0ea3ae612ad48630101f4a1b7fadd2d2787;p=profile%2Fivi%2Fqtbase.git 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) --- diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 1ecd5d5..85bf0a8 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(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);