summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabcd <qt-info@nokia.com>2011-08-03 19:00:00 +1000
committerabcd <qt_abcd1@ovi.com>2011-08-10 05:10:18 +0200
commit4e570cc94fd10dd92ec1dbb117964d3a9748f48b (patch)
tree5538cfb4bd00c1a78f5aef018a36f40b12b59a2d
parent44e38960cfe3a999954b470e6e5e2b9a03215220 (diff)
downloadqtlocation-4e570cc94fd10dd92ec1dbb117964d3a9748f48b.tar.gz
Add placemanager unit test (skeleton)
For now we just test whether we can instantiate a placemanager from a geoserviceprovider. It is expected this unit test will be expanded in future. Change-Id: I891b927c45136442805113f0bfac17d46cda2276 Reviewed-on: http://codereview.qt.nokia.com/2549 Reviewed-by: abcd <qt_abcd1@ovi.com>
-rw-r--r--tests/auto/auto.pro1
-rw-r--r--tests/auto/geotestplugin/geotestplugin.pro3
-rw-r--r--tests/auto/geotestplugin/qgeoserviceproviderplugin_test.cpp10
-rw-r--r--tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h4
-rw-r--r--tests/auto/geotestplugin/qplacemanagerengine_test.h162
-rw-r--r--tests/auto/qplacemanager/qplacemanager.pro7
-rw-r--r--tests/auto/qplacemanager/tst_qplacemanager.cpp41
7 files changed, 226 insertions, 2 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index da8f8011..68e44d19 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -19,6 +19,7 @@ SUBDIRS += geotestplugin \
qplacebusinessfeature \
qplacecategory \
qplacedescription \
+ qplacemanager \
qplacemediaobject \
qplaceperiod \
qplacequery \
diff --git a/tests/auto/geotestplugin/geotestplugin.pro b/tests/auto/geotestplugin/geotestplugin.pro
index c46db272..e0c4dd1f 100644
--- a/tests/auto/geotestplugin/geotestplugin.pro
+++ b/tests/auto/geotestplugin/geotestplugin.pro
@@ -12,7 +12,8 @@ DESTDIR = $$QT.location.plugins/geoservices
HEADERS += qgeocodingmanagerengine_test.h \
qgeoserviceproviderplugin_test.h \
- qgeoroutingmanagerengine_test.h
+ qgeoroutingmanagerengine_test.h \
+ qplacemanagerengine_test.h
SOURCES += qgeoserviceproviderplugin_test.cpp
diff --git a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.cpp b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.cpp
index 4bf9f2c7..a354a589 100644
--- a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.cpp
+++ b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.cpp
@@ -42,6 +42,7 @@
#include "qgeoserviceproviderplugin_test.h"
#include "qgeocodingmanagerengine_test.h"
#include "qgeoroutingmanagerengine_test.h"
+#include "qplacemanagerengine_test.h"
#include <QtPlugin>
@@ -88,4 +89,13 @@ QGeoMappingManagerEngine* QGeoServiceProviderFactoryTest::createMappingManagerEn
return 0;
}
+QPlaceManagerEngine* QGeoServiceProviderFactoryTest::createPlaceManagerEngine(
+ const QMap<QString, QVariant> &parameters,
+ QGeoServiceProvider::Error *error, QString *errorString) const
+{
+ Q_UNUSED(error);
+ Q_UNUSED(errorString);
+ return new QPlaceManagerEngineTest(parameters);
+}
+
Q_EXPORT_PLUGIN2(qtgeoservices_qmltestplugin, QGeoServiceProviderFactoryTest)
diff --git a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h
index 2ebac422..e41a01e2 100644
--- a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h
+++ b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h
@@ -68,7 +68,9 @@ public:
QGeocodingManagerEngine* createGeocodingManagerEngine(
const QMap<QString, QVariant> &parameters,
QGeoServiceProvider::Error *error, QString *errorString) const;
-
+ QPlaceManagerEngine* createPlaceManagerEngine(
+ const QMap<QString, QVariant> &parameters,
+ QGeoServiceProvider::Error *error, QString *errorString) const;
};
#endif
diff --git a/tests/auto/geotestplugin/qplacemanagerengine_test.h b/tests/auto/geotestplugin/qplacemanagerengine_test.h
new file mode 100644
index 00000000..cf126516
--- /dev/null
+++ b/tests/auto/geotestplugin/qplacemanagerengine_test.h
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $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 QPLACEMANAGERENGINE_TEST_H
+#define QPLACEMANAGERENGINE_TEST_H
+
+#include <qplacemanager.h>
+#include <qplacemanagerengine.h>
+#include <qplacereply.h>
+
+QT_USE_NAMESPACE
+
+class PlaceReplyTest : public QPlaceReply
+{
+ Q_OBJECT
+public:
+ PlaceReplyTest(QObject *parent = 0)
+ : QPlaceReply(parent) {}
+
+ void abort() { emit aborted(); }
+
+Q_SIGNALS:
+ void aborted();
+};
+
+class QPlaceManagerEngineTest : public QPlaceManagerEngine
+{
+ Q_OBJECT
+public:
+ QPlaceManagerEngineTest(const QMap<QString, QVariant> &parameters)
+ : QPlaceManagerEngine(parameters)
+ {
+ }
+
+ QPlaceDetailsReply *getPlaceDetails(const QString &placeId)
+ {
+ return 0;
+ }
+
+ QPlaceMediaReply *getMedia(const QGeoPlace &place, const QPlaceQuery &query)
+ {
+ return 0;
+ }
+
+ QPlaceReply *postRating(const QString &placeId, qreal value)
+ {
+ return 0;
+ }
+
+ QPlaceReviewReply *getReviews(const QGeoPlace &place, const QPlaceQuery &query)
+ {
+ return 0;
+ }
+
+ QPlaceSearchReply *searchForPlaces(const QPlaceSearchQuery &query)
+ {
+ return 0;
+ }
+
+ QPlaceSearchReply *recommendations(const QGeoPlace &place, const QPlaceSearchQuery &query)
+ {
+ return 0;
+ }
+
+ QPlaceTextPredictionReply *textPredictions(const QPlaceSearchQuery &query)
+ {
+ return 0;
+ }
+
+ QPlaceManager::ConnectivityModes connectivityMode() const
+ {
+ return QPlaceManager::OnlineMode;
+ }
+
+ void setConnectivityMode(QPlaceManager::ConnectivityModes mode)
+ {
+ }
+
+ QPlaceManager::ConnectivityModes supportedConnectivityModes() const
+ {
+ return QPlaceManager::OnlineMode;
+ }
+
+ QPlaceReply *savePlace(QGeoPlace *place, QPlaceManager::VisibilityScope scope)
+ {
+ return 0;
+ }
+
+ QPlaceManager::VisibilityScopes supportedSaveVisibilityScopes() const
+ {
+ return QPlaceManager::PublicScope;
+ }
+
+ QPlaceReply *removePlace(const QGeoPlace &place)
+ {
+ return 0;
+ }
+
+ QPlaceReply *initializeCategories()
+ {
+ return 0;
+ }
+
+ QList<QPlaceCategory> categories() const
+ {
+ return QList<QPlaceCategory>();
+ }
+
+ QLocale locale() const
+ {
+ return QLocale(QLocale::French);
+ }
+
+ void setLocale(const QLocale &locale)
+ {
+ }
+
+ QUrl iconUrl(const QPlaceIcon &icon) const
+ {
+ return QUrl();
+ }
+};
+
+#endif
diff --git a/tests/auto/qplacemanager/qplacemanager.pro b/tests/auto/qplacemanager/qplacemanager.pro
new file mode 100644
index 00000000..76c898c4
--- /dev/null
+++ b/tests/auto/qplacemanager/qplacemanager.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+CONFIG += testcase
+TARGET = tst_qplacemanager
+
+SOURCES += tst_qplacemanager.cpp
+
+QT += location testlib
diff --git a/tests/auto/qplacemanager/tst_qplacemanager.cpp b/tests/auto/qplacemanager/tst_qplacemanager.cpp
new file mode 100644
index 00000000..e2c73486
--- /dev/null
+++ b/tests/auto/qplacemanager/tst_qplacemanager.cpp
@@ -0,0 +1,41 @@
+#include <QString>
+#include <QtTest/QtTest>
+
+#include <qgeoserviceprovider.h>
+#include <qplacemanager.h>
+
+QT_USE_NAMESPACE
+
+class tst_QPlaceManager : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QPlaceManager();
+
+private Q_SLOTS:
+ void initTestCase();
+
+private:
+ QGeoServiceProvider *provider;
+ QPlaceManager *placeManager;
+};
+
+tst_QPlaceManager::tst_QPlaceManager()
+{
+}
+
+void tst_QPlaceManager::initTestCase()
+{
+ QStringList providers = QGeoServiceProvider::availableServiceProviders();
+ providers.contains("qmlgeo.test.plugin");
+
+ provider = new QGeoServiceProvider("qmlgeo.test.plugin");
+ placeManager = provider->placeManager();
+ QVERIFY(placeManager);
+
+ QVERIFY(placeManager->connectivityMode() == QPlaceManager::OnlineMode);
+}
+
+QTEST_MAIN(tst_QPlaceManager)
+
+#include "tst_qplacemanager.moc"