summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2016-09-14 16:28:38 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2016-11-29 10:52:47 +0000
commit0a552f285fdc3760d9755109ceef3b87392a308d (patch)
tree943e169f0c002d8e9f74badd0f3ad7a452229e4d /tests
parent9b76e151b897698e285e4e39158b5934dc498bd1 (diff)
downloadqtlocation-0a552f285fdc3760d9755109ceef3b87392a308d.tar.gz
Refactoring: removing m_reply from GeoReply classes
This patch tries to simplify the code removing the contained m_reply from all the Geo[Map,Route,Geocode,Places]Reply classes. The need for m_reply was associated to the "abort" method, but this can be solved by emitting a signal in the superclass abort() method, and connecting that to QNetworkReply::abort() in the constructor. Since QNetworkReplyHttpImpl always sends an OperationCanceledError it should then be safe to call deleteLater() on the network reply in the slot connected to QNetworkReply::error This patch also prevents the series of "QCoreApplication::postEvent: Unexpected null receiver" warnings that are generated due to deletingLater already deleted objects (abort() emits an error, the reply is destroyed inside the onError slot, but also in the abort() method). Finally, this patch removes the setFinished() call in QGeoRouteReply::abort() since the documentation does not mention this, and all the subclasses do not perform this operation and emit the corresponding signal. tst_qgeoroutereply has been adapted accordingly. Change-Id: I226ee163e7bed784dd7f0da1522e651459543bca Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/geotestplugin/qgeocodingmanagerengine_test.h5
-rw-r--r--tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h6
-rw-r--r--tests/auto/qgeoroutereply/tst_qgeoroutereply.cpp2
3 files changed, 1 insertions, 12 deletions
diff --git a/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h
index 1d9f0792..ecbb60d1 100644
--- a/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h
+++ b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h
@@ -57,11 +57,6 @@ public:
void callSetOffset ( int offset ) {setOffset(offset);}
void callSetLocations ( const QList<QGeoLocation> & locations ) {setLocations(locations);}
void callSetViewport ( const QGeoShape &viewport ) {setViewport(viewport);}
- void abort() {
- emit aborted();
- }
-Q_SIGNALS:
- void aborted();
};
class QGeoCodingManagerEngineTest: public QGeoCodingManagerEngine
diff --git a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
index 8ae58042..0a1e7ce6 100644
--- a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
+++ b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
@@ -52,12 +52,6 @@ public:
void callSetError ( Error error, const QString & errorString ) {setError(error, errorString);}
void callSetFinished ( bool finished ) {setFinished(finished);}
void callSetRoutes(const QList<QGeoRoute> &routes) {setRoutes(routes);}
-
- void abort() {
- emit aborted();
- }
-Q_SIGNALS:
- void aborted();
};
class QGeoRoutingManagerEngineTest: public QGeoRoutingManagerEngine
diff --git a/tests/auto/qgeoroutereply/tst_qgeoroutereply.cpp b/tests/auto/qgeoroutereply/tst_qgeoroutereply.cpp
index 447181f2..de406b40 100644
--- a/tests/auto/qgeoroutereply/tst_qgeoroutereply.cpp
+++ b/tests/auto/qgeoroutereply/tst_qgeoroutereply.cpp
@@ -197,7 +197,7 @@ void tst_QGeoRouteReply::abort()
reply->abort();
QCOMPARE(signalerror->count(), 0);
- QCOMPARE(signalfinished->count(), 1);
+ QCOMPARE(signalfinished->count(), 0);
}
void tst_QGeoRouteReply::error()