summaryrefslogtreecommitdiff
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/CMakeLists.txt1
-rw-r--r--tests/auto/auto.pro1
-rw-r--r--tests/auto/positionplugin/plugin.cpp40
-rw-r--r--tests/auto/positionpluginV1/CMakeLists.txt21
-rw-r--r--tests/auto/positionpluginV1/plugin.cpp212
-rw-r--r--tests/auto/positionpluginV1/plugin.json9
-rw-r--r--tests/auto/positionpluginV1/positionpluginV1.pro12
7 files changed, 9 insertions, 287 deletions
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index ab6de00f..65412e06 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -74,7 +74,6 @@ add_subdirectory(qgeosatelliteinfo)
# endif()
if(NOT ANDROID)
add_subdirectory(positionplugin)
- add_subdirectory(positionpluginV1)
add_subdirectory(positionplugintest)
add_subdirectory(qgeoareamonitor)
add_subdirectory(qgeopositioninfosource)
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index d26711c3..912b6e42 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -96,7 +96,6 @@ SUBDIRS += \
!android: SUBDIRS += \
positionplugin \
- positionpluginV1 \
positionplugintest \
qgeoareamonitor \
qgeopositioninfosource \
diff --git a/tests/auto/positionplugin/plugin.cpp b/tests/auto/positionplugin/plugin.cpp
index fd8f931d..b888a53c 100644
--- a/tests/auto/positionplugin/plugin.cpp
+++ b/tests/auto/positionplugin/plugin.cpp
@@ -211,54 +211,32 @@ void DummySource::doTimeout()
}
-class QGeoPositionInfoSourceFactoryTest : public QObject, public QGeoPositionInfoSourceFactoryV2
+class QGeoPositionInfoSourceFactoryTest : public QObject, public QGeoPositionInfoSourceFactory
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0"
+ Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/6.0"
FILE "plugin.json")
- Q_INTERFACES(QGeoPositionInfoSourceFactoryV2)
+ Q_INTERFACES(QGeoPositionInfoSourceFactory)
public:
- QGeoPositionInfoSource *positionInfoSource(QObject *parent) override;
- QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent) override;
- QGeoAreaMonitorSource *areaMonitor(QObject *parent) override;
-
- QGeoPositionInfoSource *positionInfoSourceWithParameters(QObject *parent,
- const QVariantMap &parameters) override;
- QGeoSatelliteInfoSource *satelliteInfoSourceWithParameters(QObject *parent,
- const QVariantMap &parameters) override;
- QGeoAreaMonitorSource *areaMonitorWithParameters(QObject *parent,
- const QVariantMap &parameters) override;
+ QGeoPositionInfoSource *positionInfoSource(QObject *parent, const QVariantMap &parameters) override;
+ QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent, const QVariantMap &parameters) override;
+ QGeoAreaMonitorSource *areaMonitor(QObject *parent, const QVariantMap &parameters) override;
};
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryTest::positionInfoSource(QObject *parent)
-{
- return new DummySource(QVariantMap(), parent);
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryTest::satelliteInfoSource(QObject *parent)
-{
- return satelliteInfoSourceWithParameters(parent, QVariantMap());
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryTest::areaMonitor(QObject* parent)
-{
- return areaMonitorWithParameters(parent, QVariantMap());
-}
-
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryTest::positionInfoSourceWithParameters(QObject *parent, const QVariantMap &parameters)
+QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryTest::positionInfoSource(QObject *parent, const QVariantMap &parameters)
{
return new DummySource(parameters, parent);
}
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryTest::satelliteInfoSourceWithParameters(QObject *parent, const QVariantMap &parameters)
+QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryTest::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
{
Q_UNUSED(parent);
Q_UNUSED(parameters);
return nullptr;
}
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryTest::areaMonitorWithParameters(QObject *parent, const QVariantMap &parameters)
+QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryTest::areaMonitor(QObject *parent, const QVariantMap &parameters)
{
Q_UNUSED(parent);
Q_UNUSED(parameters);
diff --git a/tests/auto/positionpluginV1/CMakeLists.txt b/tests/auto/positionpluginV1/CMakeLists.txt
deleted file mode 100644
index 95cbe5b8..00000000
--- a/tests/auto/positionpluginV1/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Generated from positionpluginV1.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryTestV1 Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QGeoPositionInfoSourceFactoryTestV1
- OUTPUT_NAME qtposition_testpluginv1
- TYPE position
- DEFAULT_IF FALSE
- SOURCES
- plugin.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:positionpluginV1.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
-# PLUGIN_EXTENDS = "-"
diff --git a/tests/auto/positionpluginV1/plugin.cpp b/tests/auto/positionpluginV1/plugin.cpp
deleted file mode 100644
index f3d0165e..00000000
--- a/tests/auto/positionpluginV1/plugin.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtPositioning/qgeopositioninfosource.h>
-#include <QtPositioning/qgeopositioninfosourcefactory.h>
-#include <QObject>
-#include <QtPlugin>
-#include <QTimer>
-
-QT_USE_NAMESPACE
-
-class DummySource : public QGeoPositionInfoSource
-{
- Q_OBJECT
-
-public:
- DummySource(QObject *parent = nullptr);
- ~DummySource();
-
- void startUpdates() override;
- void stopUpdates() override;
- void requestUpdate(int timeout = 5000) override;
-
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const override;
- PositioningMethods supportedPositioningMethods() const override;
-
- void setUpdateInterval(int msec) override;
- int minimumUpdateInterval() const override;
- Error error() const override;
-
-private:
- QTimer *timer;
- QTimer *timeoutTimer;
- QTimer *singleTimer;
- QGeoPositionInfo lastPosition;
- QDateTime lastUpdateTime;
-
-private slots:
- void updatePosition();
- void doTimeout();
-};
-
-DummySource::DummySource(QObject *parent) :
- QGeoPositionInfoSource(parent),
- timer(new QTimer(this)),
- timeoutTimer(new QTimer(this)),
- singleTimer(new QTimer(this)),
- lastPosition(QGeoCoordinate(0,0), QDateTime::currentDateTime())
-{
- timer->setInterval(1000);
- connect(timer, SIGNAL(timeout()),
- this, SLOT(updatePosition()));
- connect(singleTimer, SIGNAL(timeout()),
- this, SLOT(updatePosition()));
- connect(timeoutTimer, SIGNAL(timeout()),
- this, SLOT(doTimeout()));
-}
-
-QGeoPositionInfoSource::Error DummySource::error() const
-{
- return QGeoPositionInfoSource::NoError;
-}
-
-
-void DummySource::setUpdateInterval(int msec)
-{
- if (msec == 0) {
- timer->setInterval(1000);
- } else if (msec < 1000) {
- msec = 1000;
- timer->setInterval(msec);
- } else {
- timer->setInterval(msec);
- }
-
- QGeoPositionInfoSource::setUpdateInterval(msec);
-}
-
-int DummySource::minimumUpdateInterval() const
-{
- return 1000;
-}
-
-QGeoPositionInfo DummySource::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const
-{
- Q_UNUSED(fromSatellitePositioningMethodsOnly);
- return lastPosition;
-}
-
-QGeoPositionInfoSource::PositioningMethods DummySource::supportedPositioningMethods() const
-{
- return QGeoPositionInfoSource::AllPositioningMethods;
-}
-
-void DummySource::startUpdates()
-{
- timer->start();
-}
-
-void DummySource::stopUpdates()
-{
- timer->stop();
-}
-
-void DummySource::requestUpdate(int timeout)
-{
- if (timeout == 0)
- timeout = 5000;
- if (timeout < 0)
- timeout = 0;
-
- timeoutTimer->setInterval(timeout);
- timeoutTimer->start();
-
- if (timer->isActive()) {
- timer->stop();
- timer->start();
- }
-
- singleTimer->setInterval(1000);
- singleTimer->start();
-}
-
-DummySource::~DummySource()
-{}
-
-void DummySource::updatePosition()
-{
- timeoutTimer->stop();
- singleTimer->stop();
-
- const QDateTime now = QDateTime::currentDateTime();
-
- QGeoCoordinate coord(lastPosition.coordinate().latitude() + 0.1,
- lastPosition.coordinate().longitude() + 0.1);
-
- QGeoPositionInfo info(coord, now);
- info.setAttribute(QGeoPositionInfo::Direction, lastPosition.coordinate().azimuthTo(coord));
- if (lastUpdateTime.isValid()) {
- double speed = lastPosition.coordinate().distanceTo(coord) / lastUpdateTime.msecsTo(now);
- info.setAttribute(QGeoPositionInfo::GroundSpeed, 1000 * speed);
- }
-
- lastUpdateTime = now;
- lastPosition = info;
- emit positionUpdated(info);
-}
-
-void DummySource::doTimeout()
-{
- timeoutTimer->stop();
- singleTimer->stop();
- emit updateTimeout();
-}
-
-
-class QGeoPositionInfoSourceFactoryTestV1 : public QObject, public QGeoPositionInfoSourceFactory
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0"
- FILE "plugin.json")
- Q_INTERFACES(QGeoPositionInfoSourceFactory)
-
-public:
- QGeoPositionInfoSource *positionInfoSource(QObject *parent) override;
- QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent) override;
- QGeoAreaMonitorSource *areaMonitor(QObject *parent) override;
-};
-
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryTestV1::positionInfoSource(QObject *parent)
-{
- return new DummySource(parent);
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryTestV1::satelliteInfoSource(QObject *parent)
-{
- Q_UNUSED(parent);
- return nullptr;
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryTestV1::areaMonitor(QObject* parent)
-{
- Q_UNUSED(parent);
- return nullptr;
-}
-
-#include "plugin.moc"
diff --git a/tests/auto/positionpluginV1/plugin.json b/tests/auto/positionpluginV1/plugin.json
deleted file mode 100644
index 9acf27e7..00000000
--- a/tests/auto/positionpluginV1/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["test.source.v1"],
- "Provider": "test.source.v1",
- "Position": true,
- "Satellite": false,
- "Monitor": false,
- "Priority": 0,
- "Testable": true
-}
diff --git a/tests/auto/positionpluginV1/positionpluginV1.pro b/tests/auto/positionpluginV1/positionpluginV1.pro
deleted file mode 100644
index 925a7e29..00000000
--- a/tests/auto/positionpluginV1/positionpluginV1.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = qtposition_testpluginv1
-QT += positioning
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryTestV1
-PLUGIN_EXTENDS = -
-load(qt_plugin)
-
-SOURCES += plugin.cpp
-
-OTHER_FILES += \
- plugin.json