summaryrefslogtreecommitdiffstats
path: root/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h')
-rw-r--r--tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
index 2fc2b952..0a0ec463 100644
--- a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
+++ b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
@@ -34,6 +34,7 @@
#include <QLocale>
#include <qgeoaddress.h>
#include <qgeoroutereply.h>
+#include <QtLocation/private/qgeoroute_p.h>
#include <QDebug>
#include <QTimer>
@@ -42,6 +43,32 @@
QT_USE_NAMESPACE
+class QGeoRoutePrivateDefaultAlt : public QGeoRoutePrivateDefault
+{
+public:
+ QGeoRoutePrivateDefaultAlt() : QGeoRoutePrivateDefault()
+ {
+ m_travelTime = 123456; // To identify this is actually a QGeoRoutePrivateDefaultAlt
+ }
+ QGeoRoutePrivateDefaultAlt(const QGeoRoutePrivateDefaultAlt &other)
+ : QGeoRoutePrivateDefault(other) {}
+ ~QGeoRoutePrivateDefaultAlt() {}
+
+ void setTravelTime(int travelTime) override
+ {
+ Q_UNUSED(travelTime)
+ }
+};
+
+class QGeoRouteAlt : public QGeoRoute
+{
+public:
+ QGeoRouteAlt()
+ : QGeoRoute(QExplicitlySharedDataPointer<QGeoRoutePrivate>(new QGeoRoutePrivateDefaultAlt()))
+ {
+ }
+};
+
class RouteReplyTest :public QGeoRouteReply
{
Q_OBJECT
@@ -62,6 +89,7 @@ class QGeoRoutingManagerEngineTest: public QGeoRoutingManagerEngine
int timerId_;
QGeoRouteReply::Error errorCode_;
QString errorString_;
+ bool alternateGeoRouteImplementation_;
public:
QGeoRoutingManagerEngineTest(const QVariantMap &parameters,
@@ -70,7 +98,8 @@ public:
routeReply_(0),
finishRequestImmediately_(true),
timerId_(0),
- errorCode_(QGeoRouteReply::NoError)
+ errorCode_(QGeoRouteReply::NoError),
+ alternateGeoRouteImplementation_(false)
{
Q_UNUSED(error)
Q_UNUSED(errorString)
@@ -79,6 +108,10 @@ public:
finishRequestImmediately_ = qvariant_cast<bool>(parameters.value("gc_finishRequestImmediately"));
}
+ if (parameters.contains("gc_alternateGeoRoute")) {
+ alternateGeoRouteImplementation_ = qvariant_cast<bool>(parameters.value("gc_alternateGeoRoute"));
+ }
+
setLocale(QLocale (QLocale::German, QLocale::Germany));
setSupportedFeatureTypes (
QGeoRouteRequest::NoFeature | QGeoRouteRequest::TollFeature |
@@ -140,6 +173,8 @@ public:
for (int i = 0; i < request.numberAlternativeRoutes(); ++i) {
QGeoRoute route;
+ if (alternateGeoRouteImplementation_)
+ route = QGeoRouteAlt();
route.setPath(request.waypoints());
route.setTravelTime(travelTime);