diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-09-14 19:00:18 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-09-22 14:56:49 +0200 |
commit | 30366d0850af1e5409d637652c53a8fab9a7ddc1 (patch) | |
tree | 009b2d58921e4e6013fce302ec0900c7ff8a021c /tests | |
parent | 634d9772e52e24ad3709da1b5161c421c1a7370e (diff) | |
download | qtlocation-30366d0850af1e5409d637652c53a8fab9a7ddc1.tar.gz |
Cleanup: de-virtualize QGeoRoutePrivate
The possibility to override this type in plugins was used for metadata
that might just as well live in the extended attributes. And the usecase
of making the basic passing of data from a private through a public type
does not justify the overhead, and can be solved by simply initializing
the value in the test plugin through the public setter.
So remove this; if this is really needed for anything, then we can bring
it back later.
Change-Id: Iad8689b54f64fa89535d0ebc3c399b4fd054f9d7
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/qgeoroutingmanagerengine_test.h | 34 | ||||
-rw-r--r-- | tests/auto/qgeoroute/tst_qgeoroute.cpp | 6 |
2 files changed, 5 insertions, 35 deletions
diff --git a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h index e1815b35..a889c393 100644 --- a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h +++ b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h @@ -42,36 +42,6 @@ QT_USE_NAMESPACE - -class QGeoRoutePrivateDefaultAlt : public QGeoRoutePrivateDefault -{ -public: - QGeoRoutePrivateDefaultAlt() : QGeoRoutePrivateDefault() - { - } - QGeoRoutePrivateDefaultAlt(const QGeoRoutePrivateDefaultAlt &other) - : QGeoRoutePrivateDefault(other) {} - ~QGeoRoutePrivateDefaultAlt() {} - - void setTravelTime(int travelTime) override - { - Q_UNUSED(travelTime); - } - int travelTime() const override - { - return 123456; // To identify this is actually a QGeoRoutePrivateDefaultAlt - } -}; - -class QGeoRouteAlt : public QGeoRoute -{ -public: - QGeoRouteAlt() - : QGeoRoute(QExplicitlySharedDataPointer<QGeoRoutePrivate>(new QGeoRoutePrivateDefaultAlt())) - { - } -}; - class RouteReplyTest :public QGeoRouteReply { Q_OBJECT @@ -176,10 +146,10 @@ public: for (int i = 0; i < request.numberAlternativeRoutes(); ++i) { QGeoRoute route; - if (alternateGeoRouteImplementation_) - route = QGeoRouteAlt(); route.setPath(request.waypoints()); route.setTravelTime(travelTime); + if (alternateGeoRouteImplementation_) + route.setTravelTime(123456); const QList<QVariantMap> metadata = request.waypointsMetadata(); for (const auto &meta: metadata) { diff --git a/tests/auto/qgeoroute/tst_qgeoroute.cpp b/tests/auto/qgeoroute/tst_qgeoroute.cpp index e3fb4f08..feb61099 100644 --- a/tests/auto/qgeoroute/tst_qgeoroute.cpp +++ b/tests/auto/qgeoroute/tst_qgeoroute.cpp @@ -251,11 +251,11 @@ void tst_QGeoRoute::operators() QVERIFY(!(qgeoroute != qgeoroutecopy)); - QGeoRouteAlt rAlt; QGeoRoute r; - QCOMPARE(rAlt.travelTime(), 123456); QCOMPARE(r.travelTime(), 0); - r = rAlt; + QGeoRoute r2; + r2.setTravelTime(123456); + r = r2; QCOMPARE(r.travelTime(), 123456); } |