summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authoralex <alex.blasche@nokia.com>2011-12-14 15:28:15 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-19 02:09:38 +0100
commit98cf93c08e33aad4dd617d20e02c845cf053036a (patch)
tree965709029bab49ceb1a09063e054165806882f3e /tests
parent24a7188845f36eebab208ab626803663d8168ac2 (diff)
downloadqtlocation-98cf93c08e33aad4dd617d20e02c845cf053036a.tar.gz
Add unit tests for QGeoRouteSegment and QGeoRoutingManager
This includes a plug-in for testing the routing manager. Change-Id: I8c8da33bf04831ffc3a20304293c338285b73e96 Reviewed-by: David Laing <david.laing@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/qgeoroutesegment/qgeoroutesegment.pro9
-rw-r--r--tests/auto/qgeoroutesegment/tst_qgeoroutesegment.cpp315
-rw-r--r--tests/auto/qgeoroutesegment/tst_qgeoroutesegment.h95
-rw-r--r--tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro9
-rw-r--r--tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.cpp157
-rw-r--r--tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.h87
-rw-r--r--tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerengine_test.h89
-rw-r--r--tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro14
-rw-r--r--tests/auto/qgeoroutingmanagerplugins/qgeoserviceproviderplugin_test.cpp76
-rw-r--r--tests/auto/qgeoroutingmanagerplugins/qgeoserviceproviderplugin_test.h69
11 files changed, 923 insertions, 0 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index cb7a7d3b..dc191682 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -37,6 +37,9 @@ SUBDIRS += geotestplugin \
qgeoroute \
qgeoroutereply \
qgeorouterequest \
+ qgeoroutesegment \
+ qgeoroutingmanager \
+ qgeoroutingmanagerplugins \
qgeosatelliteinfo \
qgeosatelliteinfosource \
qnmeapositioninfosource \
diff --git a/tests/auto/qgeoroutesegment/qgeoroutesegment.pro b/tests/auto/qgeoroutesegment/qgeoroutesegment.pro
new file mode 100644
index 00000000..413363fd
--- /dev/null
+++ b/tests/auto/qgeoroutesegment/qgeoroutesegment.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+CONFIG+=testcase
+TARGET=tst_qgeoroutesegment
+
+# Input
+HEADERS += tst_qgeoroutesegment.h
+SOURCES += tst_qgeoroutesegment.cpp
+
+QT += location testlib
diff --git a/tests/auto/qgeoroutesegment/tst_qgeoroutesegment.cpp b/tests/auto/qgeoroutesegment/tst_qgeoroutesegment.cpp
new file mode 100644
index 00000000..27c26bbc
--- /dev/null
+++ b/tests/auto/qgeoroutesegment/tst_qgeoroutesegment.cpp
@@ -0,0 +1,315 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "tst_qgeoroutesegment.h"
+
+QT_USE_NAMESPACE
+
+tst_QGeoRouteSegment::tst_QGeoRouteSegment()
+{
+}
+
+void tst_QGeoRouteSegment::initTestCase()
+{
+}
+
+void tst_QGeoRouteSegment::cleanupTestCase()
+{
+}
+
+void tst_QGeoRouteSegment::init()
+{
+ qgeocoordinate = new QGeoCoordinate();
+ qgeoroutesegment = new QGeoRouteSegment();
+ qgeomaneuver = new QGeoManeuver();
+}
+
+void tst_QGeoRouteSegment::cleanup()
+{
+ delete qgeocoordinate;
+ delete qgeoroutesegment;
+}
+
+void tst_QGeoRouteSegment::constructor()
+{
+ QVERIFY(!qgeoroutesegment->isValid());
+ QCOMPARE(qgeoroutesegment->distance(), qreal(0.0));
+ QCOMPARE(qgeoroutesegment->maneuver(),*qgeomaneuver);
+ QCOMPARE(qgeoroutesegment->travelTime(),0);
+}
+
+void tst_QGeoRouteSegment::copy_constructor()
+{
+ QGeoRouteSegment *qgeoroutesegmentcopy = new QGeoRouteSegment(*qgeoroutesegment);
+
+ QCOMPARE(*qgeoroutesegment, *qgeoroutesegmentcopy);
+
+ QVERIFY(!qgeoroutesegmentcopy->isValid());
+ QCOMPARE(qgeoroutesegmentcopy->distance(), qreal(0.0));
+ QCOMPARE(qgeoroutesegmentcopy->maneuver(), *qgeomaneuver);
+ QCOMPARE(qgeoroutesegmentcopy->travelTime(), 0);
+
+ delete qgeoroutesegmentcopy;
+}
+
+void tst_QGeoRouteSegment::destructor()
+{
+ QGeoRouteSegment *qgeoroutesegmentcopy;
+
+ qgeoroutesegmentcopy = new QGeoRouteSegment();
+ delete qgeoroutesegmentcopy;
+
+ qgeoroutesegmentcopy = new QGeoRouteSegment(*qgeoroutesegment);
+ delete qgeoroutesegmentcopy;
+}
+
+
+void tst_QGeoRouteSegment::travelTime()
+{
+ QFETCH(int, traveltime);
+
+ QGeoRouteSegment sgmt;
+ QVERIFY(!sgmt.isValid());
+
+ sgmt.setTravelTime(traveltime);
+
+ QVERIFY(sgmt.isValid());
+ QCOMPARE(sgmt.travelTime(), traveltime);
+}
+
+void tst_QGeoRouteSegment::travelTime_data()
+{
+ QTest::addColumn<int>("traveltime");
+
+ QTest::newRow("travel1") << 0;
+ QTest::newRow("travel2") << -50;
+ QTest::newRow("travel3") << 324556;
+}
+
+void tst_QGeoRouteSegment::distance()
+{
+ QFETCH(qreal, distance);
+
+ QGeoRouteSegment sgmt;
+ QVERIFY(!sgmt.isValid());
+
+ sgmt.setDistance(distance);
+
+ QVERIFY(sgmt.isValid());
+ QCOMPARE(sgmt.distance(), distance);
+}
+
+void tst_QGeoRouteSegment::distance_data()
+{
+ QTest::addColumn<qreal>("distance");
+
+ QTest::newRow("distance1") << qreal(0.0) ;
+ QTest::newRow("distance2") << qreal(-50.3435) ;
+ QTest::newRow("distance3") << qreal(324556.543534) ;
+}
+
+
+void tst_QGeoRouteSegment::path()
+{
+ QFETCH(QList<double>, coordinates);
+
+ QGeoRouteSegment sgmt;
+ QVERIFY(!sgmt.isValid());
+
+ QList<QGeoCoordinate> path;
+
+ for (int i = 0; i < coordinates.size(); i += 2) {
+ path.append(QGeoCoordinate(coordinates.at(i), coordinates.at(i+1)));
+ }
+
+ sgmt.setPath(path);
+ QVERIFY(sgmt.isValid());
+
+ QList<QGeoCoordinate> pathretrieved = sgmt.path();
+ QCOMPARE(pathretrieved, path);
+
+ for (int i = 0; i < pathretrieved.size(); i++) {
+ QCOMPARE(pathretrieved.at(i), path.at(i));
+ }
+}
+
+void tst_QGeoRouteSegment::path_data()
+{
+ QTest::addColumn<QList<double> >("coordinates");
+
+ QList<double> coordinates;
+
+ coordinates << 0.0 << 0.0;
+ QTest::newRow("path1") << coordinates;
+
+ coordinates << -23.23 << 54.45345;
+ QTest::newRow("path2") << coordinates;
+
+ coordinates << -85.4324 << -121.343;
+ QTest::newRow("path3") << coordinates;
+
+ coordinates << 1.323 << 12.323;
+ QTest::newRow("path4") << coordinates;
+
+ coordinates << 1324.323 << 143242.323;
+ QTest::newRow("path5") << coordinates;
+}
+
+void tst_QGeoRouteSegment::nextroutesegment()
+{
+ QGeoRouteSegment sgmt;
+ QVERIFY(!sgmt.isValid());
+
+ QGeoRouteSegment *qgeoroutesegmentcopy = new QGeoRouteSegment();
+ qgeoroutesegmentcopy->setDistance(45.34);
+
+ sgmt.setNextRouteSegment(*qgeoroutesegmentcopy);
+
+ QVERIFY(sgmt.isValid());
+ QCOMPARE(sgmt.nextRouteSegment(), *qgeoroutesegmentcopy);
+
+ QCOMPARE((sgmt.nextRouteSegment()).distance(),
+ qgeoroutesegmentcopy->distance());
+ delete qgeoroutesegmentcopy;
+
+}
+
+void tst_QGeoRouteSegment::maneuver()
+{
+ QGeoRouteSegment sgmt;
+ QVERIFY(!sgmt.isValid());
+
+ sgmt.setManeuver(*qgeomaneuver);
+ QCOMPARE(sgmt.maneuver(), *qgeomaneuver);
+ QVERIFY(sgmt.isValid());
+}
+
+void tst_QGeoRouteSegment::operators()
+{
+ //Create a copy and see that they are the same
+ QGeoRouteSegment *qgeoroutesegmentcopy = new QGeoRouteSegment(*qgeoroutesegment);
+ QGeoRouteSegment *trueSgmtCopy = new QGeoRouteSegment();
+
+ QVERIFY(qgeoroutesegment->operator ==(*qgeoroutesegmentcopy));
+ QVERIFY(!qgeoroutesegment->operator !=(*qgeoroutesegmentcopy));
+ QVERIFY(!qgeoroutesegment->isValid());
+ QVERIFY(!qgeoroutesegmentcopy->isValid());
+
+ //Same segment ? content is the same but pointer different
+ QVERIFY(qgeoroutesegment->operator ==(*trueSgmtCopy));
+ QVERIFY(!qgeoroutesegment->operator !=(*trueSgmtCopy));
+ QVERIFY(!trueSgmtCopy->isValid());
+
+ QFETCH(double, distance);
+ QFETCH(int, traveltime);
+ QFETCH(QList<double>, coordinates);
+
+ QList<QGeoCoordinate> path;
+
+ for (int i = 0; i < coordinates.size(); i += 2) {
+ path.append(QGeoCoordinate(coordinates.at(i), coordinates.at(i+1)));
+ }
+
+ qgeoroutesegment->setDistance(distance);
+ qgeoroutesegment->setTravelTime(traveltime);
+ qgeoroutesegment->setPath(path);
+
+ trueSgmtCopy->setDistance(distance);
+ trueSgmtCopy->setTravelTime(traveltime);
+ trueSgmtCopy->setPath(path);
+
+ QCOMPARE(qgeoroutesegment->distance(), distance);
+ QCOMPARE(qgeoroutesegment->travelTime(), traveltime);
+ QCOMPARE(qgeoroutesegment->path(), path);
+
+ QCOMPARE(qgeoroutesegmentcopy->distance(), distance);
+ QCOMPARE(qgeoroutesegmentcopy->travelTime(), traveltime);
+ QCOMPARE(qgeoroutesegmentcopy->path(), path);
+
+ QCOMPARE(trueSgmtCopy->distance(), distance);
+ QCOMPARE(trueSgmtCopy->travelTime(), traveltime);
+ QCOMPARE(trueSgmtCopy->path(), path);
+
+ //Same as based off copy constructor (d-pointer shared)
+ QVERIFY(qgeoroutesegment->operator==(*qgeoroutesegmentcopy));
+ QVERIFY(!qgeoroutesegment->operator!=(*qgeoroutesegmentcopy));
+
+ //Same as based off same content although different d-pointer
+ QVERIFY(qgeoroutesegment->operator==(*trueSgmtCopy));
+ QVERIFY(!qgeoroutesegment->operator!=(*trueSgmtCopy));
+
+ const int newTravelTime = 111;
+ trueSgmtCopy->setTravelTime(newTravelTime);
+ QCOMPARE(trueSgmtCopy->travelTime(), newTravelTime);
+
+ //different d-pointer and different content
+ QVERIFY(!qgeoroutesegment->operator==(*trueSgmtCopy));
+ QVERIFY(qgeoroutesegment->operator!=(*trueSgmtCopy));
+
+ //Assign one segment to the other and test that they are the same again
+ *qgeoroutesegmentcopy = qgeoroutesegmentcopy->operator =(*qgeoroutesegment);
+ QVERIFY(qgeoroutesegment->operator==(*qgeoroutesegmentcopy));
+ QVERIFY(!qgeoroutesegment->operator!=(*qgeoroutesegmentcopy));
+
+ *qgeoroutesegmentcopy = qgeoroutesegmentcopy->operator =(*trueSgmtCopy);
+ QVERIFY(trueSgmtCopy->operator==(*qgeoroutesegmentcopy));
+ QVERIFY(!trueSgmtCopy->operator!=(*qgeoroutesegmentcopy));
+
+ delete trueSgmtCopy;
+ delete qgeoroutesegmentcopy;
+}
+
+void tst_QGeoRouteSegment::operators_data()
+{
+ QTest::addColumn<double>("distance");
+ QTest::addColumn<int>("traveltime");
+ QTest::addColumn<QList<double> >("coordinates");
+
+ QList<double> coordinates;
+
+ coordinates << 0.0 << 0.0 << 23.234 << -121.767 << 8.43534 << 32.789;
+ QTest::newRow("set1") << 143545.43 << 45665 << coordinates;
+
+ coordinates << 42.343 << -38.657;
+ QTest::newRow("set2") << 745654.43 << 786585 << coordinates;
+}
+
+QTEST_APPLESS_MAIN(tst_QGeoRouteSegment);
diff --git a/tests/auto/qgeoroutesegment/tst_qgeoroutesegment.h b/tests/auto/qgeoroutesegment/tst_qgeoroutesegment.h
new file mode 100644
index 00000000..00d61ebc
--- /dev/null
+++ b/tests/auto/qgeoroutesegment/tst_qgeoroutesegment.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TST_QGEOROUTESEGMENT_H
+#define TST_QGEOROUTESEGMENT_H
+
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+#include <QMetaType>
+
+#include <qgeocoordinate.h>
+#include <qgeoroutesegment.h>
+#include <qgeomaneuver.h>
+
+QT_USE_NAMESPACE
+
+class tst_QGeoRouteSegment : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QGeoRouteSegment();
+
+private Q_SLOTS:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+ //Start unit test for QGeoRouteSegment
+ void constructor();
+ void copy_constructor();
+ void destructor();
+ void travelTime();
+ void travelTime_data();
+ void distance();
+ void distance_data();
+ void path();
+ void path_data();
+ void maneuver();
+ void nextroutesegment();
+ void operators();
+ void operators_data();
+ //End Unit Test for QGeoRouteSegment
+
+private:
+
+ QGeoCoordinate *qgeocoordinate;
+ QGeoRouteSegment *qgeoroutesegment;
+ QGeoManeuver *qgeomaneuver;
+
+};
+
+Q_DECLARE_METATYPE( QList<double>);
+
+#endif // TST_GEOROUTESEGMENT_H
+
diff --git a/tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro b/tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro
new file mode 100644
index 00000000..f8127b00
--- /dev/null
+++ b/tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+CONFIG+=testcase
+TARGET=tst_qgeoroutingmanager
+
+HEADERS += tst_qgeoroutingmanager.h
+
+SOURCES += tst_qgeoroutingmanager.cpp
+
+QT += location testlib
diff --git a/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.cpp b/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.cpp
new file mode 100644
index 00000000..bafd7ac3
--- /dev/null
+++ b/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.cpp
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=src/location
+
+#include "tst_qgeoroutingmanager.h"
+
+QT_USE_NAMESPACE
+
+
+void tst_QGeoRoutingManager::initTestCase()
+{
+ tst_QGeoRoutingManager::loadRoutingManager();
+}
+
+void tst_QGeoRoutingManager::cleanupTestCase()
+{
+ //delete qgeoroutingmanager;
+ delete qgeoserviceprovider;
+}
+
+void tst_QGeoRoutingManager::init()
+{
+}
+
+void tst_QGeoRoutingManager::cleanup()
+{
+}
+
+void tst_QGeoRoutingManager::loadRoutingManager()
+{
+ QStringList providers = QGeoServiceProvider::availableServiceProviders();
+ QVERIFY(providers.contains("static.georoute.test.plugin"));
+
+ qgeoserviceprovider = new QGeoServiceProvider("static.georoute.test.plugin");
+ QVERIFY(qgeoserviceprovider);
+ QCOMPARE(qgeoserviceprovider->error(), QGeoServiceProvider::NoError);
+
+ qgeoroutingmanager = qgeoserviceprovider->routingManager();
+ QVERIFY(qgeoroutingmanager);
+
+}
+
+void tst_QGeoRoutingManager::supports()
+{
+ QVERIFY(qgeoroutingmanager->supportsAlternativeRoutes());
+ QVERIFY(qgeoroutingmanager->supportsRouteUpdates());
+ QVERIFY(qgeoroutingmanager->supportsExcludeAreas());
+ QCOMPARE(qgeoroutingmanager->supportedTravelModes(),QGeoRouteRequest::PedestrianTravel);
+ QCOMPARE(qgeoroutingmanager->supportedFeatureTypes(),QGeoRouteRequest::TollFeature);
+ QCOMPARE(qgeoroutingmanager->supportedFeatureWeights(),QGeoRouteRequest::PreferFeatureWeight);
+ QCOMPARE(qgeoroutingmanager->supportedRouteOptimizations(),QGeoRouteRequest::FastestRoute);
+ QCOMPARE(qgeoroutingmanager->supportedSegmentDetails(),QGeoRouteRequest::BasicSegmentData);
+ QCOMPARE(qgeoroutingmanager->supportedManeuverDetails(),QGeoRouteRequest::BasicManeuvers);
+}
+
+void tst_QGeoRoutingManager::locale()
+{
+ QLocale *german = new QLocale(QLocale::German, QLocale::Germany);
+ QLocale *english = new QLocale(QLocale::C, QLocale::AnyCountry);
+
+ qgeoroutingmanager->setLocale(*german);
+
+ QCOMPARE(qgeoroutingmanager->locale(), *german);
+
+ QVERIFY(qgeoroutingmanager->locale() != *english);
+
+ delete german;
+ delete english;
+}
+
+void tst_QGeoRoutingManager::name()
+{
+ QString name = "static.georoute.test.plugin";
+ QCOMPARE(qgeoroutingmanager->managerName(), name);
+}
+
+void tst_QGeoRoutingManager::version()
+{
+ QCOMPARE(qgeoroutingmanager->managerVersion(), 2);
+}
+
+void tst_QGeoRoutingManager::calculate()
+{
+ QString error = "no error";
+ origin = new QGeoCoordinate(12.12 , 23.23);
+ destination = new QGeoCoordinate(34.34 , 89.32);
+ request = new QGeoRouteRequest(*origin, *destination);
+
+ reply = qgeoroutingmanager->calculateRoute(*request);
+
+ QCOMPARE(reply->error(), QGeoRouteReply::NoError);
+ QCOMPARE(reply->errorString(), error);
+
+ delete origin;
+ delete destination;
+ delete request;
+ delete reply;
+}
+
+
+void tst_QGeoRoutingManager::update()
+{
+ QString error = "no error";
+ position = new QGeoCoordinate(34.34, 89.32);
+ route = new QGeoRoute();
+
+ reply = qgeoroutingmanager->updateRoute(*route, *position);
+
+ QCOMPARE(reply->error(), QGeoRouteReply::CommunicationError);
+ QCOMPARE(reply->errorString(), error);
+
+ delete position;
+ delete route;
+ delete reply;
+}
+
+QTEST_APPLESS_MAIN(tst_QGeoRoutingManager)
+
diff --git a/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.h b/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.h
new file mode 100644
index 00000000..72215f5e
--- /dev/null
+++ b/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=src/location
+
+#ifndef TST_QGEOROUTINGMANAGER_H
+#define TST_QGEOROUTINGMANAGER_H
+
+#include <QLocale>
+#include <QtTest/QtTest>
+#include <qgeoserviceprovider.h>
+#include <qgeoroutingmanager.h>
+#include <qgeorouterequest.h>
+#include <qgeoroutereply.h>
+#include <qgeocoordinate.h>
+#include <qgeoroute.h>
+
+QT_USE_NAMESPACE
+
+class tst_QGeoRoutingManager: public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+ void supports();
+ void locale();
+ void name();
+ void version();
+ void calculate();
+ void update();
+
+private:
+ QGeoServiceProvider *qgeoserviceprovider;
+ QGeoRoutingManager *qgeoroutingmanager;
+ QGeoRouteRequest *request;
+ QGeoRouteReply *reply;
+ QGeoCoordinate *origin;
+ QGeoCoordinate *destination;
+ QGeoRoute *route;
+ QGeoCoordinate *position;
+ void loadRoutingManager();
+
+};
+
+#endif
diff --git a/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerengine_test.h b/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerengine_test.h
new file mode 100644
index 00000000..9128cebe
--- /dev/null
+++ b/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerengine_test.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOROUTINGMANAGERENGINE_TEST_H
+#define QGEOROUTINGMANAGERENGINE_TEST_H
+
+#include <qgeoserviceprovider.h>
+#include <qgeoroutingmanagerengine.h>
+#include <qgeocoordinate.h>
+#include <qgeoroutereply.h>
+#include <qgeorouterequest.h>
+
+QT_USE_NAMESPACE
+
+class QGeoRoutingManagerEngineTest: public QGeoRoutingManagerEngine
+
+{
+Q_OBJECT
+public:
+ QGeoRoutingManagerEngineTest(const QMap<QString, QVariant> &parameters,
+ QGeoServiceProvider::Error *error, QString *errorString) :
+ QGeoRoutingManagerEngine(parameters)
+ {
+ Q_UNUSED(error)
+ Q_UNUSED(errorString)
+ setSupportsRouteUpdates(true);
+ setSupportsAlternativeRoutes(true);
+ setSupportsExcludeAreas(true);
+ setSupportedTravelModes(QGeoRouteRequest::PedestrianTravel);
+ setSupportedFeatureTypes(QGeoRouteRequest::TollFeature);
+ setSupportedFeatureWeights(QGeoRouteRequest::PreferFeatureWeight);
+ setSupportedRouteOptimizations(QGeoRouteRequest::FastestRoute);
+ setSupportedSegmentDetails(QGeoRouteRequest::BasicSegmentData);
+ setSupportedManeuverDetails(QGeoRouteRequest::BasicManeuvers);
+ }
+
+ QGeoRouteReply* calculateRoute(const QGeoRouteRequest& request)
+ {
+ return new QGeoRouteReply(QGeoRouteReply::NoError,"no error");
+ }
+
+ QGeoRouteReply* updateRoute(const QGeoRoute &route, const QGeoCoordinate &position)
+ {
+ return new QGeoRouteReply(QGeoRouteReply::CommunicationError,"no error");
+
+ }
+
+
+};
+
+#endif
diff --git a/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro b/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro
new file mode 100644
index 00000000..c5a39d3e
--- /dev/null
+++ b/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro
@@ -0,0 +1,14 @@
+load(qt_plugin)
+
+TARGET = qtgeoservices_routingplugin
+QT += location
+
+DESTDIR = $$QT.location.plugins/geoservices
+
+HEADERS += qgeoroutingmanagerengine_test.h \
+ qgeoserviceproviderplugin_test.h
+
+SOURCES += qgeoserviceproviderplugin_test.cpp
+
+target.path += $$[QT_INSTALL_PLUGINS]/geoservices
+INSTALLS += target
diff --git a/tests/auto/qgeoroutingmanagerplugins/qgeoserviceproviderplugin_test.cpp b/tests/auto/qgeoroutingmanagerplugins/qgeoserviceproviderplugin_test.cpp
new file mode 100644
index 00000000..bae893e9
--- /dev/null
+++ b/tests/auto/qgeoroutingmanagerplugins/qgeoserviceproviderplugin_test.cpp
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeoserviceproviderplugin_test.h"
+#include "qgeoroutingmanagerengine_test.h"
+
+#include <QtPlugin>
+
+QGeoServiceProviderFactoryTest::QGeoServiceProviderFactoryTest()
+{
+}
+
+QGeoServiceProviderFactoryTest::~QGeoServiceProviderFactoryTest()
+{
+}
+
+QString QGeoServiceProviderFactoryTest::providerName() const
+{
+ return "static.georoute.test.plugin";
+}
+
+QStringList QGeoServiceProviderFactoryTest::keys() const
+{
+ return QStringList() << QLatin1String("static.georoute.test.plugin");
+}
+
+int QGeoServiceProviderFactoryTest::providerVersion() const
+{
+ return 2;
+}
+
+QGeoRoutingManagerEngine* QGeoServiceProviderFactoryTest::createRoutingManagerEngine(const QMap<
+ QString, QVariant> &parameters, QGeoServiceProvider::Error *error, QString *errorString) const
+{
+ return new QGeoRoutingManagerEngineTest(parameters, error, errorString);
+}
+
+Q_EXPORT_PLUGIN2(qtgeoservices_staticroutingplugin, QGeoServiceProviderFactoryTest)
diff --git a/tests/auto/qgeoroutingmanagerplugins/qgeoserviceproviderplugin_test.h b/tests/auto/qgeoroutingmanagerplugins/qgeoserviceproviderplugin_test.h
new file mode 100644
index 00000000..8ce4abdf
--- /dev/null
+++ b/tests/auto/qgeoroutingmanagerplugins/qgeoserviceproviderplugin_test.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOSERVICEPROVIDER_TEST_H
+#define QGEOSERVICEPROVIDER_TEST_H
+
+#include <qgeoserviceproviderfactory.h>
+#include <QObject>
+
+QT_USE_NAMESPACE
+
+class QGeoServiceProviderFactoryTest: public QObject, public QGeoServiceProviderFactory
+{
+ Q_OBJECT
+ Q_INTERFACES(QGeoServiceProviderFactory:QFactoryInterface)
+public:
+ QGeoServiceProviderFactoryTest();
+ ~QGeoServiceProviderFactoryTest();
+
+ QString providerName() const;
+ int providerVersion() const;
+ QStringList keys() const;
+
+ QGeoRoutingManagerEngine* createRoutingManagerEngine(const QMap<QString, QVariant> &parameters,
+ QGeoServiceProvider::Error *error, QString *errorString) const;
+
+};
+
+#endif
+
+