summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2010-03-25 15:18:52 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-03-25 15:25:06 (GMT)
commitcc22a14f3d2159a8f760b44e3fe1636a3721ce95 (patch)
tree1e779b4b9cc147f153bf915f44eda21ea92b5296 /tests/auto/qnetworkreply/tst_qnetworkreply.cpp
parent656c02f128c56177c48b3de47f7b1e17dbbfa4d3 (diff)
downloadQt-cc22a14f3d2159a8f760b44e3fe1636a3721ce95.zip
Qt-cc22a14f3d2159a8f760b44e3fe1636a3721ce95.tar.gz
Qt-cc22a14f3d2159a8f760b44e3fe1636a3721ce95.tar.bz2
tst_qnetworkreply: Fix side effect, add another test
Fix a test that had a side effect. But actually do the side effect in the last test: Have a QNetworkReply that is parented to the application so it gets destructed after the QNetworkAccessManager. Reviewed-by: gabi
Diffstat (limited to 'tests/auto/qnetworkreply/tst_qnetworkreply.cpp')
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 261e613..71ee2d0 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -275,6 +275,9 @@ private Q_SLOTS:
void ignoreSslErrorsListWithSlot_data();
void ignoreSslErrorsListWithSlot();
#endif
+
+ // NOTE: This test must be last!
+ void parentingRepliesToTheApp();
};
QT_BEGIN_NAMESPACE
@@ -3831,7 +3834,7 @@ void tst_QNetworkReply::httpConnectionCount()
for (int i = 0; i < 10; i++) {
QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/" + QString::number(i)));
QNetworkReply* reply = manager.get(request);
- reply->setParent(this);
+ reply->setParent(&server);
}
int pendingConnectionCount = 0;
@@ -4105,5 +4108,13 @@ void tst_QNetworkReply::ignoreSslErrorsListWithSlot()
#endif // QT_NO_OPENSSL
+// NOTE: This test must be last testcase in tst_qnetworkreply!
+void tst_QNetworkReply::parentingRepliesToTheApp()
+{
+ QNetworkRequest request (QUrl("http://" + QtNetworkSettings::serverName()));
+ manager.get(request)->setParent(this); // parent to this object
+ manager.get(request)->setParent(qApp); // parent to the app
+}
+
QTEST_MAIN(tst_QNetworkReply)
#include "tst_qnetworkreply.moc"