diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-09-14 21:44:54 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-09-19 14:52:41 +0200 |
commit | ff4207b1a41db4d23d4d0183152776e73f252a3a (patch) | |
tree | 7462fc69d09ac167b9af512220d4e819ac0c4b42 /tests | |
parent | 29bf63108f954119a0df6c70dd283367777a7e23 (diff) | |
download | qtlocation-ff4207b1a41db4d23d4d0183152776e73f252a3a.tar.gz |
Cleanup: de-virtualize QGeoCodeReplyPrivate
The only call to the single virtual function, extraData(), was commented
out. The subclass in the OSM plugin only wrote extra data for debug runs
and the subclass in the mock plugin is never used to test anything anyway.
So remove all this overhead. As a drive-by, refactor to member
initialization and use qsizetype for members that refer to indices in a
QList.
Change-Id: I600b4637bc367ae45d51b2a7f9a3ae0b78fb77c4
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/geotestplugin/qgeocodingmanagerengine_test.h | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h index 6706a19a..8f5f9362 100644 --- a/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h +++ b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h @@ -45,29 +45,11 @@ QT_USE_NAMESPACE - -class GeocodeReplyTestPrivate : public QGeoCodeReplyPrivate -{ -public: - GeocodeReplyTestPrivate() - { - } - ~GeocodeReplyTestPrivate() - { - } - QVariantMap extraData() const override - { - return m_extraData; - } - - QVariantMap m_extraData; -}; - class GeocodeReplyTest :public QGeoCodeReply { Q_OBJECT public: - GeocodeReplyTest(QObject *parent = 0) : QGeoCodeReply (*new GeocodeReplyTestPrivate, parent) {} + using QGeoCodeReply::QGeoCodeReply; void callAddLocation ( const QGeoLocation & location ) {addLocation(location);} void callSetError ( Error error, const QString & errorString ) {setError(error, errorString);} @@ -129,8 +111,6 @@ public: if (errorCode_ == QGeoCodeReply::NoError) setLocations(geocodeReply_, searchString, limit, offset); - if (includeExtendedData_) - injectExtra(geocodeReply_, extendedReplyData_); if (finishRequestImmediately_) { // check if we should finish with error @@ -152,8 +132,6 @@ public: geocodeReply_ = new GeocodeReplyTest(); connect(geocodeReply_, SIGNAL(aborted()), this, SLOT(requestAborted())); geocodeReply_->callSetViewport(bounds); - if (includeExtendedData_) - injectExtra(geocodeReply_, extendedReplyData_); if (address.street().startsWith("error")) { errorString_ = address.street(); @@ -249,8 +227,6 @@ public: setLocations(geocodeReply_, coordinate); geocodeReply_->callSetViewport(bounds); - if (includeExtendedData_) - injectExtra(geocodeReply_, extendedReplyData_); if (coordinate.latitude() > 70) { errorString_ = "error"; @@ -292,13 +268,6 @@ protected: emit finished(geocodeReply_); } - static void injectExtra(QGeoCodeReply *reply, const QVariantMap &extra) - { - GeocodeReplyTestPrivate *replyPrivate - = static_cast<GeocodeReplyTestPrivate *>(QGeoCodeReplyPrivate::get(*reply)); - replyPrivate->m_extraData = extra; - } - static void injectExtra(QGeoLocation &location, const QVariantMap &extra) { location.setExtendedAttributes(extra); |