diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-04-01 12:04:44 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-09 20:53:06 +0200 |
commit | 1a6410f91f5e5edf11508e19176123b54e474e83 (patch) | |
tree | 1f4674b744d0b319ccbac7a1ade799fec233bbd5 /tests | |
parent | 229c98abf0069e181704c6db9043f0cec00eff97 (diff) |
Change QVERIFY in tst_qnetworkreply to warning.
FAIL! : tst_QNetworkReply::ioPostToHttpUploadProgress() 'args.at(0).toLongLong() != sourceFile.size()' returned FALSE. ()
Task-number: QTBUG-37449
Task-number: QTBUG-24226
Change-Id: Idcc0ceac0332705b1e3a073d40fa8098bea2c9f3
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index fbac7dc77c..0509eb9a77 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. @@ -4876,6 +4876,7 @@ void tst_QNetworkReply::ioPostToHttpUploadProgress() //test file must be larger than OS socket buffers (~830kB on MacOS 10.6) QFile sourceFile(testDataDir + "/image1.jpg"); QVERIFY(sourceFile.open(QIODevice::ReadOnly)); + const qint64 sourceFileSize = sourceFile.size(); // emulate a minimal http server QTcpServer server; @@ -4900,24 +4901,32 @@ void tst_QNetworkReply::ioPostToHttpUploadProgress() QTestEventLoop::instance().enterLoop(5); // some progress should have been made QVERIFY(!spy.isEmpty()); - QList<QVariant> args = spy.last(); + const QList<QVariant> args = spy.last(); QVERIFY(!args.isEmpty()); - QVERIFY(args.at(0).toLongLong() > 0); - // but not everything! - QVERIFY(args.at(0).toLongLong() != sourceFile.size()); + const qint64 bufferedUploadProgress = args.at(0).toLongLong(); + QVERIFY(bufferedUploadProgress > 0); + // but not everything? - Note however, that under CI virtualization, + // particularly on Windows, it frequently happens that the whole file + // is uploaded in one chunk. + if (bufferedUploadProgress == sourceFileSize) { + qWarning() << QDir::toNativeSeparators(sourceFile.fileName()) + << "of" << sourceFileSize << "bytes was uploaded in one go."; + } // set the read buffer to unlimited incomingSocket->setReadBufferSize(0); QTestEventLoop::instance().enterLoop(10); // progress should be finished QVERIFY(!spy.isEmpty()); - QList<QVariant> args3 = spy.last(); + const QList<QVariant> args3 = spy.last(); QVERIFY(!args3.isEmpty()); // More progress than before - QVERIFY(args3.at(0).toLongLong() > args.at(0).toLongLong()); - QCOMPARE(args3.at(0).toLongLong(), args3.at(1).toLongLong()); + const qint64 unbufferedUploadProgress = args3.at(0).toLongLong(); + if (bufferedUploadProgress < sourceFileSize) + QVERIFY(unbufferedUploadProgress > bufferedUploadProgress); + QCOMPARE(unbufferedUploadProgress, args3.at(1).toLongLong()); // And actually finished.. - QCOMPARE(args3.at(0).toLongLong(), sourceFile.size()); + QCOMPARE(unbufferedUploadProgress, sourceFileSize); // after sending this, the QNAM should emit finished() connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); |