summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkaccessmanager_and_qprogressdialog
diff options
context:
space:
mode:
authorMartin Petersson <martin.petersson@nokia.com>2011-03-17 13:53:13 (GMT)
committerMartin Petersson <martin.petersson@nokia.com>2011-03-17 13:58:03 (GMT)
commit0112a4ce3980bfaf5a3e45a5f77cf65700db5436 (patch)
tree40f2d6e06a25143189a4ca65fc34998becf1df8a /tests/auto/qnetworkaccessmanager_and_qprogressdialog
parentfd009286dfcea0a849d85c824f214e640c4d4ce2 (diff)
downloadQt-0112a4ce3980bfaf5a3e45a5f77cf65700db5436.zip
Qt-0112a4ce3980bfaf5a3e45a5f77cf65700db5436.tar.gz
Qt-0112a4ce3980bfaf5a3e45a5f77cf65700db5436.tar.bz2
QNAM: fix the tst_QNetworkAccessManager_And_QProgressDialog auto test
QNetworkAccessHttpBackend::replyDownloadData could possibly be called recursivly as it will emit downloadProgress. In the case of this test the progress dialog calls progressEvents() which will cause the recursion. Reviewed-by: Markus Goetz
Diffstat (limited to 'tests/auto/qnetworkaccessmanager_and_qprogressdialog')
-rw-r--r--tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp
index 42bb069..f7c5ca1 100644
--- a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp
+++ b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp
@@ -58,6 +58,7 @@ public:
tst_QNetworkAccessManager_And_QProgressDialog();
private slots:
void downloadCheck();
+ void downloadCheck_data();
};
class DownloadCheckWidget : public QWidget
@@ -72,9 +73,14 @@ public:
QMetaObject::invokeMethod(this, "go", Qt::QueuedConnection);
}
bool lateReadyRead;
+ bool zeroCopy;
public slots:
void go()
{
+ QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/bigfile"));
+ if (zeroCopy)
+ request.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, 10*1024*1024);
+
QNetworkReply *reply = netmanager.get(
QNetworkRequest(
QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/bigfile")
@@ -106,20 +112,30 @@ public slots:
QTestEventLoop::instance().exitLoop();
}
-
private:
QProgressDialog progressDlg;
QNetworkAccessManager netmanager;
};
+
tst_QNetworkAccessManager_And_QProgressDialog::tst_QNetworkAccessManager_And_QProgressDialog()
{
Q_SET_DEFAULT_IAP
}
+void tst_QNetworkAccessManager_And_QProgressDialog::downloadCheck_data()
+{
+ QTest::addColumn<bool>("useZeroCopy");
+ QTest::newRow("with-zeroCopy") << true;
+ QTest::newRow("without-zeroCopy") << false;
+}
+
void tst_QNetworkAccessManager_And_QProgressDialog::downloadCheck()
{
+ QFETCH(bool, useZeroCopy);
+
DownloadCheckWidget widget;
+ widget.zeroCopy = useZeroCopy;
widget.show();
// run and exit on finished()
QTestEventLoop::instance().enterLoop(10);