summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/applications/positioning_backend/CMakeLists.txt28
-rw-r--r--tests/applications/positioning_backend/logwidget.cpp46
-rw-r--r--tests/applications/positioning_backend/logwidget.h47
-rw-r--r--tests/applications/positioning_backend/main.cpp54
-rw-r--r--tests/applications/positioning_backend/positioning_backend.pro16
-rw-r--r--tests/applications/positioning_backend/widget.cpp188
-rw-r--r--tests/applications/positioning_backend/widget.h70
-rw-r--r--tests/applications/positioning_backend/widget.ui334
-rw-r--r--tests/auto/CMakeLists.txt30
-rw-r--r--tests/auto/auto.pro26
-rw-r--r--tests/auto/declarative_geolocation/CMakeLists.txt16
-rw-r--r--tests/auto/declarative_geolocation/main.cpp48
-rw-r--r--tests/auto/declarative_geolocation/tst_declarativegeolocation.qml161
-rw-r--r--tests/auto/declarative_positioning_core/BLACKLIST6
-rw-r--r--tests/auto/declarative_positioning_core/CMakeLists.txt35
-rw-r--r--tests/auto/declarative_positioning_core/declarative_positioning_core.pro14
-rw-r--r--tests/auto/declarative_positioning_core/factory.cpp50
-rw-r--r--tests/auto/declarative_positioning_core/factory.h55
-rw-r--r--tests/auto/declarative_positioning_core/main.cpp49
-rw-r--r--tests/auto/declarative_positioning_core/tst_address.qml95
-rw-r--r--tests/auto/declarative_positioning_core/tst_coordinate.qml404
-rw-r--r--tests/auto/declarative_positioning_core/tst_geoshape.qml300
-rw-r--r--tests/auto/declarative_positioning_core/tst_position.qml52
-rw-r--r--tests/auto/declarative_positioning_core/tst_positionsource.qml445
-rw-r--r--tests/auto/doublevectors/CMakeLists.txt16
-rw-r--r--tests/auto/doublevectors/doublevectors.pro7
-rw-r--r--tests/auto/doublevectors/tst_doublevectors.cpp293
-rw-r--r--tests/auto/dummypositionplugin/CMakeLists.txt21
-rw-r--r--tests/auto/dummypositionplugin/dummypositionplugin.pro12
-rw-r--r--tests/auto/dummypositionplugin/plugin.cpp155
-rw-r--r--tests/auto/dummypositionplugin/plugin.json9
-rw-r--r--tests/auto/positionplugin/CMakeLists.txt21
-rw-r--r--tests/auto/positionplugin/plugin.cpp248
-rw-r--r--tests/auto/positionplugin/plugin.json9
-rw-r--r--tests/auto/positionplugin/positionplugin.pro12
-rw-r--r--tests/auto/positionplugintest/CMakeLists.txt16
-rw-r--r--tests/auto/positionplugintest/positionplugintest.pro9
-rw-r--r--tests/auto/positionplugintest/tst_positionplugin.cpp109
-rw-r--r--tests/auto/qdeclarativegeolocation/CMakeLists.txt9
-rw-r--r--tests/auto/qdeclarativegeolocation/tst_qdeclarativegeolocation.cpp181
-rw-r--r--tests/auto/qdeclarativeposition/CMakeLists.txt8
-rw-r--r--tests/auto/qdeclarativeposition/tst_qdeclarativeposition.cpp225
-rw-r--r--tests/auto/qdeclarativepositionsource/CMakeLists.txt9
-rw-r--r--tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp533
-rw-r--r--tests/auto/qgeoaddress/CMakeLists.txt16
-rw-r--r--tests/auto/qgeoaddress/qgeoaddress.pro7
-rw-r--r--tests/auto/qgeoaddress/tst_qgeoaddress.cpp647
-rw-r--r--tests/auto/qgeoareamonitor/CMakeLists.txt19
-rw-r--r--tests/auto/qgeoareamonitor/logfilepositionsource.cpp132
-rw-r--r--tests/auto/qgeoareamonitor/logfilepositionsource.h81
-rw-r--r--tests/auto/qgeoareamonitor/positionconsumerthread.cpp73
-rw-r--r--tests/auto/qgeoareamonitor/positionconsumerthread.h74
-rw-r--r--tests/auto/qgeoareamonitor/qgeoareamonitor.pro14
-rw-r--r--tests/auto/qgeoareamonitor/simplelog.txt87
-rw-r--r--tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp977
-rw-r--r--tests/auto/qgeocircle/CMakeLists.txt16
-rw-r--r--tests/auto/qgeocircle/qgeocircle.pro8
-rw-r--r--tests/auto/qgeocircle/tst_qgeocircle.cpp473
-rw-r--r--tests/auto/qgeocoordinate/CMakeLists.txt14
-rw-r--r--tests/auto/qgeocoordinate/qgeocoordinate.pro8
-rw-r--r--tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp1000
-rw-r--r--tests/auto/qgeocoordinateobject/CMakeLists.txt8
-rw-r--r--tests/auto/qgeocoordinateobject/tst_qgeocoordinateobject.cpp99
-rw-r--r--tests/auto/qgeolocation/CMakeLists.txt14
-rw-r--r--tests/auto/qgeolocation/qgeolocation.pro9
-rw-r--r--tests/auto/qgeolocation/tst_qgeolocation.cpp412
-rw-r--r--tests/auto/qgeolocation/tst_qgeolocation.h90
-rw-r--r--tests/auto/qgeopath/CMakeLists.txt16
-rw-r--r--tests/auto/qgeopath/qgeopath.pro8
-rw-r--r--tests/auto/qgeopath/tst_qgeopath.cpp392
-rw-r--r--tests/auto/qgeopolygon/CMakeLists.txt16
-rw-r--r--tests/auto/qgeopolygon/qgeopolygon.pro8
-rw-r--r--tests/auto/qgeopolygon/tst_qgeopolygon.cpp382
-rw-r--r--tests/auto/qgeopositioninfo/CMakeLists.txt16
-rw-r--r--tests/auto/qgeopositioninfo/qgeopositioninfo.pro7
-rw-r--r--tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp420
-rw-r--r--tests/auto/qgeopositioninfosource/CMakeLists.txt20
-rw-r--r--tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro15
-rw-r--r--tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp807
-rw-r--r--tests/auto/qgeopositioninfosource/testqgeopositioninfosource_p.h129
-rw-r--r--tests/auto/qgeopositioninfosource/tst_qgeopositioninfosource.cpp37
-rw-r--r--tests/auto/qgeorectangle/CMakeLists.txt16
-rw-r--r--tests/auto/qgeorectangle/qgeorectangle.pro8
-rw-r--r--tests/auto/qgeorectangle/tst_qgeorectangle.cpp2414
-rw-r--r--tests/auto/qgeosatelliteinfo/CMakeLists.txt16
-rw-r--r--tests/auto/qgeosatelliteinfo/qgeosatelliteinfo.pro7
-rw-r--r--tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp438
-rw-r--r--tests/auto/qgeosatelliteinfosource/CMakeLists.txt22
-rw-r--r--tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro12
-rw-r--r--tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp766
-rw-r--r--tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h117
-rw-r--r--tests/auto/qgeosatelliteinfosource/tst_qgeosatelliteinfosource.cpp37
-rw-r--r--tests/auto/qgeoshape/CMakeLists.txt14
-rw-r--r--tests/auto/qgeoshape/qgeoshape.pro5
-rw-r--r--tests/auto/qgeoshape/tst_qgeoshape.cpp243
-rw-r--r--tests/auto/qnmeapositioninfosource/CMakeLists.txt7
-rw-r--r--tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/CMakeLists.txt23
-rw-r--r--tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/dummynmeapositioninfosource.pro17
-rw-r--r--tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/tst_dummynmeapositioninfosource.cpp149
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource.pro8
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/CMakeLists.txt26
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/qnmeapositioninfosource_realtime.pro19
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/tst_qnmeapositioninfosource_realtime.cpp44
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/CMakeLists.txt27
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro22
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp77
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/CMakeLists.txt26
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/qnmeapositioninfosource_simulation.pro19
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/tst_qnmeapositioninfosource_simulation.cpp43
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/CMakeLists.txt32
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro22
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp64
-rw-r--r--tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.cpp605
-rw-r--r--tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.h182
-rw-r--r--tests/auto/qnmeasatelliteinfosource/CMakeLists.txt4
-rw-r--r--tests/auto/qnmeasatelliteinfosource/dummy/CMakeLists.txt16
-rw-r--r--tests/auto/qnmeasatelliteinfosource/dummy/tst_dummynmeasatelliteinfosource.cpp171
-rw-r--r--tests/auto/qnmeasatelliteinfosource/generic_realtime/CMakeLists.txt18
-rw-r--r--tests/auto/qnmeasatelliteinfosource/generic_realtime/tst_nmeasatelliteinfosource_generic_rt.cpp93
-rw-r--r--tests/auto/qnmeasatelliteinfosource/generic_simulation/CMakeLists.txt18
-rw-r--r--tests/auto/qnmeasatelliteinfosource/generic_simulation/tst_nmeasatelliteinfosource_generic_sim.cpp95
-rw-r--r--tests/auto/qnmeasatelliteinfosource/nmea/CMakeLists.txt14
-rw-r--r--tests/auto/qnmeasatelliteinfosource/nmea/tst_nmeasatelliteinfosource.cpp556
-rw-r--r--tests/auto/qquickgeocoordinateanimation/CMakeLists.txt9
-rw-r--r--tests/auto/qquickgeocoordinateanimation/tst_qquickgeocoordinateanimation.cpp53
-rw-r--r--tests/auto/utils/qlocationtestutils.cpp114
-rw-r--r--tests/auto/utils/qlocationtestutils_p.h175
-rw-r--r--tests/auto/utils/qnmeaproxyfactory.cpp130
-rw-r--r--tests/auto/utils/qnmeaproxyfactory.h96
-rw-r--r--tests/benchmarks/CMakeLists.txt7
-rw-r--r--tests/benchmarks/README81
-rw-r--r--tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt12
-rw-r--r--tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp255
-rw-r--r--tests/benchmarks/qgeopositioninfo/CMakeLists.txt12
-rw-r--r--tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp253
-rw-r--r--tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt12
-rw-r--r--tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp248
137 files changed, 0 insertions, 18991 deletions
diff --git a/tests/applications/positioning_backend/CMakeLists.txt b/tests/applications/positioning_backend/CMakeLists.txt
deleted file mode 100644
index 0591cf2b..00000000
--- a/tests/applications/positioning_backend/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Generated from positioning_backend.pro.
-
-#####################################################################
-## posbackendtesting Binary:
-#####################################################################
-
-qt_internal_add_executable(posbackendtesting
- GUI
- SOURCES
- logwidget.cpp logwidget.h
- main.cpp
- widget.cpp widget.h widget.ui
- PUBLIC_LIBRARIES
- Qt::Gui
- Qt::Positioning
- Qt::Widgets
- ENABLE_AUTOGEN_TOOLS
- uic
-)
-
-#### Keys ignored in scope 1:.:.:positioning_backend.pro:<TRUE>:
-# TEMPLATE = "app"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:positioning_backend.pro:WINRT:
-# WINRT_MANIFEST.capabilities_device = "location"
diff --git a/tests/applications/positioning_backend/logwidget.cpp b/tests/applications/positioning_backend/logwidget.cpp
deleted file mode 100644
index 5ec47230..00000000
--- a/tests/applications/positioning_backend/logwidget.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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 "logwidget.h"
-#include <QVBoxLayout>
-
-LogWidget::LogWidget(QWidget *parent) : QWidget(parent)
-{
- QVBoxLayout *verticalLayout = new QVBoxLayout(this);
- verticalLayout->setSpacing(6);
- verticalLayout->setContentsMargins(11, 11, 11, 11);
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
-
- editor = new QPlainTextEdit(this);
- verticalLayout->addWidget(editor);
-}
-
-void LogWidget::appendLog(const QString &line)
-{
- editor->appendPlainText(line);
-}
diff --git a/tests/applications/positioning_backend/logwidget.h b/tests/applications/positioning_backend/logwidget.h
deleted file mode 100644
index f6a3eb44..00000000
--- a/tests/applications/positioning_backend/logwidget.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#ifndef LOGWIDGET_H
-#define LOGWIDGET_H
-
-#include <QtWidgets/qwidget.h>
-#include <QtWidgets/qplaintextedit.h>
-
-class LogWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit LogWidget(QWidget *parent = nullptr);
-
- void appendLog(const QString &line);
-
-private:
- QPlainTextEdit *editor;
-};
-
-#endif // LOGWIDGET_H
diff --git a/tests/applications/positioning_backend/main.cpp b/tests/applications/positioning_backend/main.cpp
deleted file mode 100644
index 2ed69cb6..00000000
--- a/tests/applications/positioning_backend/main.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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 "widget.h"
-#include "logwidget.h"
-#include <QLabel>
-
-#include <QApplication>
-#include <QtWidgets>
-#include <QLoggingCategory>
-
-int main(int argc, char *argv[])
-{
- //QLoggingCategory::setFilterRules("qt.positioning.*=true");
- QApplication a(argc, argv);
-
- LogWidget *log = new LogWidget;
- Widget *w1 = new Widget(log);
- Widget *w2 = new Widget(log);
-
- QTabWidget tabWidget;
- tabWidget.setTabPosition(QTabWidget::South);
-
- tabWidget.addTab(w1, "Instance 1");
- tabWidget.addTab(w2, "Instance 2");
- tabWidget.addTab(log, "Logs");
-
- tabWidget.show();
- return a.exec();
-}
diff --git a/tests/applications/positioning_backend/positioning_backend.pro b/tests/applications/positioning_backend/positioning_backend.pro
deleted file mode 100644
index 4ba9e7c8..00000000
--- a/tests/applications/positioning_backend/positioning_backend.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-QT += core gui positioning widgets
-
-TARGET = posbackendtesting
-TEMPLATE = app
-
-
-SOURCES += main.cpp\
- widget.cpp \
- logwidget.cpp
-
-HEADERS += widget.h \
- logwidget.h
-
-FORMS += widget.ui
-
-winrt: WINRT_MANIFEST.capabilities_device += location
diff --git a/tests/applications/positioning_backend/widget.cpp b/tests/applications/positioning_backend/widget.cpp
deleted file mode 100644
index ea1739de..00000000
--- a/tests/applications/positioning_backend/widget.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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 "widget.h"
-#include "ui_widget.h"
-#include <QGeoPositionInfoSource>
-#include <QDebug>
-
-Widget::Widget(LogWidget *logWidget, QWidget *parent) :
- QWidget(parent),
- log(logWidget),
- ui(new Ui::Widget)
-{
- ui->setupUi(this);
- qDebug() << "Available:" << QGeoPositionInfoSource::availableSources();
- m_posSource = QGeoPositionInfoSource::createDefaultSource(this);
- if (!m_posSource)
- qFatal("No Position Source created!");
- connect(m_posSource, SIGNAL(positionUpdated(QGeoPositionInfo)),
- this, SLOT(positionUpdated(QGeoPositionInfo)));
-
- connect(ui->horizontalSlider, SIGNAL(valueChanged(int)),
- this, SLOT(setInterval(int)));
-
- ui->groupBox->setLayout(ui->gridLayout);
- ui->horizontalSlider->setMinimum(m_posSource->minimumUpdateInterval());
- ui->labelTimeOut->setVisible(false);
-
- connect(m_posSource, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)),
- this, SLOT(errorChanged(QGeoPositionInfoSource::Error)));
- connect(m_posSource, &QGeoPositionInfoSource::supportedPositioningMethodsChanged,
- this, [this]() {
- auto methods = m_posSource->supportedPositioningMethods();
- const QString status = QStringLiteral("Satellite: %1 ").arg(bool(methods & QGeoPositionInfoSource::SatellitePositioningMethods))
- + QStringLiteral("Non-Satellite: %1").arg(bool(methods & QGeoPositionInfoSource::NonSatellitePositioningMethods));
-
- qDebug() << "Available Positioning Methods Changed" << status;
- log->appendLog(status);
- });
-}
-
-void Widget::positionUpdated(QGeoPositionInfo gpsPos)
-{
- QGeoCoordinate coord = gpsPos.coordinate();
- ui->labelLatitude->setText(QString::number(coord.latitude()));
- ui->labelLongitude->setText(QString::number(coord.longitude()));
- ui->labelAltitude->setText(QString::number(coord.altitude()));
- ui->labelTimeStamp->setText(gpsPos.timestamp().toString());
- if (gpsPos.hasAttribute(QGeoPositionInfo::HorizontalAccuracy))
- ui->labelHAccuracy->setText(QString::number(gpsPos.attribute(QGeoPositionInfo::HorizontalAccuracy)));
- else
- ui->labelHAccuracy->setText(QStringLiteral("N/A"));
-
- if (gpsPos.hasAttribute(QGeoPositionInfo::VerticalAccuracy))
- ui->labelVAccuracy->setText(QString::number(gpsPos.attribute(QGeoPositionInfo::VerticalAccuracy)));
- else
- ui->labelVAccuracy->setText(QStringLiteral("N/A"));
-
- if (gpsPos.hasAttribute(QGeoPositionInfo::Direction))
- ui->labelDirection->setText(QString::number(gpsPos.attribute(QGeoPositionInfo::Direction)));
- else
- ui->labelDirection->setText(QStringLiteral("N/A"));
-
- if (gpsPos.hasAttribute(QGeoPositionInfo::GroundSpeed))
- ui->labelSpeed->setText(QString::number(gpsPos.attribute(QGeoPositionInfo::GroundSpeed)));
- else
- ui->labelSpeed->setText(QStringLiteral("N/A"));
-
- log->appendLog(coord.toString());
-}
-
-void Widget::positionTimedOut()
-{
- ui->labelTimeOut->setVisible(true);
-}
-
-void Widget::errorChanged(QGeoPositionInfoSource::Error err)
-{
- if (err == QGeoPositionInfoSource::UpdateTimeoutError) {
- // handle timeout
- positionTimedOut();
- } else {
- // handle other errors
- ui->labelErrorState->setText(QString::number(err));
- m_posSource->stopUpdates();
- ui->checkBox->setChecked(false);
- }
-}
-
-Widget::~Widget()
-{
- delete ui;
-}
-
-void Widget::setInterval(int msec)
-{
- m_posSource->setUpdateInterval(msec);
-}
-
-void Widget::on_buttonRetrieve_clicked()
-{
- // Requesting current position for _one_ time
- m_posSource->requestUpdate(10000);
-}
-
-void Widget::on_buttonStart_clicked()
-{
- // Either start or stop the current position info source
- bool running = ui->checkBox->isChecked();
- if (running) {
- ui->checkBox->setChecked(false);
- m_posSource->stopUpdates();
- } else {
- ui->checkBox->setChecked(true);
- m_posSource->startUpdates();
- }
-}
-
-void Widget::on_radioButton_clicked()
-{
- m_posSource->setPreferredPositioningMethods(QGeoPositionInfoSource::NoPositioningMethods);
-}
-
-void Widget::on_radioButton_2_clicked()
-{
- m_posSource->setPreferredPositioningMethods(QGeoPositionInfoSource::SatellitePositioningMethods);
-}
-
-void Widget::on_radioButton_3_clicked()
-{
- m_posSource->setPreferredPositioningMethods(QGeoPositionInfoSource::NonSatellitePositioningMethods);
-}
-
-void Widget::on_radioButton_4_clicked()
-{
- m_posSource->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods);
-}
-
-void Widget::on_buttonUpdateSupported_clicked()
-{
- QGeoPositionInfoSource::PositioningMethods m = m_posSource->supportedPositioningMethods();
- QString text;
- switch (m) {
- case QGeoPositionInfoSource::NoPositioningMethods:
- text = QStringLiteral("None");
- break;
- case QGeoPositionInfoSource::SatellitePositioningMethods:
- text = QStringLiteral("Satellite");
- break;
- case QGeoPositionInfoSource::NonSatellitePositioningMethods:
- text = QStringLiteral("Non Satellite");
- break;
- case QGeoPositionInfoSource::AllPositioningMethods:
- text = QStringLiteral("All");
- break;
- }
-
- ui->labelSupported->setText(text);
-}
-
-void Widget::on_buttonResetError_clicked()
-{
- ui->labelErrorState->setText(QStringLiteral("N/A"));
-}
diff --git a/tests/applications/positioning_backend/widget.h b/tests/applications/positioning_backend/widget.h
deleted file mode 100644
index e0dc68fc..00000000
--- a/tests/applications/positioning_backend/widget.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-#ifndef WIDGET_H
-#define WIDGET_H
-
-#include "logwidget.h"
-
-#include <QWidget>
-#include <QGeoPositionInfoSource>
-
-namespace Ui {
- class Widget;
-}
-
-class Widget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit Widget(LogWidget *log, QWidget *parent = nullptr);
- ~Widget();
-
-public slots:
- void positionUpdated(QGeoPositionInfo gpsPos);
- void setInterval(int msec);
- void positionTimedOut();
- void errorChanged(QGeoPositionInfoSource::Error err);
-private slots:
- void on_buttonRetrieve_clicked();
- void on_buttonStart_clicked();
- void on_radioButton_2_clicked();
- void on_radioButton_clicked();
- void on_radioButton_3_clicked();
- void on_radioButton_4_clicked();
-
- void on_buttonUpdateSupported_clicked();
- void on_buttonResetError_clicked();
-
-private:
- LogWidget *log = nullptr;
- Ui::Widget *ui;
- QGeoPositionInfoSource *m_posSource;
-};
-
-#endif // WIDGET_H
diff --git a/tests/applications/positioning_backend/widget.ui b/tests/applications/positioning_backend/widget.ui
deleted file mode 100644
index 9cb1566d..00000000
--- a/tests/applications/positioning_backend/widget.ui
+++ /dev/null
@@ -1,334 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Widget</class>
- <widget class="QWidget" name="Widget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>276</width>
- <height>467</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Widget</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Latitude:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="labelLatitude">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Longitude:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="labelLongitude">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Altitude:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="labelAltitude">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>TimeStamp:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QLabel" name="labelTimeStamp">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Horizontal Accuracy:</string>
- </property>
- </widget>
- </item>
- <item row="7" column="1">
- <widget class="QLabel" name="labelHAccuracy">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="8" column="0">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Vertical Accuracy:</string>
- </property>
- </widget>
- </item>
- <item row="8" column="1">
- <widget class="QLabel" name="labelVAccuracy">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="9" column="0">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>TimeOut:</string>
- </property>
- </widget>
- </item>
- <item row="9" column="1">
- <widget class="QLabel" name="labelTimeOut">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>!!!!!TimeOut!!!!!</string>
- </property>
- </widget>
- </item>
- <item row="10" column="0">
- <widget class="QLabel" name="label_10">
- <property name="text">
- <string>Supported Methods:</string>
- </property>
- </widget>
- </item>
- <item row="11" column="0">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Error State:</string>
- </property>
- </widget>
- </item>
- <item row="11" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QLabel" name="labelErrorState">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonResetError">
- <property name="text">
- <string>Reset</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="10" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="labelSupported">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonUpdateSupported">
- <property name="text">
- <string>Update</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_11">
- <property name="text">
- <string>Direction:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLabel" name="labelDirection">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_12">
- <property name="text">
- <string>Speed:</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QLabel" name="labelSpeed">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Method</string>
- </property>
- <widget class="QWidget" name="layoutWidget">
- <property name="geometry">
- <rect>
- <x>43</x>
- <y>21</y>
- <width>254</width>
- <height>71</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QRadioButton" name="radioButton">
- <property name="text">
- <string>None</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QRadioButton" name="radioButton_2">
- <property name="text">
- <string>Satelite</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QRadioButton" name="radioButton_3">
- <property name="text">
- <string>Non-Satelite</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QRadioButton" name="radioButton_4">
- <property name="text">
- <string>All</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Interval:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSlider" name="horizontalSlider">
- <property name="minimum">
- <number>50</number>
- </property>
- <property name="maximum">
- <number>10000</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelInterval">
- <property name="text">
- <string>0</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QCheckBox" name="checkBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Running</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QPushButton" name="buttonStart">
- <property name="text">
- <string>Start/Stop</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonRetrieve">
- <property name="text">
- <string>Retrieve</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <resources/>
- <connections>
- <connection>
- <sender>horizontalSlider</sender>
- <signal>valueChanged(int)</signal>
- <receiver>labelInterval</receiver>
- <slot>setNum(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>217</x>
- <y>137</y>
- </hint>
- <hint type="destinationlabel">
- <x>386</x>
- <y>138</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index 9fd84dd9..742afe97 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -1,17 +1,5 @@
# Generated from auto.pro.
-add_subdirectory(doublevectors)
-add_subdirectory(qgeoaddress)
-add_subdirectory(qgeoshape)
-add_subdirectory(qgeorectangle)
-add_subdirectory(qgeocircle)
-add_subdirectory(qgeopath)
-add_subdirectory(qgeopolygon)
-add_subdirectory(qgeocoordinate)
-add_subdirectory(qgeocoordinateobject)
-add_subdirectory(qgeolocation)
-add_subdirectory(qgeopositioninfo)
-add_subdirectory(qgeosatelliteinfo)
# TODO: enable location tests later!
# if(TARGET Qt::Location)
# add_subdirectory(geotestplugin)
@@ -73,21 +61,3 @@ add_subdirectory(qgeosatelliteinfo)
# if(TARGET Qt::Location AND TARGET Qt::Quick AND NOT ANDROID AND NOT APPLE)
# add_subdirectory(declarative_ui)
# endif()
-if(TARGET Qt::Quick AND NOT ANDROID)
- add_subdirectory(dummypositionplugin)
- add_subdirectory(declarative_positioning_core)
- add_subdirectory(declarative_geolocation)
- add_subdirectory(qdeclarativegeolocation)
- add_subdirectory(qdeclarativeposition)
- add_subdirectory(qdeclarativepositionsource)
- add_subdirectory(qquickgeocoordinateanimation)
-endif()
-if(NOT ANDROID)
- add_subdirectory(positionplugin)
- add_subdirectory(positionplugintest)
- add_subdirectory(qgeoareamonitor)
- add_subdirectory(qgeopositioninfosource)
- add_subdirectory(qgeosatelliteinfosource)
- add_subdirectory(qnmeapositioninfosource)
- add_subdirectory(qnmeasatelliteinfosource)
-endif()
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 789c769d..034a1c75 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -80,29 +80,3 @@ qtHaveModule(location) {
}
}
}
-
-qtHaveModule(quick):!android {
- SUBDIRS += declarative_positioning_core \
- dummypositionplugin
-}
-
-SUBDIRS += \
- doublevectors \
- qgeoaddress \
- qgeoshape \
- qgeorectangle \
- qgeocircle \
- qgeopath \
- qgeopolygon \
- qgeocoordinate \
- qgeolocation \
- qgeopositioninfo \
- qgeosatelliteinfo
-
-!android: SUBDIRS += \
- positionplugin \
- positionplugintest \
- qgeoareamonitor \
- qgeopositioninfosource \
- qgeosatelliteinfosource \
- qnmeapositioninfosource
diff --git a/tests/auto/declarative_geolocation/CMakeLists.txt b/tests/auto/declarative_geolocation/CMakeLists.txt
deleted file mode 100644
index 366884c4..00000000
--- a/tests/auto/declarative_geolocation/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# special case begin
-
-# Collect test data
-
-qt_internal_add_test(tst_declarative_geolocation
- QMLTEST
- SOURCES
- main.cpp
- PUBLIC_LIBRARIES
- Qt::Positioning
- Qt::Quick
- TESTDATA
- tst_declarativegeolocation.qml
-)
-
-# special case end
diff --git a/tests/auto/declarative_geolocation/main.cpp b/tests/auto/declarative_geolocation/main.cpp
deleted file mode 100644
index 86521a45..00000000
--- a/tests/auto/declarative_geolocation/main.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QtCore/QCoreApplication>
-#include <QtQuickTest/quicktest.h>
-
-static void initializeLibraryPath()
-{
-#if QT_CONFIG(library)
- // Set custom path since CI doesn't install test plugins
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../plugins"));
-#endif
-#endif
-}
-
-Q_COREAPP_STARTUP_FUNCTION(initializeLibraryPath)
-
-QUICK_TEST_MAIN(declarative_geolocation)
diff --git a/tests/auto/declarative_geolocation/tst_declarativegeolocation.qml b/tests/auto/declarative_geolocation/tst_declarativegeolocation.qml
deleted file mode 100644
index 47596304..00000000
--- a/tests/auto/declarative_geolocation/tst_declarativegeolocation.qml
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtPositioning 6.2
-
-Item {
- id: testCase
-
- property var topLeft: QtPositioning.coordinate(1.0, 2.0)
- property var bottomRight: QtPositioning.coordinate(2.0, 1.0)
- property var centerPoint: QtPositioning.coordinate(1.5, 1.5)
-
- Location {
- id: defaultConstructed
- }
-
- Location {
- id: location
- }
-
- // Use property bindings insetead of signal spies
- property var addressObserver: location.address
- property int addressChangedCount: 0
- onAddressObserverChanged: {
- ++addressChangedCount
- }
-
- property var coordObserver: location.coordinate
- property int coordChangedCount: 0
- onCoordObserverChanged: {
- ++coordChangedCount
- }
-
- property var shapeObserver: location.boundingShape
- property int shapeChangedCount: 0
- onShapeObserverChanged: {
- ++shapeChangedCount
- }
-
- property var attrsObserver: location.extendedAttributes
- property int attrsChangedCount: 0
- onAttrsObserverChanged: {
- ++attrsChangedCount
- }
-
- Address {
- id: emptyAddress
- }
-
- Address {
- id: addr1
- country: "Germany"
- city: "Berlin"
- street: "Erich-Thilo-Str"
- streetNumber: "10"
- postalCode: "12489"
- }
-
- Location {
- id: completeLocation
- address: addr1
- coordinate: centerPoint
- boundingShape: QtPositioning.rectangle(topLeft, bottomRight)
- }
-
- Location {
- id: fromGeoLocation
- }
-
- TestCase {
- name: "DeclarativeGeoLocation"
-
- function test_default_construction() {
- compare(defaultConstructed.address.address, emptyAddress.address)
- compare(defaultConstructed.coordinate, QtPositioning.coordinate())
- compare(defaultConstructed.boundingShape, QtPositioning.shape())
- }
-
- function test_address_changed() {
- addressChangedCount = 0
- location.address = addr1
- compare(addressChangedCount, 1)
- compare(location.address.address, addr1.address)
- }
-
- function test_coordinate_changed() {
- var coord1 = QtPositioning.coordinate(1.0, 2.0)
- var emptyCoord = QtPositioning.coordinate()
- coordChangedCount = 0
- compare(location.coordinate, emptyCoord)
- location.coordinate = coord1
- compare(coordChangedCount, 1)
- compare(location.coordinate, coord1)
- }
-
- function test_bounding_box_changed() {
- var emptyShape = QtPositioning.shape()
- shapeChangedCount = 0
- compare(location.boundingShape, emptyShape)
-
- var box = QtPositioning.rectangle(topLeft, bottomRight)
- location.boundingShape = box
- compare(shapeChangedCount, 1)
- compare(QtPositioning.shapeToRectangle(location.boundingShape), box)
- // verify that shape's boundingGeoRectangle() matches the box.
- compare(location.boundingShape.boundingGeoRectangle(), box)
-
- var circle = QtPositioning.circle(centerPoint, 100)
- location.boundingShape = circle
- compare(shapeChangedCount, 2)
- compare(QtPositioning.shapeToCircle(location.boundingShape), circle)
- }
-
- function test_from_geolocation() {
- fromGeoLocation.location = completeLocation.location
- compare(fromGeoLocation.location, completeLocation.location)
- compare(fromGeoLocation.address.address, completeLocation.address.address)
- compare(fromGeoLocation.coordinate, completeLocation.coordinate)
- compare(fromGeoLocation.boundingShape, completeLocation.boundingShape)
- }
-
- function test_extended_attributes() {
- attrsChangedCount = 0
-
- var attributes = { "foo" : 42 }
- location.extendedAttributes = attributes;
- compare(location.extendedAttributes, attributes)
- compare(attrsChangedCount, 1)
-
- attributes["bar"] = 41
- verify(location.extendedAttributes !== attributes)
- }
- }
-}
diff --git a/tests/auto/declarative_positioning_core/BLACKLIST b/tests/auto/declarative_positioning_core/BLACKLIST
deleted file mode 100644
index f8752ac4..00000000
--- a/tests/auto/declarative_positioning_core/BLACKLIST
+++ /dev/null
@@ -1,6 +0,0 @@
-# QTBUG-59074 and QTBUG-93761: flaky test
-[CoordinateAnimation::test_west_direction_coordinate_animation]
-osx arm
-# QTBUG-59074 and QTBUG-93761: flaky test
-[CoordinateAnimation::test_east_direction_coordinate_animation]
-osx arm
diff --git a/tests/auto/declarative_positioning_core/CMakeLists.txt b/tests/auto/declarative_positioning_core/CMakeLists.txt
deleted file mode 100644
index 0afb3021..00000000
--- a/tests/auto/declarative_positioning_core/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Generated from declarative_positioning_core.pro.
-
-#####################################################################
-## tst_declarative_positioning_core Test:
-#####################################################################
-
-# Collect test data
-file(GLOB_RECURSE test_data_glob
- RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
- *.qml)
-list(APPEND test_data ${test_data_glob})
-
-qt_internal_add_test(tst_declarative_positioning_core
- QMLTEST
- SOURCES
- main.cpp
- factory.cpp
- factory.h
- PUBLIC_LIBRARIES
- Qt::Positioning
- Qt::Quick
- TESTDATA ${test_data}
-)
-
-qt_add_qml_module(tst_declarative_positioning_core
- URI TestFactory
- VERSION 1.0
- QML_FILES
- tst_address.qml
- tst_coordinate.qml
- tst_geoshape.qml
- tst_position.qml
- tst_positionsource.qml
- NO_RESOURCE_TARGET_PATH
-)
diff --git a/tests/auto/declarative_positioning_core/declarative_positioning_core.pro b/tests/auto/declarative_positioning_core/declarative_positioning_core.pro
deleted file mode 100644
index fbf82de0..00000000
--- a/tests/auto/declarative_positioning_core/declarative_positioning_core.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-# QML tests in this directory must not depend on an OpenGL context.
-# QML tests that do require an OpenGL context must go in ../../declarative_ui.
-
-TEMPLATE = app
-TARGET = tst_declarative_positioning_core
-CONFIG += qmltestcase
-SOURCES += main.cpp
-
-CONFIG -= app_bundle
-
-QT += positioning quick
-
-OTHER_FILES = *.qml
-TESTDATA = $$OTHER_FILES
diff --git a/tests/auto/declarative_positioning_core/factory.cpp b/tests/auto/declarative_positioning_core/factory.cpp
deleted file mode 100644
index 92a242c3..00000000
--- a/tests/auto/declarative_positioning_core/factory.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 "factory.h"
-#include <QGeoRectangle>
-#include <QGeoCircle>
-
-QT_BEGIN_NAMESPACE
-
-Factory::Factory(QObject *parent) : QObject(parent)
-{
-
-}
-
-QGeoShape Factory::createShape(const QGeoCoordinate &topLeft, const QGeoCoordinate &bottomRight)
-{
- return QGeoRectangle(topLeft, bottomRight);
-}
-
-QGeoShape Factory::createShape(const QGeoCoordinate &center, qreal radius) const
-{
- return QGeoCircle(center, radius);
-}
-
-QT_END_NAMESPACE
diff --git a/tests/auto/declarative_positioning_core/factory.h b/tests/auto/declarative_positioning_core/factory.h
deleted file mode 100644
index 9fcfef53..00000000
--- a/tests/auto/declarative_positioning_core/factory.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
-#ifndef FACTORY_H
-#define FACTORY_H
-
-#include <QObject>
-#include <QGeoShape>
-#include <QGeoCoordinate>
-#include <qqml.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoShape;
-class QGeoCoordinate;
-
-class Factory : public QObject
-{
- Q_OBJECT
- QML_ELEMENT
-
-public:
- explicit Factory(QObject *parent = nullptr);
-
- Q_INVOKABLE QGeoShape createShape(const QGeoCoordinate &topLeft, const QGeoCoordinate &bottomRight);
- Q_INVOKABLE QGeoShape createShape(const QGeoCoordinate &center, qreal radius) const;
-};
-
-QT_END_NAMESPACE
-
-#endif // FACTORY_H
diff --git a/tests/auto/declarative_positioning_core/main.cpp b/tests/auto/declarative_positioning_core/main.cpp
deleted file mode 100644
index d7cfb648..00000000
--- a/tests/auto/declarative_positioning_core/main.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QtCore/QCoreApplication>
-#include <QtQuickTest/quicktest.h>
-#include <QtQml/qqml.h>
-
-static void initializeLibraryPath()
-{
-#if QT_CONFIG(library)
- // Set custom path since CI doesn't install test plugins
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../plugins"));
-#endif
-#endif
-}
-
-Q_COREAPP_STARTUP_FUNCTION(initializeLibraryPath)
-
-QUICK_TEST_MAIN(declarative_positioning_core)
diff --git a/tests/auto/declarative_positioning_core/tst_address.qml b/tests/auto/declarative_positioning_core/tst_address.qml
deleted file mode 100644
index bfbe1a63..00000000
--- a/tests/auto/declarative_positioning_core/tst_address.qml
+++ /dev/null
@@ -1,95 +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$
-**
-****************************************************************************/
-
-import QtTest 1.0
-import QtPositioning 6.2
-
-TestCase {
- id: testCase
-
- name: "Address"
-
- Address {
- id: address
-
- street: "Evergreen Tce"
- streetNumber: "742"
- district: "Pressboard Estates"
- city: "Springfield"
- state: "Oregon"
- postalCode: "8900"
- country: "United States"
- countryCode: "USA"
- }
-
- function test_qmlAddressText() {
- compare(address.isTextGenerated, true);
- compare(address.text, "742 Evergreen Tce<br/>Springfield, Oregon 8900<br/>United States");
- var textChangedSpy = Qt.createQmlObject('import QtTest 1.0; SignalSpy {}', testCase, "SignalSpy");
- textChangedSpy.target = address;
- textChangedSpy.signalName = "textChanged"
-
- var isTextGeneratedSpy = Qt.createQmlObject('import QtTest 1.0; SignalSpy {}', testCase, "SignalSpy");
- isTextGeneratedSpy.target = address
- isTextGeneratedSpy.signalName = "isTextGeneratedChanged"
-
- address.countryCode = "FRA";
- compare(address.text, "742 Evergreen Tce<br/>8900 Springfield<br/>United States");
- compare(textChangedSpy.count, 1);
- textChangedSpy.clear();
- compare(isTextGeneratedSpy.count, 0);
-
- address.countryCode = "DEU"; // the street number should go after the street name
- compare(address.text, "Evergreen Tce 742<br/>8900 Springfield<br/>United States");
- compare(textChangedSpy.count, 1);
- textChangedSpy.clear();
- compare(isTextGeneratedSpy.count, 0);
-
- address.text = "address label";
- compare(address.isTextGenerated, false);
- compare(address.text, "address label");
- compare(textChangedSpy.count, 1);
- textChangedSpy.clear();
- compare(isTextGeneratedSpy.count, 1);
- isTextGeneratedSpy.clear();
-
- address.countryCode = "USA";
- compare(address.text, "address label");
- compare(textChangedSpy.count, 0);
- textChangedSpy.clear();
- compare(isTextGeneratedSpy.count, 0);
-
- address.text = "";
- compare(address.isTextGenerated, true);
- compare(address.text, "742 Evergreen Tce<br/>Springfield, Oregon 8900<br/>United States");
- compare(textChangedSpy.count, 1);
- textChangedSpy.clear();
- compare(isTextGeneratedSpy.count, 1);
- isTextGeneratedSpy.clear();
- }
-}
diff --git a/tests/auto/declarative_positioning_core/tst_coordinate.qml b/tests/auto/declarative_positioning_core/tst_coordinate.qml
deleted file mode 100644
index eb5a2573..00000000
--- a/tests/auto/declarative_positioning_core/tst_coordinate.qml
+++ /dev/null
@@ -1,404 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtPositioning 6.2
-
-Item {
- id: item
-
- property var empty: QtPositioning.coordinate()
- property var base: QtPositioning.coordinate(1.0, 1.0, 5.0)
- property var zero: QtPositioning.coordinate(0, 0)
- property var plusone: QtPositioning.coordinate(0, 1)
- property var minusone: QtPositioning.coordinate(0, -1)
- property var north: QtPositioning.coordinate(3, 0)
-
- SignalSpy { id: coordSpy; target: item; signalName: "baseChanged" }
-
- property var inside: QtPositioning.coordinate(0.5, 0.5)
- property var outside: QtPositioning.coordinate(2, 2)
- property var tl: QtPositioning.coordinate(1, 0)
- property var br: QtPositioning.coordinate(0, 1)
- property var box: QtPositioning.rectangle(tl, br)
-
-
- Address {
- id: validTestAddress
- street: "Brandl St"
- streetNumber: "53"
- city: "Eight Mile Plains"
- country: "Australia"
- countryCode: "AUS"
- }
-
- Location {
- id: testLocation
- coordinate: inside
- boundingShape: box
- address: validTestAddress
- }
-
- Location {
- id: invalidLocation
- }
-
-
- Item {
- id: coordinateItem
- property variant coordinate
- property int animationDuration: 100
- property var coordinateList: []
- property int coordinateCount: 0
-
- CoordinateAnimation {
- id: coordinateAnimation
- target: coordinateItem
- property: "coordinate"
- duration: coordinateItem.animationDuration
- }
- onCoordinateChanged: {
- if (!coordinateList) {
- coordinateList = []
- }
- coordinateList[coordinateCount] = QtPositioning.coordinate(coordinate.latitude,coordinate.longitude)
- coordinateCount++
- }
-
- SignalSpy { id: coordinateAnimationStartSpy; target: coordinateAnimation; signalName: "started" }
- SignalSpy { id: coordinateAnimationStopSpy; target: coordinateAnimation; signalName: "stopped" }
- SignalSpy { id: coordinateAnimationDirectionSpy; target: coordinateAnimation; signalName: "directionChanged" }
- }
-
- TestCase {
- name: "GeoLocation"
-
- function test_Location_complete()
- {
- compare (testLocation.coordinate.longitude, inside.longitude)
- compare (testLocation.coordinate.latitude, inside.latitude)
-
- compare (testLocation.boundingShape.contains(inside), true)
- compare (testLocation.boundingShape.contains(outside), false)
- var shapeRectangle = testLocation.boundingShape.boundingGeoRectangle()
- compare (shapeRectangle.bottomRight.longitude, br.longitude)
- compare (shapeRectangle.bottomRight.latitude, br.latitude)
- compare (shapeRectangle.topLeft.longitude, tl.longitude)
- compare (shapeRectangle.topLeft.latitude, tl.latitude)
-
- compare (testLocation.address.country, "Australia")
- compare (testLocation.address.countryCode, "AUS")
- compare (testLocation.address.city, "Eight Mile Plains")
- compare (testLocation.address.street, "Brandl St")
- compare (testLocation.address.streetNumber, "53")
- }
-
- function test_Location_invalid()
- {
- compare(invalidLocation.coordinate.isValid, false)
- compare(invalidLocation.boundingShape.isEmpty, true)
- compare(invalidLocation.boundingShape.isValid, false)
- compare(invalidLocation.address.city, "")
- }
- }
-
- TestCase {
- name: "Coordinate"
-
- function test_validity()
- {
- compare(empty.isValid, false)
-
- empty.longitude = 0.0;
- empty.latitude = 0.0;
-
- compare(empty.isValid, true)
- }
-
- function test_accessors()
- {
- compare(base.longitude, 1.0)
- compare(base.latitude, 1.0)
- compare(base.altitude, 5.0)
-
- coordSpy.clear()
-
- base.longitude = 2.0
- base.latitude = 3.0
- base.altitude = 6.0
-
- compare(base.longitude, 2.0)
- compare(base.latitude, 3.0)
- compare(base.altitude, 6.0)
- // changing individual properties does *not* trigger
- // change notification
- compare(coordSpy.count, 0)
-
- // updating the whole object *does* trigger change notification
- base = QtPositioning.coordinate(3.0, 4.0, 5.0)
- compare(base.latitude, 3.0)
- compare(base.longitude, 4.0)
- compare(base.altitude, 5.0)
- compare(coordSpy.count, 1)
- }
-
- function test_comparison_data()
- {
- return [
- { tag: "empty", coord1: empty, coord2: QtPositioning.coordinate(), result: true },
- { tag: "zero", coord1: zero, coord2: QtPositioning.coordinate(0, 0), result: true },
- { tag: "plusone", coord1: plusone, coord2: QtPositioning.coordinate(0, 1), result: true },
- { tag: "minusone", coord1: minusone, coord2: QtPositioning.coordinate(0, -1), result: true },
- { tag: "north", coord1: north, coord2: QtPositioning.coordinate(3, 0), result: true },
- { tag: "lat,long.alt", coord1: QtPositioning.coordinate(1.1, 2.2, 3.3), coord2: QtPositioning.coordinate(1.1, 2.2, 3.3), result: true },
- { tag: "not equal1", coord1: plusone, coord2: minusone, result: false },
- { tag: "not equal2", coord1: plusone, coord2: north, result: false }
- ]
- }
-
- function test_comparison(data)
- {
- compare(data.coord1 === data.coord2, data.result)
- compare(data.coord1 !== data.coord2, !data.result)
- compare(data.coord1 == data.coord2, data.result)
- compare(data.coord1 != data.coord2, !data.result)
- }
-
- function test_distance()
- {
- compare(zero.distanceTo(plusone), zero.distanceTo(minusone))
- compare(2*plusone.distanceTo(zero), plusone.distanceTo(minusone))
- compare(zero.distanceTo(plusone) > 0, true)
- }
-
- function test_azimuth()
- {
- compare(zero.azimuthTo(north), 0)
- compare(zero.azimuthTo(plusone), 90)
- compare(zero.azimuthTo(minusone), 270)
- compare(minusone.azimuthTo(plusone), 360 - plusone.azimuthTo(minusone))
- }
-
- function test_atDistanceAndAzimuth()
- {
- // 112km is approximately one degree of arc
-
- var coord_0d = zero.atDistanceAndAzimuth(112000, 0)
- compare(coord_0d.latitude > 0.95, true)
- compare(coord_0d.latitude < 1.05, true)
- compare(coord_0d.longitude < 0.05, true)
- compare(coord_0d.longitude > -0.05, true)
- compare(zero.distanceTo(coord_0d), 112000)
- compare(zero.azimuthTo(coord_0d), 0)
-
- var coord_90d = zero.atDistanceAndAzimuth(112000, 90)
- compare(coord_90d.longitude > 0.95, true)
- compare(coord_90d.longitude < 1.05, true)
- compare(coord_90d.latitude < 0.05, true)
- compare(coord_90d.latitude > -0.05, true)
- compare(zero.distanceTo(coord_90d), 112000)
- compare(zero.azimuthTo(coord_90d), 90)
-
- var coord_30d = zero.atDistanceAndAzimuth(20000, 30)
- compare(coord_30d.longitude > 0, true)
- compare(coord_30d.latitude > 0, true)
- compare(zero.distanceTo(coord_30d), 20000)
- compare(zero.azimuthTo(coord_30d), 30)
-
- var coord_30d2 = coord_30d.atDistanceAndAzimuth(200, 30)
- compare(zero.distanceTo(coord_30d2), 20200)
- }
- }
-
- TestCase {
- name: "CoordinateAnimation"
-
- function init()
- {
- coordinateAnimation.stop()
- coordinateAnimationStartSpy.clear()
- coordinateAnimationStopSpy.clear()
- coordinateAnimationDirectionSpy.clear()
- coordinateAnimation.from = QtPositioning.coordinate(50,50)
- coordinateAnimation.to = QtPositioning.coordinate(50,50)
- coordinateAnimation.direction = CoordinateAnimation.Shortest
- coordinateItem.coordinate = QtPositioning.coordinate(50,50)
- coordinateItem.coordinateList = []
- coordinateItem.coordinateCount = 0
- }
-
- function initTestCase()
- {
- compare(coordinateAnimation.direction, CoordinateAnimation.Shortest)
- compare(coordinateAnimationDirectionSpy.count,0)
- coordinateAnimation.direction = CoordinateAnimation.Shortest
- compare(coordinateAnimationDirectionSpy.count,0)
- coordinateAnimation.direction = CoordinateAnimation.West
- compare(coordinateAnimationDirectionSpy.count,1)
- coordinateAnimation.direction = CoordinateAnimation.East
- compare(coordinateAnimationDirectionSpy.count,2)
- }
-
- function toMercator(coord)
- {
- var p = QtPositioning.coordToMercator(coord)
- var lat = p.y
- var lon = p.x
- return {'latitude': lat, 'longitude': lon};
- }
-
- function coordinate_animation(from, to, movingEast)
- {
- var fromMerc = toMercator(from)
- var toMerc = toMercator(to)
- var delta = (toMerc.latitude - fromMerc.latitude) / (toMerc.longitude - fromMerc.longitude)
-
- compare(coordinateItem.coordinateList.length, 0);
- coordinateAnimation.from = from
- coordinateAnimation.to = to
- coordinateAnimation.start()
- tryCompare(coordinateAnimationStartSpy,"count",1)
- tryCompare(coordinateAnimationStopSpy,"count",1)
-
- //check correct start position
- verify(coordinateItem.coordinateList.length != 0)
- compare(coordinateItem.coordinateList[0], from)
- //check correct end position
- compare(coordinateItem.coordinateList[coordinateItem.coordinateList.length - 1],to)
-
- var i
- var lastLongitude
- for (i in coordinateItem.coordinateList) {
- var coordinate = coordinateItem.coordinateList[i]
- var mercCoordinate = toMercator(coordinate)
-
- //check that coordinates from the animation is along a straight line between from and to
- var estimatedLatitude = fromMerc.latitude + (mercCoordinate.longitude - fromMerc.longitude) * delta
- verify(mercCoordinate.latitude - estimatedLatitude < 0.00000000001);
-
- //check that each step has moved in the right direction
-
- if (lastLongitude) {
- var errorMessage = "movingEast: " + movingEast + "; From: " + from + "; To: " + to + "; i: " + i + "; crdList: " + coordinateItem.coordinateList
- if (movingEast) {
- if (coordinate.longitude < 0 && lastLongitude > 0)
- verify(coordinate.longitude + 360 > lastLongitude, errorMessage)
- else
- verify(coordinate.longitude > lastLongitude, errorMessage)
- } else {
- if (coordinate.longitude > 0 && lastLongitude < 0)
- verify(coordinate.longitude < lastLongitude + 360, errorMessage)
- else
- verify(coordinate.longitude < lastLongitude, errorMessage)
- }
- }
- lastLongitude = coordinate.longitude
- }
- }
-
- function test_default_coordinate_animation(data)
- {
- //shortest
- coordinate_animation(data.from, data.to, data.east)
- }
-
- function test_default_coordinate_animation_data()
- {
- return [
- {
- from: QtPositioning.coordinate(58.0, 12.0),
- to: QtPositioning.coordinate(62.0, 24.0),
- east: true
- },
- {
- from: QtPositioning.coordinate(58.0, 24.0),
- to: QtPositioning.coordinate(42.0, 12.0),
- east: false
- },
- // cross 0
- {
- from: QtPositioning.coordinate(30, 10),
- to: QtPositioning.coordinate(20, -10),
- east: false
- },
- {
- from: QtPositioning.coordinate(30, -20),
- to: QtPositioning.coordinate(20, 10),
- east: true
- },
- // cross 180
- {
- from: QtPositioning.coordinate(30, 170),
- to: QtPositioning.coordinate(30, -170),
- east: true
- },
- {
- from: QtPositioning.coordinate(30, -170),
- to: QtPositioning.coordinate(30, 170),
- east: false
- },
- ]
- }
-
- function test_east_direction_coordinate_animation(data)
- {
- coordinateAnimation.direction = CoordinateAnimation.East
- coordinate_animation(data.from,
- data.to,
- true)
- }
-
- function test_east_direction_coordinate_animation_data()
- {
- return [
- { from: QtPositioning.coordinate(58.0,24.0), to: QtPositioning.coordinate(58.0,12.0) },
- { from: QtPositioning.coordinate(58.0,12.0), to: QtPositioning.coordinate(58.0,24.0) },
- ]
- }
-
-
- function test_west_direction_coordinate_animation(data)
- {
- coordinateAnimation.direction = CoordinateAnimation.West
- coordinate_animation(data.from,
- data.to,
- false)
- }
-
- function test_west_direction_coordinate_animation_data()
- {
- return [
- { from: QtPositioning.coordinate(58.0,24.0),to: QtPositioning.coordinate(58.0,12.0) },
- { from: QtPositioning.coordinate(58.0,12.0),to: QtPositioning.coordinate(58.0,24.0) },
- ]
- }
-
-
- }
-}
diff --git a/tests/auto/declarative_positioning_core/tst_geoshape.qml b/tests/auto/declarative_positioning_core/tst_geoshape.qml
deleted file mode 100644
index 6429fb26..00000000
--- a/tests/auto/declarative_positioning_core/tst_geoshape.qml
+++ /dev/null
@@ -1,300 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtPositioning 5.2
-import TestFactory 1.0
-
-Item {
- id: testCase
-
- property var coordinate1: QtPositioning.coordinate(1, 1)
- property var coordinate2: QtPositioning.coordinate(2, 2)
- property var coordinate3: QtPositioning.coordinate(80, 80)
-
- property var emptyCircle: QtPositioning.circle()
- property var circle1: QtPositioning.circle(coordinate1, 200000)
-
- SignalSpy { id: circleChangedSpy; target: testCase; signalName: "emptyCircleChanged" }
-
- TestCase {
- name: "Bounding circle"
- function test_circle_defaults_and_setters() {
- circleChangedSpy.clear();
- compare (emptyCircle.radius, -1)
- compare (circle1.radius, 200000)
-
- emptyCircle.radius = 200
- compare(emptyCircle.radius, 200)
-
- emptyCircle.center = coordinate1
- compare(emptyCircle.center, coordinate1)
-
- emptyCircle.center = coordinate2
- compare(emptyCircle.center, coordinate2)
-
- emptyCircle = QtPositioning.circle(coordinate1, 200000)
- compare(emptyCircle.center, coordinate1)
- compare(emptyCircle.radius, 200000)
- // signal is triggered only when we update the whole object
- compare(circleChangedSpy.count, 1)
-
- compare(emptyCircle.contains(coordinate1), true);
- compare(emptyCircle.contains(coordinate2), true);
- compare(emptyCircle.contains(coordinate3), false);
- }
- }
-
- property var trace1 : [ QtPositioning.coordinate(43.773175, 11.255386),
- QtPositioning.coordinate(43.773546 , 11.255372) ]
- property var trace2 : [ QtPositioning.coordinate(43.773175, 11.255386),
- QtPositioning.coordinate(43.773546 , 11.255372),
- QtPositioning.coordinate(43.77453 , 11.255734) ]
-
-
- // coordinate unit square
- property var bl: QtPositioning.coordinate(0, 0)
- property var tl: QtPositioning.coordinate(1, 0)
- property var tr: QtPositioning.coordinate(1, 1)
- property var br: QtPositioning.coordinate(0, 1)
- property var ntr: QtPositioning.coordinate(3, 3)
-
- property var invalid: QtPositioning.coordinate(100, 190)
- property var inside: QtPositioning.coordinate(0.5, 0.5)
- property var outside: QtPositioning.coordinate(2, 2)
-
- property var box: QtPositioning.rectangle(tl, br)
-
- property var coordinates: [bl, tl, tr, br]
- property var coordinates2: [bl, tl, tr, br, ntr]
- property var coordinates3: [tr]
- property var coordinates4: [invalid]
- property var coordinates5: []
-
- property var listBox: QtPositioning.rectangle(coordinates)
- property var listBox2: QtPositioning.rectangle(coordinates2)
- property var listBox3: QtPositioning.rectangle(coordinates3)
- property var listBox4: QtPositioning.rectangle(coordinates4)
- property var listBox5: QtPositioning.rectangle(coordinates5)
-
- property var widthBox: QtPositioning.rectangle(inside, 1, 1);
-
- // C++ auto test exists for basics of bounding box, testing here
- // only added functionality
- TestCase {
- name: "Bounding box"
- function test_box_defaults_and_setters() {
- compare (box.bottomRight.longitude, br.longitude) // sanity
- compare (box.contains(bl), true)
- compare (box.contains(inside), true)
- compare (box.contains(outside), false)
- box.topRight = ntr
- compare (box.contains(outside), true)
-
- compare (listBox.isValid, true)
- compare (listBox.contains(outside), false)
- compare (listBox2.contains(outside), true)
- compare (listBox3.isValid, true)
- compare (listBox3.isEmpty, true)
- compare (listBox4.isValid, false)
- compare (listBox5.isValid, false)
-
- compare (widthBox.contains(inside), true)
- compare (widthBox.contains(outside), false)
- }
- }
-
- TestCase {
- name: "Shape"
-
- function test_shape_comparison_data() {
- return [
- { tag: "invalid shape", shape1: QtPositioning.shape(), shape2: QtPositioning.shape(), result: true },
- { tag: "box equal", shape1: box, shape2: QtPositioning.rectangle(tl, br), result: true },
- { tag: "box not equal", shape1: box, shape2: QtPositioning.rectangle([inside, outside]), result: false },
- { tag: "box invalid shape", rect1: box, shape2: QtPositioning.shape(), result: false },
- { tag: "invalid rectangle", shape1: QtPositioning.rectangle(), shape2: QtPositioning.rectangle(), result: true },
- { tag: "invalid rectangle2", shape1: QtPositioning.rectangle(), shape2: QtPositioning.shape(), result: false },
- { tag: "circle1 equal", shape1: circle1, shape2: QtPositioning.circle(coordinate1, 200000), result: true },
- { tag: "circle1 not equal", shape1: circle1, shape2: QtPositioning.circle(coordinate2, 2000), result: false },
- { tag: "circle1 invalid shape", shape1: circle1, shape2: QtPositioning.shape(), result: false },
- { tag: "invalid circle", shape1: QtPositioning.circle(), shape2: QtPositioning.circle(), result: true },
- { tag: "invalid circle2", shape1: QtPositioning.circle(), shape2: QtPositioning.shape(), result: false }
- ]
- }
-
- function test_shape_comparison(data) {
- compare(data.shape1 === data.shape2, data.result)
- compare(data.shape1 !== data.shape2, !data.result)
- compare(data.shape1 == data.shape2, data.result)
- compare(data.shape1 != data.shape2, !data.result)
- }
- }
-
- TestCase {
- name: "Conversions"
-
- function test_shape_circle_conversions() {
- var circle = QtPositioning.shapeToCircle(QtPositioning.shape())
- verify(!circle.isValid)
- circle = QtPositioning.shapeToCircle(QtPositioning.circle())
- verify(!circle.isValid)
- circle = QtPositioning.shapeToCircle(QtPositioning.circle(tl, 10000))
- verify(circle.isValid)
- compare(circle.center, tl)
- compare(circle.radius, 10000)
- circle = QtPositioning.shapeToCircle(QtPositioning.rectangle())
- verify(!circle.isValid)
- circle = QtPositioning.shapeToCircle(QtPositioning.rectangle(tl, br))
- verify(!circle.isValid)
- circle = QtPositioning.shapeToCircle(listBox)
- verify(!circle.isValid)
- }
-
- function test_shape_rectangle_conversions() {
- var rectangle = QtPositioning.shapeToRectangle(QtPositioning.shape())
- verify(!rectangle.isValid)
- rectangle = QtPositioning.shapeToRectangle(QtPositioning.circle())
- verify(!rectangle.isValid)
- rectangle = QtPositioning.shapeToRectangle(QtPositioning.circle(tl, 10000))
- verify(!rectangle.isValid)
- rectangle = QtPositioning.shapeToRectangle(QtPositioning.rectangle())
- verify(!rectangle.isValid)
- rectangle = QtPositioning.shapeToRectangle(QtPositioning.rectangle(tl, br))
- verify(rectangle.isValid)
- compare(rectangle.topLeft, tl)
- compare(rectangle.bottomRight, br)
- rectangle = QtPositioning.shapeToRectangle(listBox)
- verify(rectangle.isValid)
- }
-
- function test_shape_path_conversions() {
- var path = QtPositioning.shapeToPath(QtPositioning.shape())
- verify(!path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.circle())
- verify(!path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.circle(tl, 10000))
- verify(!path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.rectangle())
- verify(!path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.rectangle(tl, br))
- verify(!path.isValid)
-
- path = QtPositioning.shapeToPath(QtPositioning.path())
- verify(!path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.path(trace1, 1))
- verify(path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.path(trace2, 2))
- verify(path.isValid)
- verify(path !== QtPositioning.shapeToPath(QtPositioning.path(trace1, 1)))
- compare(path, QtPositioning.shapeToPath(QtPositioning.path(trace2, 2)))
- }
-
- function test_shape_polygon_conversions() {
- var polygon = QtPositioning.shapeToPolygon(QtPositioning.shape())
- verify(!polygon.isValid)
- polygon = QtPositioning.shapeToPolygon(QtPositioning.circle())
- verify(!polygon.isValid)
- polygon = QtPositioning.shapeToPolygon(QtPositioning.circle(tl, 10000))
- verify(polygon.isValid) // fixed, polygon copy constructor can now initialize from a circle.
- polygon = QtPositioning.shapeToPolygon(QtPositioning.rectangle())
- verify(!polygon.isValid)
- polygon = QtPositioning.shapeToPolygon(QtPositioning.rectangle(tl, br))
- verify(polygon.isValid) // fixed, polygon copy constructor can now initialize from a rectangle.
-
- polygon = QtPositioning.shapeToPolygon(QtPositioning.polygon())
- verify(!polygon.isValid)
- polygon = QtPositioning.shapeToPolygon(QtPositioning.polygon(trace1))
- verify(!polygon.isValid) // polygon needs 3 coords at least
- polygon = QtPositioning.shapeToPolygon(QtPositioning.polygon(trace2))
- verify(polygon.isValid)
- verify(polygon !== QtPositioning.shapeToPolygon(QtPositioning.polygon(trace1)))
- compare(polygon, QtPositioning.shapeToPolygon(QtPositioning.polygon(trace2)))
- }
- }
-
- TestCase {
- name: "GeoPath path"
- function test_qgeopath_path_operations() {
- var geopath = QtPositioning.path()
-
- geopath.path = trace2
- compare(geopath.path.length, trace2.length)
-
- geopath.path = trace2
- geopath.path[0].longitude = 11.0
- compare(geopath.path.length, trace2.length)
- compare(geopath.coordinateAt(0).latitude, trace2[0].latitude)
- expectFail("", "Longitude comparison fails")
- compare(geopath.coordinateAt(0).longitude, 11)
- }
- }
-
- TestCase {
- name: "GeoPolygon path"
- function test_qgeopolygon_path_operations() {
- var geopolygon = QtPositioning.polygon()
-
- geopolygon.perimeter = trace2
- compare(geopolygon.perimeter.length, trace2.length)
-
- geopolygon.perimeter = trace2
- compare(geopolygon.perimeter.length, trace2.length)
- compare(geopolygon.coordinateAt(0).latitude, trace2[0].latitude)
- compare(geopolygon.coordinateAt(0).longitude, trace2[0].longitude)
- }
- }
-
- Factory {
- id: factory
- }
-
- TestCase {
- name: "GeoShape factory"
- function test_geoshape_factory_construction() {
- // Both createShape() methods return QGeoShape. We check that
- // invokable methods and properties are called for correct
- // objects
- var c0 = QtPositioning.coordinate(1.0, 1.0)
- var c1 = QtPositioning.coordinate(1.0001, 1.0001)
- var c2 = QtPositioning.coordinate(0.5, 0.5)
- var circle = factory.createShape(c0, 100.0)
- verify(circle.contains(c1))
- verify(!circle.contains(c2))
- compare(circle.center, c0)
-
- var rectangle = factory.createShape(QtPositioning.coordinate(1.0, 0.0), QtPositioning.coordinate(0.0, 1.0))
- verify(rectangle.contains(c2))
- verify(!rectangle.contains(c1))
- compare(rectangle.center, c2)
-
- verify(rectangle.center !== circle.center)
- }
- }
-}
diff --git a/tests/auto/declarative_positioning_core/tst_position.qml b/tests/auto/declarative_positioning_core/tst_position.qml
deleted file mode 100644
index 77e6b90c..00000000
--- a/tests/auto/declarative_positioning_core/tst_position.qml
+++ /dev/null
@@ -1,52 +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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtPositioning 5.3
-
-TestCase {
- id: testCase
-
- name: "Position"
-
- Position { id: defaultPosition }
-
- function test_defaults() {
- compare(defaultPosition.latitudeValid, false);
- compare(defaultPosition.longitudeValid, false);
- compare(defaultPosition.altitudeValid, false);
- compare(defaultPosition.speedValid, false);
- compare(defaultPosition.horizontalAccuracyValid, false);
- compare(defaultPosition.verticalAccuracyValid, false);
- verify(!defaultPosition.directionValid);
- verify(isNaN(defaultPosition.direction));
- verify(!defaultPosition.verticalSpeedValid);
- verify(isNaN(defaultPosition.verticalSpeed));
- }
-}
diff --git a/tests/auto/declarative_positioning_core/tst_positionsource.qml b/tests/auto/declarative_positioning_core/tst_positionsource.qml
deleted file mode 100644
index 74233fcd..00000000
--- a/tests/auto/declarative_positioning_core/tst_positionsource.qml
+++ /dev/null
@@ -1,445 +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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtPositioning 5.14
-
-TestCase {
- id: testCase
-
- name: "PositionSource"
-
- PositionSource { id: defaultSource }
- PositionSource
- {
- id: activeDefaultSource
- active: true
- }
-
- SignalSpy { id: defaultSourceSpy; target: defaultSource; signalName: "positionChanged" }
-
- function test_activeDefaultSource() {
- wait(0);
- verify(activeDefaultSource.name !== "");
- compare(activeDefaultSource.active, true);
- }
-
- function test_invalidSource() {
- activeDefaultSource.name = "invalid_positioning_source";
- verify(!activeDefaultSource.active);
- verify(!activeDefaultSource.valid);
- }
-
- function test_defaults() {
- // at least the test.source plugin should be available
- verify(defaultSource.name != "");
- compare(defaultSource.active, false);
- }
-
- function test_inactive() {
- defaultSourceSpy.clear();
- compare(defaultSourceSpy.count, 0);
- wait(1000);
- compare(defaultSourceSpy.count, 0);
- }
-
- PositionSource { id: testSetSource; name: "nonexistent bogus plugin" }
- SignalSpy { id: testingSourcePluginSpy; target: testSetSource; signalName: "nameChanged" }
-
- function test_setplugin() {
- testingSourcePluginSpy.clear();
-
- // On construction, if the provided source name is invalid, the default source will be
- // used. Test that the source is valid as expected.
- verify(testSetSource.name !== "");
- //we don't really know what the default source is named.
- //It may not be "test.source"
- var defaultSourceName = testSetSource.name;
- verify(testSetSource.valid);
-
- // Test that setting name to "" will still use the default.
- testSetSource.name = "";
- compare(testingSourcePluginSpy.count, 0);
- compare(testSetSource.name, defaultSourceName);
- verify(testSetSource.valid);
-
- testSetSource.name = "test.source";
- if (defaultSourceName === "test.source")
- compare(testingSourcePluginSpy.count, 0);
- compare(testSetSource.name, "test.source");
- verify(testSetSource.valid);
- testingSourcePluginSpy.clear();
-
- testSetSource.name = "bogus";
- compare(testingSourcePluginSpy.count, 1);
- verify(!testSetSource.valid);
- }
-
- PositionSource { id: testingSource; name: "test.source"; updateInterval: 1000 }
-
- PositionSource {
- id: testingSourceWParams
- name: "test.source"
- updateInterval: 200
- PluginParameter {
- id: altitudeParameter
- name: "test.source.altitude"
- value: 42.42
- }
- }
-
- // use property bindings instead of SignalSpy
- property bool directionWParamsValid: testingSourceWParams.position.directionValid
- property int directionWParamsValidChangedCount: 0
- onDirectionWParamsValidChanged: {
- ++directionWParamsValidChangedCount
- }
-
- property real directionWParams: testingSourceWParams.position.direction
- property int directionWParamsChangedCount: 0
- onDirectionWParamsChanged: {
- ++directionWParamsChangedCount
- }
-
- SignalSpy { id: updateSpyWParams; target: testingSourceWParams; signalName: "positionChanged" }
-
- PositionSource { id: testingSourceV1; name: "test.source"; updateInterval: 200 }
-
- // use property bindings instead of SignalSpy
- property bool directionV1Valid: testingSourceV1.position.directionValid
- property int directionV1ValidChangedCount: 0
- onDirectionV1ValidChanged: {
- ++directionV1ValidChangedCount
- }
-
- property real directionV1: testingSourceV1.position.direction
- property int directionV1ChangedCount: 0
- onDirectionV1Changed: {
- ++directionV1ChangedCount
- }
-
- SignalSpy { id: updateSpyV1; target: testingSourceV1; signalName: "positionChanged" }
-
- function test_updateInterval() {
- testingSource.updateInterval = 200;
- compare(testingSource.updateInterval, 200);
- testingSource.updateInterval = 300;
- compare(testingSource.updateInterval, 300);
- testingSource.updateInterval = 100;
- compare(testingSource.updateInterval, 200);
- }
-
- function test_preferredPositioningMethods() {
- testingSource.preferredPositioningMethods = PositionSource.AllPositioningMethods;
- compare(testingSource.preferredPositioningMethods, PositionSource.AllPositioningMethods);
- testingSource.preferredPositioningMethods = PositionSource.SatellitePositioningMethods;
- compare(testingSource.preferredPositioningMethods, PositionSource.SatellitePositioningMethods);
- testingSource.preferredPositioningMethods = PositionSource.NonSatellitePositioningMethods;
- compare(testingSource.preferredPositioningMethods, PositionSource.NonSatellitePositioningMethods);
- }
-
- function test_updates() {
- updateSpyV1.clear();
-
- directionV1ChangedCount = 0
- directionV1ValidChangedCount = 0
-
- testingSourceV1.active = true;
-
- tryCompare(updateSpyV1, "count", 1, 300);
- compare(testingSourceV1.position.coordinate.longitude, 0.1);
- compare(testingSourceV1.position.coordinate.latitude, 0.1);
- compare(directionV1ValidChangedCount, 1)
- compare(directionV1ChangedCount, 1)
- fuzzyCompare(testingSourceV1.position.direction, 45, 0.1)
- verify(!testingSourceV1.position.speedValid)
- verify(isNaN(testingSourceV1.position.speed))
-
- tryCompare(updateSpyV1, "count", 2, 300);
- compare(testingSourceV1.position.coordinate.longitude, 0.2);
- compare(testingSourceV1.position.coordinate.latitude, 0.2);
- compare(directionV1ValidChangedCount, 1)
- compare(directionV1ChangedCount, 2)
- fuzzyCompare(testingSourceV1.position.direction, 45, 0.1)
- verify(testingSourceV1.position.speedValid)
- verify(testingSourceV1.position.speed > 10000)
-
- testingSourceV1.active = false;
- wait(300);
- compare(updateSpyV1.count, 2);
- compare(testingSourceV1.position.coordinate.longitude, 0.2);
- compare(testingSourceV1.position.coordinate.latitude, 0.2);
- compare(directionV1ValidChangedCount, 1)
- compare(directionV1ChangedCount, 2)
- fuzzyCompare(testingSourceV1.position.direction, 45, 0.1)
- verify(testingSourceV1.position.speedValid)
- verify(testingSourceV1.position.speed > 10000)
- }
-
- function test_updates_w_params() {
- updateSpyWParams.clear();
-
- directionWParamsChangedCount = 0
- directionWParamsValidChangedCount = 0
- compare(testingSourceWParams.backendProperty("altitude"), altitudeParameter.value)
- testingSourceWParams.active = true;
-
- tryCompare(updateSpyWParams, "count", 1, 300);
- compare(testingSourceWParams.position.coordinate.longitude, 0.1);
- compare(testingSourceWParams.position.coordinate.latitude, 0.1);
- compare(testingSourceWParams.position.coordinate.altitude, altitudeParameter.value);
- compare(directionWParamsValidChangedCount, 1)
- compare(directionWParamsChangedCount, 1)
- fuzzyCompare(testingSourceWParams.position.direction, 45, 0.1)
- verify(!testingSourceWParams.position.speedValid)
- verify(isNaN(testingSourceWParams.position.speed))
- testingSourceWParams.setBackendProperty("altitude", 24.24)
-
- tryCompare(updateSpyWParams, "count", 2, 300);
- compare(testingSourceWParams.position.coordinate.longitude, 0.2);
- compare(testingSourceWParams.position.coordinate.latitude, 0.2);
- compare(testingSourceWParams.position.coordinate.altitude, 24.24);
- compare(directionWParamsValidChangedCount, 1)
- compare(directionWParamsChangedCount, 2)
- fuzzyCompare(testingSourceWParams.position.direction, 45, 0.1)
- verify(testingSourceWParams.position.speedValid)
- verify(testingSourceWParams.position.speed > 10000)
- compare(testingSourceWParams.backendProperty("altitude"), 24.24)
-
- testingSourceWParams.active = false;
- wait(300);
- compare(updateSpyWParams.count, 2);
- compare(testingSourceWParams.position.coordinate.longitude, 0.2);
- compare(testingSourceWParams.position.coordinate.latitude, 0.2);
- compare(testingSourceWParams.position.coordinate.altitude, 24.24);
- compare(directionWParamsValidChangedCount, 1)
- compare(directionWParamsChangedCount, 2)
- fuzzyCompare(testingSourceWParams.position.direction, 45, 0.1)
- verify(testingSourceWParams.position.speedValid)
- verify(testingSourceWParams.position.speed > 10000)
- }
-
- // tests for bindings
- PositionSource {
- id: testSourceForBindings
- name: "test.source"
- }
-
- property var positionObserver: testSourceForBindings.position
- SignalSpy {
- id: positionObserverSpy; target: testSourceForBindings; signalName: "positionChanged"
- }
-
- property bool activeObserver: testSourceForBindings.active
- SignalSpy {
- id: activeObserverSpy; target: testSourceForBindings; signalName: "activeChanged"
- }
-
- property bool validObserver: testSourceForBindings.valid
- SignalSpy {
- id: validObserverSpy; target: testSourceForBindings; signalName: "validityChanged"
- }
-
- property int updateIntervalObserver: testSourceForBindings.updateInterval
- SignalSpy {
- id: updateIntervalObserverSpy; target: testSourceForBindings; signalName: "updateIntervalChanged"
- }
-
- property int supportedMethodsObserver: testSourceForBindings.supportedPositioningMethods
- SignalSpy {
- id: supportedMethodsObserverSpy; target: testSourceForBindings; signalName: "supportedPositioningMethodsChanged"
- }
-
- property int preferredMethodsObserver: testSourceForBindings.preferredPositioningMethods
- SignalSpy {
- id: preferredMethodsObserverSpy;
- target: testSourceForBindings;
- signalName: "preferredPositioningMethodsChanged"
- }
-
- property int errorObserver: testSourceForBindings.sourceError
- SignalSpy {
- id: errorObserverSpy; target: testSourceForBindings; signalName: "sourceErrorChanged"
- }
-
- property string nameObserver: testSourceForBindings.name
- SignalSpy {
- id: nameObserverSpy; target: testSourceForBindings; signalName: "nameChanged"
- }
-
- function test_bindingsToPositionSource() {
- positionObserverSpy.clear()
- activeObserverSpy.clear()
- validObserverSpy.clear()
- updateIntervalObserverSpy.clear()
- supportedMethodsObserverSpy.clear()
- preferredMethodsObserverSpy.clear()
- errorObserverSpy.clear()
- nameObserverSpy.clear()
-
- verify(testSourceForBindings.valid)
- compare(testSourceForBindings.supportedPositioningMethods, PositionSource.AllPositioningMethods)
-
- testSourceForBindings.preferredPositioningMethods = PositionSource.SatellitePositioningMethods
- compare(preferredMethodsObserver, PositionSource.SatellitePositioningMethods)
- compare(preferredMethodsObserverSpy.count, 1)
-
- testSourceForBindings.updateInterval = 210;
- compare(updateIntervalObserver, 210)
- compare(updateIntervalObserverSpy.count, 1)
-
- testSourceForBindings.start();
- compare(activeObserver, true)
- compare(activeObserverSpy.count, 1)
-
- tryCompare(positionObserverSpy, "count", 1, 300);
- verify(testSourceForBindings.position.coordinate !== QtPositioning.coordinate())
-
- testSourceForBindings.update(50) // small timeout will result in an error
- tryCompare(errorObserverSpy, "count", 1, 200)
- compare(errorObserver, PositionSource.UpdateTimeoutError)
-
- var newSourceName = "some invalid name"
- testSourceForBindings.name = newSourceName
-
- compare(validObserver, false)
- compare(validObserverSpy.count, 1)
-
- compare(nameObserver, newSourceName)
- compare(nameObserverSpy.count, 1)
-
- compare(supportedMethodsObserver, PositionSource.NoPositioningMethods)
- compare(supportedMethodsObserverSpy.count, 1)
- }
-
- property bool activeSetter: false
- property string nameSetter: "test.source"
- property int updateIntervalSetter: 200
- property int preferredMethodsSetter: PositionSource.NonSatellitePositioningMethods
-
- PositionSource {
- id: sourceWithBindings
- name: nameSetter
- active: activeSetter
- updateInterval: updateIntervalSetter
- preferredPositioningMethods: preferredMethodsSetter
- }
-
- function test_bindPositionSourceProperties() {
- compare(sourceWithBindings.name, "test.source")
- compare(sourceWithBindings.active, false)
- compare(sourceWithBindings.updateInterval, 200)
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.NonSatellitePositioningMethods)
-
- updateIntervalSetter = 210;
- preferredMethodsSetter = PositionSource.AllPositioningMethods
- activeSetter = true
-
- wait(0) // to trigger event processing
-
- compare(sourceWithBindings.active, true)
- compare(sourceWithBindings.updateInterval, 210)
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.AllPositioningMethods)
-
- activeSetter = false;
-
- compare(sourceWithBindings.active, false)
-
- // check how call to update() effects the binding
- sourceWithBindings.update(updateIntervalSetter)
- compare(sourceWithBindings.active, true)
-
- wait(300)
- compare(sourceWithBindings.active, false)
-
- activeSetter = true;
- wait(0) // to trigger event processing
- // the binding is *not* broken by calling update()
- compare(sourceWithBindings.active, true)
- }
-
- function test_updateIntervalBindings() {
- var updateIntervalSpy = Qt.createQmlObject('import QtTest; SignalSpy { }', testCase)
- updateIntervalSpy.target = sourceWithBindings
- updateIntervalSpy.signalName = "updateIntervalChanged"
- verify(updateIntervalSpy.valid)
-
- nameSetter = "invalid name"
- updateIntervalSetter = 100;
- compare(sourceWithBindings.updateInterval, 100)
- compare(updateIntervalSpy.count, 1)
-
- nameSetter = "test.source"
- // "test.source" has a minimum update interval of 200
- compare(sourceWithBindings.updateInterval, 200)
- compare(updateIntervalSpy.count, 2)
-
- nameSetter = "dummy.source"
- // "dummy.source" has a minimum udpate interval of 100, so we expect
- // the updateInterval to be set to 100
- compare(sourceWithBindings.updateInterval, 100)
- compare(updateIntervalSpy.count, 3)
-
- // The binding still works
- updateIntervalSetter = 110
- compare(sourceWithBindings.updateInterval, 110)
- compare(updateIntervalSpy.count, 4)
- }
-
- function test_preferredPositioningMethodsBindings() {
- var preferredMethodsSpy = Qt.createQmlObject('import QtTest; SignalSpy { }', testCase)
- preferredMethodsSpy.target = sourceWithBindings
- preferredMethodsSpy.signalName = "preferredPositioningMethodsChanged"
- verify(preferredMethodsSpy.valid)
-
- nameSetter = "invalid name"
- preferredMethodsSetter = PositionSource.SatellitePositioningMethods
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.SatellitePositioningMethods)
- compare(preferredMethodsSpy.count, 1)
-
- nameSetter = "dummy.source"
- // "dummy.source" has only NonSatellitePositioningMethods, so we expect
- // the value to be set to NonSatellitePositioningMethods (see
- // QGeoPositionInfoSource::setPreferredPositioningMethods for details)
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.NonSatellitePositioningMethods)
- compare(preferredMethodsSpy.count, 2)
-
- nameSetter = "test.source"
- // "test.source" has all positioning methods, so we expect the value to
- // be set to the desired SatellitePositioningMethods
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.SatellitePositioningMethods)
- compare(preferredMethodsSpy.count, 3)
-
- // The binding still works
- preferredMethodsSetter = PositionSource.AllPositioningMethods
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.AllPositioningMethods)
- compare(preferredMethodsSpy.count, 4)
- }
-
-}
diff --git a/tests/auto/doublevectors/CMakeLists.txt b/tests/auto/doublevectors/CMakeLists.txt
deleted file mode 100644
index 99aeef47..00000000
--- a/tests/auto/doublevectors/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from doublevectors.pro.
-
-#####################################################################
-## tst_doublevectors Test:
-#####################################################################
-
-qt_internal_add_test(tst_doublevectors
- SOURCES
- tst_doublevectors.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::PositioningPrivate
-)
-
-#### Keys ignored in scope 1:.:.:doublevectors.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/doublevectors/doublevectors.pro b/tests/auto/doublevectors/doublevectors.pro
deleted file mode 100644
index 841a19e2..00000000
--- a/tests/auto/doublevectors/doublevectors.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_doublevectors
-
-SOURCES += tst_doublevectors.cpp
-
-QT += positioning-private testlib
diff --git a/tests/auto/doublevectors/tst_doublevectors.cpp b/tests/auto/doublevectors/tst_doublevectors.cpp
deleted file mode 100644
index ae1b2ba9..00000000
--- a/tests/auto/doublevectors/tst_doublevectors.cpp
+++ /dev/null
@@ -1,293 +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 <QtCore/QString>
-#include <QtTest/QtTest>
-
-#include <QtPositioning/private/qdoublevector2d_p.h>
-#include <QtPositioning/private/qdoublevector3d_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_doubleVectors : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- // 2D
- void constructor2dTest();
- void basicFunctions2dTest();
- void unaryOperator2dTest();
- void binaryOperator2dTest();
-
- // 3D
- void constructor3dTest();
- void basicFunctions3dTest();
- void unaryOperator3dTest();
- void binaryOperator3dTest();
-};
-
-// DoubleVector2D
-
-void tst_doubleVectors::constructor2dTest()
-{
- // empty constructor, since it sets to 0, we should check, in case people rely on it
- QDoubleVector2D v1;
- QCOMPARE(v1.x(), 0.0);
- QCOMPARE(v1.y(), 0.0);
- QCOMPARE(v1.isNull(), true);
- v1 = QDoubleVector2D(1.1, -2.5); // assignment and constructor
- QCOMPARE(v1.x(), 1.1);
- QCOMPARE(v1.y(), -2.5);
- QDoubleVector2D v2(v1); // copy constructor
- QCOMPARE(v2.x(), 1.1);
- QCOMPARE(v2.y(), -2.5);
- const QDoubleVector3D v3d(2.2, 3.3, 4.4);
- QDoubleVector2D v3(v3d); // constructor from 3d vector, just copies x and y
- QCOMPARE(v3.x(), 2.2);
- QCOMPARE(v3.y(), 3.3);
- QCOMPARE(v3.isNull(), false);
-}
-
-void tst_doubleVectors::basicFunctions2dTest()
-{
- QDoubleVector2D v1;
- v1.setX(3.0);
- v1.setY(4.0);
- QCOMPARE(v1.x(), 3.0);
- QCOMPARE(v1.y(), 4.0);
- QCOMPARE(v1.length(), 5.0);
- QDoubleVector2D v2 = v1.normalized();
- QCOMPARE(v1.lengthSquared(), 25.0);
- v1.normalize();
- QCOMPARE(v1.x(), 3.0/5.0);
- QCOMPARE(v1.y(), 4.0/5.0);
- QCOMPARE(v2.x(), 3.0/5.0);
- QCOMPARE(v2.y(), 4.0/5.0);
-
- QDoubleVector3D v3d = v1.toVector3D();
- QCOMPARE(v3d.x(), 3.0/5.0);
- QCOMPARE(v3d.y(), 4.0/5.0);
- QCOMPARE(v3d.z(), 0.0);
-}
-
-void tst_doubleVectors::unaryOperator2dTest()
-{
- QDoubleVector2D v1(1.1, 2.2);
- QDoubleVector2D v2 = -v1;
- QCOMPARE(v2.x(), -1.1);
- QCOMPARE(v2.y(), -2.2);
-
- v1 *= 2.0;
- QCOMPARE(v1.x(), 2.2);
- QCOMPARE(v1.y(), 4.4);
-
- v2 /= 2.0;
- QCOMPARE(v2.x(), -0.55);
- QCOMPARE(v2.y(), -1.1);
-
- v1 += v2;
- QCOMPARE(v1.x(), 1.65);
- QCOMPARE(v1.y(), 3.3);
-
- v1 -= v2;
- QCOMPARE(v1.x(), 2.2);
- QCOMPARE(v1.y(), 4.4);
-
- v1 *= v2;
- QCOMPARE(v1.x(), -1.21);
- QCOMPARE(v1.y(), -4.84);
-}
-
-void tst_doubleVectors::binaryOperator2dTest()
-{
- QDoubleVector2D v1(1.1, 2.2);
- QDoubleVector2D v2(3.4, 4.4);
- QDoubleVector2D v3 = v1 + v2;
- QCOMPARE(v3.x(), 4.5);
- QCOMPARE(v3.y(), 6.6);
-
- QDoubleVector2D v4 = v1 - v2;
- QCOMPARE(v4.x(), -2.3);
- QCOMPARE(v4.y(), -2.2);
-
- QDoubleVector2D v5 = v2 * 2;
- QCOMPARE(v5.x(), 6.8);
- QCOMPARE(v5.y(), 8.8);
-
- QDoubleVector2D v6 = 2 * v2;
- QCOMPARE(v6.x(), 6.8);
- QCOMPARE(v6.y(), 8.8);
-
- QDoubleVector2D v7 = v2 / 2;
- QCOMPARE(v7.x(), 1.7);
- QCOMPARE(v7.y(), 2.2);
-
- double d = QDoubleVector2D::dotProduct(v1, v2);
- QCOMPARE(d, 13.42);
-
- QCOMPARE(v5 == v6, true);
- QCOMPARE(v5 != v6, false);
- QCOMPARE(v6 == v7, false);
- QCOMPARE(v6 != v7, true);
-}
-
-
-
-// DoubleVector3D
-
-
-void tst_doubleVectors::constructor3dTest()
-{
- // empty constructor, since it sets to 0, we should check, in case people rely on it
- QDoubleVector3D v1;
- QCOMPARE(v1.x(), 0.0);
- QCOMPARE(v1.y(), 0.0);
- QCOMPARE(v1.z(), 0.0);
- QCOMPARE(v1.isNull(), true);
- v1 = QDoubleVector3D(1.1, -2.5, 3.2); // assignment and constructor
- QCOMPARE(v1.x(), 1.1);
- QCOMPARE(v1.y(), -2.5);
- QCOMPARE(v1.z(), 3.2);
- QDoubleVector3D v2(v1); // copy constructor
- QCOMPARE(v2.x(), 1.1);
- QCOMPARE(v2.y(), -2.5);
- QCOMPARE(v2.z(), 3.2);
- const QDoubleVector2D v2d(2.2, 3.3);
- QDoubleVector3D v3(v2d); // constructor from 3d vector, just copies x and y
- QCOMPARE(v3.x(), 2.2);
- QCOMPARE(v3.y(), 3.3);
- QCOMPARE(v3.z(), 0.0);
- QCOMPARE(v3.isNull(), false);
- const QDoubleVector2D v2d2(2.2, 3.3);
- QDoubleVector3D v4(v2d2, -13.6); // constructor from 2d vector
- QCOMPARE(v4.x(), 2.2);
- QCOMPARE(v4.y(), 3.3);
- QCOMPARE(v4.z(), -13.6);
-}
-
-void tst_doubleVectors::basicFunctions3dTest()
-{
- QDoubleVector3D v1;
- v1.setX(2.0);
- v1.setY(3.0);
- v1.setZ(6.0);
- QCOMPARE(v1.x(), 2.0);
- QCOMPARE(v1.y(), 3.0);
- QCOMPARE(v1.z(), 6.0);
- QCOMPARE(v1.length(), 7.0);
- QDoubleVector3D v2 = v1.normalized();
- QCOMPARE(v1.lengthSquared(), 49.0);
- v1.normalize();
- QCOMPARE(v1.x(), 2.0/7.0);
- QCOMPARE(v1.y(), 3.0/7.0);
- QCOMPARE(v1.z(), 6.0/7.0);
- QCOMPARE(v2.x(), 2.0/7.0);
- QCOMPARE(v2.y(), 3.0/7.0);
- QCOMPARE(v2.z(), 6.0/7.0);
-
- QDoubleVector2D v2d = v1.toVector2D();
- QCOMPARE(v2d.x(), 2.0/7.0);
- QCOMPARE(v2d.y(), 3.0/7.0);
-}
-
-void tst_doubleVectors::unaryOperator3dTest()
-{
- QDoubleVector3D v1(1.1, 2.2, 3.3);
- QDoubleVector3D v2 = -v1;
- QCOMPARE(v2.x(), -1.1);
- QCOMPARE(v2.y(), -2.2);
- QCOMPARE(v2.z(), -3.3);
-
- v1 *= 2.0;
- QCOMPARE(v1.x(), 2.2);
- QCOMPARE(v1.y(), 4.4);
- QCOMPARE(v1.z(), 6.6);
-
- v2 /= 2.0;
- QCOMPARE(v2.x(), -0.55);
- QCOMPARE(v2.y(), -1.1);
- QCOMPARE(v2.z(), -1.65);
-
- v1 += v2;
- QCOMPARE(v1.x(), 1.65);
- QCOMPARE(v1.y(), 3.3);
- QCOMPARE(v1.z(), 4.95);
-
- v1 -= v2;
- QCOMPARE(v1.x(), 2.2);
- QCOMPARE(v1.y(), 4.4);
- QCOMPARE(v1.z(), 6.6);
-
- v1 *= v2;
- QCOMPARE(v1.x(), -1.21);
- QCOMPARE(v1.y(), -4.84);
- QCOMPARE(v1.z(), -10.89);
-}
-
-void tst_doubleVectors::binaryOperator3dTest()
-{
- QDoubleVector3D v1(1.1, 2.2, 3.3);
- QDoubleVector3D v2(3.4, 4.4, 5.5);
- QDoubleVector3D v3 = v1 + v2;
- QCOMPARE(v3.x(), 4.5);
- QCOMPARE(v3.y(), 6.6);
- QCOMPARE(v3.z(), 8.8);
-
- QDoubleVector3D v4 = v1 - v2;
- QCOMPARE(v4.x(), -2.3);
- QCOMPARE(v4.y(), -2.2);
- QCOMPARE(v4.z(), -2.2);
-
- QDoubleVector3D v5 = v2 * 2;
- QCOMPARE(v5.x(), 6.8);
- QCOMPARE(v5.y(), 8.8);
- QCOMPARE(v5.z(), 11.0);
-
- QDoubleVector3D v6 = 2 * v2;
- QCOMPARE(v6.x(), 6.8);
- QCOMPARE(v6.y(), 8.8);
- QCOMPARE(v6.z(), 11.0);
-
- QDoubleVector3D v7 = v2 / 2;
- QCOMPARE(v7.x(), 1.7);
- QCOMPARE(v7.y(), 2.2);
- QCOMPARE(v7.z(), 2.75);
-
- double d = QDoubleVector3D::dotProduct(v1, v2);
- QCOMPARE(d, 31.57);
-
- QCOMPARE(v5 == v6, true);
- QCOMPARE(v5 != v6, false);
- QCOMPARE(v6 == v7, false);
- QCOMPARE(v6 != v7, true);
-}
-
-QTEST_APPLESS_MAIN(tst_doubleVectors)
-
-#include "tst_doublevectors.moc"
diff --git a/tests/auto/dummypositionplugin/CMakeLists.txt b/tests/auto/dummypositionplugin/CMakeLists.txt
deleted file mode 100644
index 9c196f0e..00000000
--- a/tests/auto/dummypositionplugin/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Generated from positionplugin.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryTest Plugin:
-#####################################################################
-
-qt_internal_add_plugin(DummyPluginForTestsFactoryPlugin
- OUTPUT_NAME qtposition_testplugin2
- CLASS_NAME DummyPluginForTestsFactory
- PLUGIN_TYPE position
- DEFAULT_IF FALSE
- SOURCES
- plugin.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:positionplugin.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
-# PLUGIN_EXTENDS = "-"
diff --git a/tests/auto/dummypositionplugin/dummypositionplugin.pro b/tests/auto/dummypositionplugin/dummypositionplugin.pro
deleted file mode 100644
index bdf4f7a2..00000000
--- a/tests/auto/dummypositionplugin/dummypositionplugin.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = qtposition_testplugin2
-QT += positioning-private
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = DummyPluginForTests
-PLUGIN_EXTENDS = -
-load(qt_plugin)
-
-SOURCES += plugin.cpp
-
-OTHER_FILES += \
- plugin.json
diff --git a/tests/auto/dummypositionplugin/plugin.cpp b/tests/auto/dummypositionplugin/plugin.cpp
deleted file mode 100644
index a0a8f475..00000000
--- a/tests/auto/dummypositionplugin/plugin.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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
-
-// This is a dummy plugin that is created mostly to test some features of
-// QDeclarativePositionSource. It does not provide any position updates.
-// Use plugin from positionplugin subdirectory, if you need to simulate some
-// positioning updates.
-
-class DummyPluginSource : public QGeoPositionInfoSource
-{
- Q_OBJECT
-
-public:
- DummyPluginSource(const QVariantMap &parameters, QObject *parent = 0);
- ~DummyPluginSource();
-
- 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:
- Error lastError = QGeoPositionInfoSource::NoError;
-};
-
-DummyPluginSource::DummyPluginSource(const QVariantMap &parameters, QObject *parent)
- : QGeoPositionInfoSource(parent)
-{
- Q_UNUSED(parameters)
-}
-
-QGeoPositionInfoSource::Error DummyPluginSource::error() const
-{
- return lastError;
-}
-
-void DummyPluginSource::setUpdateInterval(int msec)
-{
- if (msec < minimumUpdateInterval())
- msec = minimumUpdateInterval();
-
- QGeoPositionInfoSource::setUpdateInterval(msec);
-}
-
-int DummyPluginSource::minimumUpdateInterval() const
-{
- return 100;
-}
-
-QGeoPositionInfo
-DummyPluginSource::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const
-{
- Q_UNUSED(fromSatellitePositioningMethodsOnly);
- return QGeoPositionInfo();
-}
-
-QGeoPositionInfoSource::PositioningMethods DummyPluginSource::supportedPositioningMethods() const
-{
- return QGeoPositionInfoSource::NonSatellitePositioningMethods;
-}
-
-void DummyPluginSource::startUpdates()
-{
- lastError = QGeoPositionInfoSource::NoError;
-}
-
-void DummyPluginSource::stopUpdates() { }
-
-void DummyPluginSource::requestUpdate(int timeout)
-{
- lastError = QGeoPositionInfoSource::NoError;
- if (timeout < minimumUpdateInterval()) {
- lastError = QGeoPositionInfoSource::UpdateTimeoutError;
- emit QGeoPositionInfoSource::errorOccurred(lastError);
- }
-}
-
-DummyPluginSource::~DummyPluginSource() { }
-
-class DummyPluginForTestsFactory : public QObject, public QGeoPositionInfoSourceFactory
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/6.0" FILE "plugin.json")
- Q_INTERFACES(QGeoPositionInfoSourceFactory)
-
-public:
- 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 *
-DummyPluginForTestsFactory::positionInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- return new DummyPluginSource(parameters, parent);
-}
-
-QGeoSatelliteInfoSource *
-DummyPluginForTestsFactory::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent);
- Q_UNUSED(parameters);
- return nullptr;
-}
-
-QGeoAreaMonitorSource *DummyPluginForTestsFactory::areaMonitor(QObject *parent,
- const QVariantMap &parameters)
-{
- Q_UNUSED(parent);
- Q_UNUSED(parameters);
- return nullptr;
-}
-
-#include "plugin.moc"
diff --git a/tests/auto/dummypositionplugin/plugin.json b/tests/auto/dummypositionplugin/plugin.json
deleted file mode 100644
index 61f2657b..00000000
--- a/tests/auto/dummypositionplugin/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["dummy.source"],
- "Provider": "dummy.source",
- "Position": true,
- "Satellite": false,
- "Monitor": false,
- "Priority": 1,
- "Testable": true
-}
diff --git a/tests/auto/positionplugin/CMakeLists.txt b/tests/auto/positionplugin/CMakeLists.txt
deleted file mode 100644
index 7e1f2ed8..00000000
--- a/tests/auto/positionplugin/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Generated from positionplugin.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryTest Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QGeoPositionInfoSourceFactoryTestPlugin
- OUTPUT_NAME qtposition_testplugin
- CLASS_NAME QGeoPositionInfoSourceFactoryTest
- PLUGIN_TYPE position
- DEFAULT_IF FALSE
- SOURCES
- plugin.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:positionplugin.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
-# PLUGIN_EXTENDS = "-"
diff --git a/tests/auto/positionplugin/plugin.cpp b/tests/auto/positionplugin/plugin.cpp
deleted file mode 100644
index 32dc3dee..00000000
--- a/tests/auto/positionplugin/plugin.cpp
+++ /dev/null
@@ -1,248 +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 DummySourcePrivate;
-class DummySource : public QGeoPositionInfoSource
-{
- Q_OBJECT
-
-public:
- DummySource(const QVariantMap &parameters, QObject *parent=0);
- ~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;
-
- bool setBackendProperty(const QString &name, const QVariant &value) override;
- QVariant backendProperty(const QString &name) const override;
-
-private:
- QTimer *timer;
- QTimer *timeoutTimer;
- QTimer *singleTimer;
- QGeoPositionInfo lastPosition;
- QDateTime lastUpdateTime;
- Error lastError = QGeoPositionInfoSource::NoError;
- qreal altitude = 0.0;
-
-private slots:
- void updatePosition();
- void doTimeout();
-};
-
-DummySource::DummySource(const QVariantMap &parameters, QObject *parent) :
- QGeoPositionInfoSource(parent),
- timer(new QTimer(this)),
- timeoutTimer(new QTimer(this)),
- singleTimer(new QTimer(this)),
- lastPosition(QGeoCoordinate(0,0), QDateTime::currentDateTime())
-{
- if (parameters.contains(QStringLiteral("test.source.altitude"))) {
- const qreal alti = parameters.value(QStringLiteral("test.source.altitude")).toReal();
- altitude = alti;
- QGeoCoordinate crd = lastPosition.coordinate();
- crd.setAltitude(alti);
- lastPosition.setCoordinate(crd);
- }
- timer->setInterval(200);
- 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 lastError;
-}
-
-bool DummySource::setBackendProperty(const QString &name, const QVariant &value)
-{
- if (name == QStringLiteral("altitude")) {
- altitude = value.toReal();
- return true;
- }
- return false;
-}
-
-QVariant DummySource::backendProperty(const QString &name) const
-{
- if (name == QStringLiteral("altitude"))
- return altitude;
- return QVariant();
-}
-
-
-void DummySource::setUpdateInterval(int msec)
-{
- const int minInterval = minimumUpdateInterval();
- if (msec == 0) {
- timer->setInterval(minInterval);
- } else if (msec < minInterval) {
- msec = minInterval;
- timer->setInterval(msec);
- } else {
- timer->setInterval(msec);
- }
-
- QGeoPositionInfoSource::setUpdateInterval(msec);
-}
-
-int DummySource::minimumUpdateInterval() const
-{
- return 200;
-}
-
-QGeoPositionInfo DummySource::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const
-{
- Q_UNUSED(fromSatellitePositioningMethodsOnly);
- return lastPosition;
-}
-
-QGeoPositionInfoSource::PositioningMethods DummySource::supportedPositioningMethods() const
-{
- return QGeoPositionInfoSource::AllPositioningMethods;
-}
-
-void DummySource::startUpdates()
-{
- lastError = QGeoPositionInfoSource::NoError;
- timer->start();
-}
-
-void DummySource::stopUpdates()
-{
- timer->stop();
-}
-
-void DummySource::requestUpdate(int timeout)
-{
- lastError = QGeoPositionInfoSource::NoError;
- if (timeout == 0)
- timeout = 5000;
- if (timeout < 0)
- timeout = 0;
-
- timeoutTimer->setInterval(timeout);
- timeoutTimer->start();
-
- if (timer->isActive()) {
- timer->stop();
- timer->start();
- }
-
- singleTimer->setInterval(minimumUpdateInterval());
- 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,
- altitude);
-
- 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();
- lastError = QGeoPositionInfoSource::UpdateTimeoutError;
- emit QGeoPositionInfoSource::errorOccurred(lastError);
-}
-
-
-class QGeoPositionInfoSourceFactoryTest : public QObject, public QGeoPositionInfoSourceFactory
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/6.0"
- FILE "plugin.json")
- Q_INTERFACES(QGeoPositionInfoSourceFactory)
-
-public:
- 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, const QVariantMap &parameters)
-{
- return new DummySource(parameters, parent);
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryTest::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent);
- Q_UNUSED(parameters);
- return nullptr;
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryTest::areaMonitor(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent);
- Q_UNUSED(parameters);
- return nullptr;
-}
-
-#include "plugin.moc"
diff --git a/tests/auto/positionplugin/plugin.json b/tests/auto/positionplugin/plugin.json
deleted file mode 100644
index 4e7df0e4..00000000
--- a/tests/auto/positionplugin/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["test.source"],
- "Provider": "test.source",
- "Position": true,
- "Satellite": false,
- "Monitor": false,
- "Priority": 2,
- "Testable": true
-}
diff --git a/tests/auto/positionplugin/positionplugin.pro b/tests/auto/positionplugin/positionplugin.pro
deleted file mode 100644
index 84d08ac0..00000000
--- a/tests/auto/positionplugin/positionplugin.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = qtposition_testplugin
-QT += positioning-private
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryTest
-PLUGIN_EXTENDS = -
-load(qt_plugin)
-
-SOURCES += plugin.cpp
-
-OTHER_FILES += \
- plugin.json
diff --git a/tests/auto/positionplugintest/CMakeLists.txt b/tests/auto/positionplugintest/CMakeLists.txt
deleted file mode 100644
index 619c471f..00000000
--- a/tests/auto/positionplugintest/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from positionplugintest.pro.
-
-#####################################################################
-## tst_positionplugin Test:
-#####################################################################
-
-qt_internal_add_test(tst_positionplugin
- SOURCES
- tst_positionplugin.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:positionplugintest.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/positionplugintest/positionplugintest.pro b/tests/auto/positionplugintest/positionplugintest.pro
deleted file mode 100644
index 4602be7f..00000000
--- a/tests/auto/positionplugintest/positionplugintest.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-TARGET=tst_positionplugin
-
-SOURCES += tst_positionplugin.cpp
-
-CONFIG -= app_bundle
-
-QT += positioning testlib
diff --git a/tests/auto/positionplugintest/tst_positionplugin.cpp b/tests/auto/positionplugintest/tst_positionplugin.cpp
deleted file mode 100644
index 4afcd662..00000000
--- a/tests/auto/positionplugintest/tst_positionplugin.cpp
+++ /dev/null
@@ -1,109 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include <QtTest/QtTest>
-#include <QSignalSpy>
-#include <QtPositioning/qgeopositioninfosource.h>
-#include <QtPositioning/qgeosatelliteinfosource.h>
-#include <QtPositioning/qgeoareamonitorsource.h>
-#include <QtPositioning/qgeocoordinate.h>
-
-QT_USE_NAMESPACE
-
-class tst_PositionPlugin : public QObject
-{
- Q_OBJECT
-
-private slots:
- void initTestCase();
-
- void availableSources();
- void create();
- void getUpdates();
-};
-
-void tst_PositionPlugin::initTestCase()
-{
-#if QT_CONFIG(library)
- /*
- * Set custom path since CI doesn't install test plugins
- */
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
- + QStringLiteral("/../../../plugins"));
-#endif
-#endif
-}
-
-void tst_PositionPlugin::availableSources()
-{
- QVERIFY(QGeoPositionInfoSource::availableSources().contains("test.source"));
- QVERIFY(!QGeoSatelliteInfoSource::availableSources().contains("test.source"));
- QVERIFY(!QGeoAreaMonitorSource::availableSources().contains("test.source"));
-}
-
-void tst_PositionPlugin::create()
-{
- std::unique_ptr<QGeoPositionInfoSource> src = nullptr;
- src.reset(QGeoPositionInfoSource::createSource("test.source", 0));
- QVERIFY(src != nullptr);
-
- QVERIFY(src->minimumUpdateInterval() == 200);
-
- src.reset(QGeoPositionInfoSource::createSource("invalid source that will never exist", 0));
- QVERIFY(src == 0);
-
- std::unique_ptr<QGeoSatelliteInfoSource> ssrc = nullptr;
- ssrc.reset(QGeoSatelliteInfoSource::createSource("test.source", 0));
- QVERIFY(ssrc == nullptr);
-}
-
-void tst_PositionPlugin::getUpdates()
-{
- std::unique_ptr<QGeoPositionInfoSource> src(QGeoPositionInfoSource::createSource("test.source", 0));
- src->setUpdateInterval(200);
-
- QSignalSpy spy(src.get(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- src->startUpdates();
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 5000);
- QCOMPARE(spy[0].size(), 1);
-
- QGeoPositionInfo info = qvariant_cast<QGeoPositionInfo>(spy[0][0]);
- QCOMPARE(info.coordinate().latitude(), 0.1);
- QCOMPARE(info.coordinate().longitude(), 0.1);
-}
-
-
-
-QTEST_GUILESS_MAIN(tst_PositionPlugin)
-#include "tst_positionplugin.moc"
diff --git a/tests/auto/qdeclarativegeolocation/CMakeLists.txt b/tests/auto/qdeclarativegeolocation/CMakeLists.txt
deleted file mode 100644
index ebf65896..00000000
--- a/tests/auto/qdeclarativegeolocation/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-qt_internal_add_test(tst_qdeclarativegeolocation
- SOURCES
- tst_qdeclarativegeolocation.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::PositioningQuickPrivate
- Qt::TestPrivate
-)
diff --git a/tests/auto/qdeclarativegeolocation/tst_qdeclarativegeolocation.cpp b/tests/auto/qdeclarativegeolocation/tst_qdeclarativegeolocation.cpp
deleted file mode 100644
index e6818209..00000000
--- a/tests/auto/qdeclarativegeolocation/tst_qdeclarativegeolocation.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoRectangle>
-#include <QtPositioningQuick/private/qdeclarativegeolocation_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_DeclarativeGeoLocation : public QObject
-{
- Q_OBJECT
-
-private slots:
- void locationProperty();
- void addressBinding();
- void coordinateBinding();
- void shapeBinding();
- void attributesBinding();
-};
-
-void tst_DeclarativeGeoLocation::locationProperty()
-{
- // This test calls setLocation() with different preconditions, providing
- // coverage for different branches of the setLocation() method.
-
- QGeoAddress addr;
- addr.setCountryCode("DEU");
- addr.setCountry("Germany");
- addr.setCity("Berlin");
- addr.setStreet("Erich-Thilo-Str");
- addr.setStreetNumber("10");
- addr.setPostalCode("12489");
-
- const QGeoCoordinate c(52.43, 13.53);
-
- const QVariantMap attrs { { "string_proprty", "value" }, { "int_property", 5 } };
-
- QGeoLocation loc1;
- loc1.setAddress(addr);
- loc1.setCoordinate(c);
- loc1.setBoundingShape(QGeoCircle(c, 100));
- loc1.setExtendedAttributes(attrs);
-
- QDeclarativeGeoLocation location;
- qsizetype addrChangedCount = 0;
- qsizetype coordChangedCount = 0;
- qsizetype shapeChangedCount = 0;
- qsizetype attrChangedCount = 0;
-
- auto addrChangedHandler = location.bindableAddress().onValueChanged(
- [&addrChangedCount]() { ++addrChangedCount; });
- Q_UNUSED(addrChangedHandler)
- auto coordChangedHandler = location.bindableCoordinate().onValueChanged(
- [&coordChangedCount]() { ++coordChangedCount; });
- Q_UNUSED(coordChangedHandler)
- auto shapeChangedHandler = location.bindableBoundingShape().onValueChanged(
- [&shapeChangedCount]() { ++shapeChangedCount; });
- Q_UNUSED(shapeChangedHandler)
- auto attrChangedHandler = location.bindableExtendedAttributes().onValueChanged(
- [&attrChangedCount]() { ++attrChangedCount; });
- Q_UNUSED(attrChangedHandler)
-
- // By default an empty m_address is created in the default constructor.
- // So m_address contains a valid pointer, m_address->parent() == this.
- location.setLocation(loc1);
- QCOMPARE(addrChangedCount, 0); // the pointer didn't change
- QCOMPARE(coordChangedCount, 1);
- QCOMPARE(shapeChangedCount, 1);
- QCOMPARE(attrChangedCount, 1);
- QCOMPARE(location.location(), loc1);
- QCOMPARE(location.address()->parent(), &location);
-
- // m_address contains a nullptr
- location.setAddress(nullptr);
- QVERIFY(!location.address());
- addrChangedCount = 0;
- coordChangedCount = 0;
- shapeChangedCount = 0;
- attrChangedCount = 0;
-
- location.setLocation(loc1);
- QCOMPARE(addrChangedCount, 1); // only the pointer has changed
- QCOMPARE(coordChangedCount, 0);
- QCOMPARE(shapeChangedCount, 0);
- QCOMPARE(attrChangedCount, 0);
- QCOMPARE(location.location(), loc1);
- QCOMPARE(location.address()->parent(), &location);
-
- // m_address contains a valid pointer, m_address->parent() != this
- QGeoAddress addr1;
- addr1.setCountryCode("USA");
- addr1.setCountry("United States");
- addr1.setPostalCode("8900");
- addr1.setState("Oregon");
- addr1.setCity("Springfield");
- addr1.setDistrict("Pressboard Estates");
- addr1.setStreet("Evergreen Tce");
- addr1.setStreetNumber("742");
-
- QDeclarativeGeoAddress geoAddr(addr1);
-
- location.setAddress(&geoAddr);
- QVERIFY(location.address());
- QCOMPARE(location.address()->parent(), nullptr);
- addrChangedCount = 0;
-
- location.setLocation(loc1);
- QCOMPARE(addrChangedCount, 1); // only the pointer has changed
- QCOMPARE(coordChangedCount, 0);
- QCOMPARE(shapeChangedCount, 0);
- QCOMPARE(attrChangedCount, 0);
- QCOMPARE(location.location(), loc1);
- QCOMPARE(location.address()->parent(), &location);
-}
-
-void tst_DeclarativeGeoLocation::addressBinding()
-{
- QDeclarativeGeoLocation location;
- QDeclarativeGeoAddress addr1;
- QDeclarativeGeoAddress addr2;
- QTestPrivate::testReadWritePropertyBasics<QDeclarativeGeoLocation, QDeclarativeGeoAddress *>(
- location, &addr1, &addr2, "address");
-}
-
-void tst_DeclarativeGeoLocation::coordinateBinding()
-{
- QDeclarativeGeoLocation location;
- const QGeoCoordinate c1(2.0, 1.0);
- const QGeoCoordinate c2(1.0, 2.0);
- QTestPrivate::testReadWritePropertyBasics<QDeclarativeGeoLocation, QGeoCoordinate>(
- location, c1, c2, "coordinate");
-}
-
-void tst_DeclarativeGeoLocation::shapeBinding()
-{
- QDeclarativeGeoLocation location;
- const QGeoCircle circle(QGeoCoordinate(2.0, 1.0), 10);
- const QGeoRectangle rectangle(QGeoCoordinate(2.0, 1.0), QGeoCoordinate(1.0, 2.0));
- QTestPrivate::testReadWritePropertyBasics<QDeclarativeGeoLocation, QGeoShape>(
- location, circle, rectangle, "boundingShape");
-}
-
-void tst_DeclarativeGeoLocation::attributesBinding()
-{
- QDeclarativeGeoLocation location;
- const QVariantMap m1 { { "string_proprty", "value" }, { "int_property", 5 } };
- const QVariantMap m2 { { "int_property", 10 }, { "double_property", 15.5 } };
- QTestPrivate::testReadWritePropertyBasics<QDeclarativeGeoLocation, QVariantMap>(
- location, m1, m2, "extendedAttributes");
-}
-
-QTEST_APPLESS_MAIN(tst_DeclarativeGeoLocation)
-
-#include "tst_qdeclarativegeolocation.moc"
diff --git a/tests/auto/qdeclarativeposition/CMakeLists.txt b/tests/auto/qdeclarativeposition/CMakeLists.txt
deleted file mode 100644
index f5c132c2..00000000
--- a/tests/auto/qdeclarativeposition/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-qt_internal_add_test(tst_qdeclarativeposition
- SOURCES
- tst_qdeclarativeposition.cpp
- LIBRARIES
- Qt::Core
- Qt::PositioningQuickPrivate
- Qt::TestPrivate
-)
diff --git a/tests/auto/qdeclarativeposition/tst_qdeclarativeposition.cpp b/tests/auto/qdeclarativeposition/tst_qdeclarativeposition.cpp
deleted file mode 100644
index 2e396475..00000000
--- a/tests/auto/qdeclarativeposition/tst_qdeclarativeposition.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QtPositioningQuick/private/qdeclarativeposition_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_QDeclarativePosition : public QObject
-{
- Q_OBJECT
-
-private slots:
- void initTestCase();
- void init();
-
- void latitudeValidBinding();
- void longitudeValidBinding();
- void altitudeValidBinding();
- void coordinateBinding();
- void timestampBinding();
- void speedBinding();
- void speedValidBinding();
- void horizontalAccuracyValidBinding();
- void horizontalAccuracyBinding();
- void verticalAccuracyValidBinding();
- void verticalAccuracyBinding();
- void directionValidBinding();
- void directionBinding();
- void verticalSpeedValidBinding();
- void verticalSpeedBinding();
- void magneticVariationValidBinding();
- void magneticVariationBinding();
-
-private:
- QDeclarativePosition m_declarativePosition;
- QGeoPositionInfo m_positionInfo;
- std::function<void()> m_mutatorFunc = nullptr;
- std::function<bool(const double &, const double &)> m_doubleComparator = nullptr;
-};
-
-void tst_QDeclarativePosition::initTestCase()
-{
- m_mutatorFunc = [&]() { m_declarativePosition.setPosition(m_positionInfo); };
- m_doubleComparator = [](const double &lhs, const double &rhs) {
- return (qIsNaN(lhs) && qIsNaN(rhs)) || qFuzzyCompare(lhs, rhs);
- };
-}
-
-void tst_QDeclarativePosition::init()
-{
- // reset position before each test
- m_declarativePosition.setPosition(QGeoPositionInfo());
-}
-
-void tst_QDeclarativePosition::latitudeValidBinding()
-{
- QCOMPARE(m_declarativePosition.isLatitudeValid(), false);
- m_positionInfo.setCoordinate(QGeoCoordinate(1.0, 2.0));
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "latitudeValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::longitudeValidBinding()
-{
- QCOMPARE(m_declarativePosition.isLongitudeValid(), false);
- m_positionInfo.setCoordinate(QGeoCoordinate(1.0, 2.0));
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "longitudeValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::altitudeValidBinding()
-{
- QCOMPARE(m_declarativePosition.isAltitudeValid(), false);
- m_positionInfo.setCoordinate(QGeoCoordinate(1.0, 2.0, 3.0));
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "altitudeValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::coordinateBinding()
-{
- QCOMPARE(m_declarativePosition.coordinate(), QGeoCoordinate());
- m_positionInfo.setCoordinate(QGeoCoordinate(1.0, 2.0, 3.0));
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, QGeoCoordinate>(
- m_declarativePosition, QGeoCoordinate(), QGeoCoordinate(1.0, 2.0, 3.0), "coordinate",
- m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::timestampBinding()
-{
- QCOMPARE(m_declarativePosition.timestamp(), QDateTime());
- const auto timestamp = QDateTime::currentDateTimeUtc();
- m_positionInfo.setTimestamp(timestamp);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, QDateTime>(
- m_declarativePosition, QDateTime(), timestamp, "timestamp", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::speedBinding()
-{
- QCOMPARE(m_declarativePosition.speed(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::GroundSpeed, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "speed", m_mutatorFunc, m_doubleComparator);
-}
-
-void tst_QDeclarativePosition::speedValidBinding()
-{
- QCOMPARE(m_declarativePosition.isSpeedValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::GroundSpeed, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "speedValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::horizontalAccuracyValidBinding()
-{
- QCOMPARE(m_declarativePosition.isHorizontalAccuracyValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::HorizontalAccuracy, 1.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "horizontalAccuracyValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::horizontalAccuracyBinding()
-{
- QCOMPARE(m_declarativePosition.horizontalAccuracy(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::HorizontalAccuracy, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "horizontalAccuracy", m_mutatorFunc,
- m_doubleComparator);
-}
-
-void tst_QDeclarativePosition::verticalAccuracyValidBinding()
-{
- QCOMPARE(m_declarativePosition.isVerticalAccuracyValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::VerticalAccuracy, 1.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "verticalAccuracyValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::verticalAccuracyBinding()
-{
- QCOMPARE(m_declarativePosition.verticalAccuracy(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::VerticalAccuracy, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "verticalAccuracy", m_mutatorFunc,
- m_doubleComparator);
-}
-
-void tst_QDeclarativePosition::directionValidBinding()
-{
- QCOMPARE(m_declarativePosition.isDirectionValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::Direction, 1.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "directionValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::directionBinding()
-{
- QCOMPARE(m_declarativePosition.direction(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::Direction, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "direction", m_mutatorFunc, m_doubleComparator);
-}
-
-void tst_QDeclarativePosition::verticalSpeedValidBinding()
-{
- QCOMPARE(m_declarativePosition.isVerticalSpeedValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, 1.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "verticalSpeedValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::verticalSpeedBinding()
-{
- QCOMPARE(m_declarativePosition.verticalSpeed(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "verticalSpeed", m_mutatorFunc,
- m_doubleComparator);
-}
-
-void tst_QDeclarativePosition::magneticVariationValidBinding()
-{
- QCOMPARE(m_declarativePosition.isMagneticVariationValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::MagneticVariation, 1.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "magneticVariationValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::magneticVariationBinding()
-{
- QCOMPARE(m_declarativePosition.magneticVariation(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::MagneticVariation, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "magneticVariation", m_mutatorFunc,
- m_doubleComparator);
-}
-
-QTEST_GUILESS_MAIN(tst_QDeclarativePosition)
-#include "tst_qdeclarativeposition.moc"
diff --git a/tests/auto/qdeclarativepositionsource/CMakeLists.txt b/tests/auto/qdeclarativepositionsource/CMakeLists.txt
deleted file mode 100644
index 8d1d4653..00000000
--- a/tests/auto/qdeclarativepositionsource/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-qt_internal_add_test(tst_qdeclarativepositionsource
- SOURCES
- tst_qdeclarativepositionsource.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::PositioningQuickPrivate
- Qt::TestPrivate
-)
diff --git a/tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp b/tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp
deleted file mode 100644
index cd556ab4..00000000
--- a/tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp
+++ /dev/null
@@ -1,533 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QtPositioningQuick/private/qdeclarativepositionsource_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_DeclarativePositionSource : public QObject
-{
- Q_OBJECT
-
-private slots:
- void init();
-
- void nameBinding();
- void supportedMethodsBinding();
- void sourceErrorBinding();
- void validBinding();
- void positionBinding();
- void activeBinding();
- void startBreaksActiveBinding();
- void activeBindingBreak();
-
- void intervalOnSourceDependency();
- void preferredMethodsOnSourceDependency();
-
- void updateAfterStart();
- void startAfterUpdate();
- void stopAfterUpdate();
- void startStopAfterUpdate();
- void updateTimedOut();
- void updateWithStartTimedOut();
- void startUpdateStopWithNoIntervals();
-
-private:
- std::unique_ptr<QDeclarativePositionSource> m_positionSource = nullptr;
-};
-
-void tst_DeclarativePositionSource::init()
-{
- // create a fresh instance of QDeclarativePositionSource before each test
- m_positionSource.reset(new QDeclarativePositionSource);
- m_positionSource->componentComplete(); // simulate QML loading
-}
-
-void tst_DeclarativePositionSource::nameBinding()
-{
- m_positionSource->setName("test.source");
- QTestPrivate::testReadWritePropertyBasics<QDeclarativePositionSource, QString>(
- *m_positionSource.get(), "invalid source", "test.source", "name");
-}
-
-void tst_DeclarativePositionSource::supportedMethodsBinding()
-{
- // Invalid source has no positioning methods.
- // "test.source" has all positioning methods.
- m_positionSource->setName("invalid name");
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePositionSource,
- QDeclarativePositionSource::PositioningMethods>(
- *m_positionSource.get(), QDeclarativePositionSource::NoPositioningMethods,
- QDeclarativePositionSource::AllPositioningMethods, "supportedPositioningMethods",
- [&]() { m_positionSource->setName("test.source"); });
-}
-
-void tst_DeclarativePositionSource::sourceErrorBinding()
-{
- // "dummy.source" has a minimum update interval of 100, and calling
- // update() with a smaller timeout immediately result in a timeout error
- m_positionSource->setName("dummy.source");
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePositionSource,
- QDeclarativePositionSource::SourceError>(
- *m_positionSource.get(), QDeclarativePositionSource::NoError,
- QDeclarativePositionSource::UpdateTimeoutError, "sourceError",
- [&]() { m_positionSource->update(10); });
- if (QTest::currentTestFailed())
- return;
-
- // Test that we can't bind sourceError to smth, as it's read-only
- QProperty<QDeclarativePositionSource::SourceError> errorSetter;
- m_positionSource->bindableSourceError().setBinding(Qt::makePropertyBinding(errorSetter));
- QCOMPARE(m_positionSource->bindableSourceError().hasBinding(), false);
-}
-
-void tst_DeclarativePositionSource::validBinding()
-{
- // Invalid source name results in no position source -> invalid object.
- // Setting the name to "test.source" results in creating a new position
- // source -> valid object
- m_positionSource->setName("invalid name");
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePositionSource, bool>(
- *m_positionSource.get(), false, true, "valid",
- [&]() { m_positionSource->setName("test.source"); });
-}
-
-static char *printPosition(const QDeclarativePosition *position)
-{
- // For this test we need to print only coordinate, so that we get a nice
- // error message if the below test fails.
- QString str;
- QDebug dbg(&str);
- dbg << position->coordinate();
- const auto dataArray = str.toLatin1();
- const auto msgSize = dataArray.size() + 1;
- char *msg = new char[msgSize];
- memset(msg, 0, msgSize);
- qsnprintf(msg, msgSize, "%s", dataArray.constData());
- return msg;
-}
-
-void tst_DeclarativePositionSource::positionBinding()
-{
- // "test.source" udpates its position, starting from (0, 0) coordinate, and
- // adding 0.1 lat and 0.1 log at every step
- m_positionSource->setName("test.source");
- m_positionSource->setUpdateInterval(200);
- const QGeoCoordinate c1(0, 0);
- const QGeoCoordinate c2(0.1, 0.1, 0);
- QCOMPARE(m_positionSource->position()->coordinate(), c1);
-
- QGeoPositionInfo posInfo;
- posInfo.setCoordinate(c1);
- QDeclarativePosition pos1;
- pos1.setPosition(posInfo);
-
- posInfo.setCoordinate(c2);
- QDeclarativePosition pos2;
- pos2.setPosition(posInfo);
-
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePositionSource, QDeclarativePosition *>(
- *m_positionSource.get(), &pos1, &pos2, "position",
- [&]() {
- QSignalSpy spy(m_positionSource.get(),
- &QDeclarativePositionSource::positionChanged);
- m_positionSource->update();
- // Wait for the update to happen. It should take around 200 ms,
- // but we want to be on a safe side in case of high CI load.
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 5000);
- },
- [](const QDeclarativePosition *p1, const QDeclarativePosition *p2) {
- return p1->coordinate() == p2->coordinate();
- },
- printPosition);
- if (QTest::currentTestFailed())
- return;
-
- QProperty<QDeclarativePosition *> prop(nullptr);
- m_positionSource->bindablePosition().setBinding(Qt::makePropertyBinding(prop));
- // We can't have bindings on read-only properties
- QCOMPARE(m_positionSource->bindablePosition().hasBinding(), false);
-}
-
-void tst_DeclarativePositionSource::activeBinding()
-{
- // we can't use a common templated method to test active property, because
- // setActive() uses QTimer::singleShot() to actually update the property
- // state.
- m_positionSource->setName("test.source");
-
- QProperty<bool> activeObserver;
- activeObserver.setBinding(m_positionSource->bindableActive().makeBinding());
-
- QProperty<bool> activeLambdaObserver;
- activeLambdaObserver.setBinding([&]() { return m_positionSource->isActive(); });
-
- QSignalSpy activeSpy(m_positionSource.get(), &QDeclarativePositionSource::activeChanged);
-
- QCOMPARE(activeSpy.count(), 0);
- QCOMPARE(activeObserver.value(), false);
- QCOMPARE(activeLambdaObserver.value(), false);
-
- QProperty<bool> activeSetter(false);
- m_positionSource->bindableActive().setBinding(Qt::makePropertyBinding(activeSetter));
-
- activeSetter = true;
- QTest::qWait(0); // to trigger singleShot timer in setActive
-
- QCOMPARE(activeSpy.count(), 1);
- QCOMPARE(activeObserver.value(), true);
- QCOMPARE(activeLambdaObserver.value(), true);
-
- activeSetter = false;
-
- QCOMPARE(activeSpy.count(), 2);
- QCOMPARE(activeObserver.value(), false);
- QCOMPARE(activeLambdaObserver.value(), false);
-
- // calling update() does not break the binding
- m_positionSource->update(50);
- QCOMPARE(activeSpy.count(), 3);
- QCOMPARE(activeObserver.value(), true);
- QCOMPARE(activeLambdaObserver.value(), true);
-
- QTRY_COMPARE_WITH_TIMEOUT(m_positionSource->sourceError(),
- QDeclarativePositionSource::UpdateTimeoutError, 5000);
-
- QCOMPARE(activeSpy.count(), 4);
- QCOMPARE(activeObserver.value(), false);
- QCOMPARE(activeLambdaObserver.value(), false);
-
- activeSetter = true;
- QTest::qWait(0); // to trigger singleShot timer in setActive
-
- QCOMPARE(activeSpy.count(), 5);
- QCOMPARE(activeObserver.value(), true);
- QCOMPARE(activeLambdaObserver.value(), true);
-
- // calling stop() will break the binding
- m_positionSource->stop();
-
- QCOMPARE(activeSpy.count(), 6);
- QCOMPARE(m_positionSource->isActive(), false);
- QCOMPARE(activeObserver.value(), false);
- QCOMPARE(activeLambdaObserver.value(), false);
-
- activeSetter = false;
- activeSetter = true;
- QTest::qWait(0); // to trigger singleShot timer in setActive
-
- // nothing changed, as the binding is broken
- QCOMPARE(activeSpy.count(), 6);
- QCOMPARE(m_positionSource->isActive(), false);
- QCOMPARE(activeObserver.value(), false);
- QCOMPARE(activeLambdaObserver.value(), false);
-}
-
-void tst_DeclarativePositionSource::startBreaksActiveBinding()
-{
- m_positionSource->setName("test.source");
- QSignalSpy activeSpy(m_positionSource.get(), &QDeclarativePositionSource::activeChanged);
-
- QProperty<bool> activeSetter(true);
- m_positionSource->bindableActive().setBinding(Qt::makePropertyBinding(activeSetter));
-
- QTest::qWait(0); // to trigger singleShot timer in setActive
-
- QCOMPARE(m_positionSource->isActive(), true);
- QCOMPARE(activeSpy.count(), 1);
- QVERIFY(m_positionSource->bindableActive().hasBinding());
-
- // Call start() explicitly, which should break the binding for 'active'
- // property.
- m_positionSource->start();
- activeSetter = false; // this should have no effect
- QTest::qWait(0); // to trigger singleShot timer in setActive
-
- QCOMPARE(m_positionSource->isActive(), true);
- QCOMPARE(activeSpy.count(), 1);
- QVERIFY(!m_positionSource->bindableActive().hasBinding());
-}
-
-void tst_DeclarativePositionSource::activeBindingBreak()
-{
- // This test checks a tricky scenario of breaking the binding for
- // 'active' property.
- // 0. active has a binding to some property Prop.
- // 1. Prop is set to true => active = true => start getting position info.
- // 2. Calling update() for a single update => the binding of active is not
- // broken.
- // 3. Calling stop() explicitly before the update() call is finished =>
- // the active binding is supposed to be broken, but the active state
- // should still be true, because we have a pending update.
- // 4. The pending update finishes => the active is set to false.
-
- m_positionSource->setName("test.source");
-
- QProperty<bool> setter(false);
- m_positionSource->bindableActive().setBinding(Qt::makePropertyBinding(setter));
- QVERIFY(m_positionSource->bindableActive().hasBinding());
-
- setter = true;
- QTest::qWait(0); // to trigger singleShot timer in setActive
- QCOMPARE(m_positionSource->isActive(), true);
-
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
-
- m_positionSource->stop();
- QVERIFY(!m_positionSource->bindableActive().hasBinding());
- QCOMPARE(m_positionSource->isActive(), true);
-
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
-
- QCOMPARE(m_positionSource->isActive(), false);
- QVERIFY(!m_positionSource->bindableActive().hasBinding());
-}
-
-void tst_DeclarativePositionSource::intervalOnSourceDependency()
-{
- // updateInterval can be modified if the new source does not support that
- // large one, or implements some calculation
- m_positionSource->setName("invalid_source"); // reset the source
-
- QSignalSpy intervalSpy(m_positionSource.get(),
- &QDeclarativePositionSource::updateIntervalChanged);
-
- m_positionSource->setUpdateInterval(100);
- QCOMPARE(m_positionSource->updateInterval(), 100);
- QCOMPARE(intervalSpy.count(), 1);
-
- // "test.source" has a minimum update interval of 200
- m_positionSource->setName("test.source");
- QCOMPARE(m_positionSource->updateInterval(), 200);
- QCOMPARE(intervalSpy.count(), 2);
-
- // "dummy.source" has a minimum update interval of 100, so we expect our
- // desired interval to be applied
- m_positionSource->setName("dummy.source");
- QCOMPARE(m_positionSource->updateInterval(), 100);
- QCOMPARE(intervalSpy.count(), 3);
-}
-
-void tst_DeclarativePositionSource::preferredMethodsOnSourceDependency()
-{
- m_positionSource->setName("invalid_source"); // reset the source
-
- QSignalSpy methodsSpy(m_positionSource.get(),
- &QDeclarativePositionSource::preferredPositioningMethodsChanged);
-
- m_positionSource->setPreferredPositioningMethods(
- QDeclarativePositionSource::SatellitePositioningMethods);
- QCOMPARE(m_positionSource->preferredPositioningMethods(),
- QDeclarativePositionSource::SatellitePositioningMethods);
- QCOMPARE(methodsSpy.count(), 1);
-
- // "dummy.source" has only non-satellite methods, so they will be used
- m_positionSource->setName("dummy.source");
- QCOMPARE(m_positionSource->preferredPositioningMethods(),
- QDeclarativePositionSource::NonSatellitePositioningMethods);
- QCOMPARE(methodsSpy.count(), 2);
-
- // "test.source" has all positioning methods, so satellite will be used,
- // as we initially wanted
- m_positionSource->setName("test.source");
- QCOMPARE(m_positionSource->preferredPositioningMethods(),
- QDeclarativePositionSource::SatellitePositioningMethods);
- QCOMPARE(methodsSpy.count(), 3);
-}
-
-void tst_DeclarativePositionSource::updateAfterStart()
-{
- // When update() is called after start(), it should not invalidate any
- // state. The active state must still be true when the single update() is
- // completed.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- m_positionSource->start();
- QCOMPARE(m_positionSource->isActive(), true);
-
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->stop();
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::startAfterUpdate()
-{
- // When start() is called after update(), the position source should remain
- // active even when the signle update is completed.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->start();
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->stop();
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::stopAfterUpdate()
-{
- // When stop() is called after update(), and the update() is still in
- // progress, the position source should remain active until the update()
- // is completed.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->stop();
- QCOMPARE(m_positionSource->isActive(), true);
-
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::startStopAfterUpdate()
-{
- // Quite artificial example. Calling start() and stop() after update(),
- // while still waiting for the update() to complete, should still result in
- // the position source to be active until the update() is completed.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->start();
- m_positionSource->stop();
-
- QCOMPARE(m_positionSource->isActive(), true);
-
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::updateTimedOut()
-{
- // This test checks that we reset to inactive state when the single update()
- // request times out without providing the position info
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- m_positionSource->update(50); // too small timeout -> will return an error
- QCOMPARE(m_positionSource->isActive(), true);
-
- QTRY_COMPARE_WITH_TIMEOUT(m_positionSource->sourceError(),
- QDeclarativePositionSource::UpdateTimeoutError, 5000);
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::updateWithStartTimedOut()
-{
- // This test checks that if single update() times out, but the regular
- // updates are running, we still remain in active state.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- m_positionSource->start();
-
- m_positionSource->update(50); // too small timeout -> will return an error
- QCOMPARE(m_positionSource->isActive(), true);
-
- QTRY_COMPARE_WITH_TIMEOUT(m_positionSource->sourceError(),
- QDeclarativePositionSource::UpdateTimeoutError, 5000);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->stop();
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::startUpdateStopWithNoIntervals()
-{
- // This test checks that a sequence of calls start() -> update() -> stop()
- // without any waits between them will result in expected behavior.
- // Specifically, the position source should remain active until it gets
- // the position response.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- m_positionSource->start();
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
- QCOMPARE(m_positionSource->isActive(), true);
- m_positionSource->stop();
- QCOMPARE(m_positionSource->isActive(), true);
-
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-QTEST_MAIN(tst_DeclarativePositionSource)
-
-#include "tst_qdeclarativepositionsource.moc"
diff --git a/tests/auto/qgeoaddress/CMakeLists.txt b/tests/auto/qgeoaddress/CMakeLists.txt
deleted file mode 100644
index 48969d5f..00000000
--- a/tests/auto/qgeoaddress/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeoaddress.pro.
-
-#####################################################################
-## tst_qgeoaddress Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeoaddress
- SOURCES
- tst_qgeoaddress.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeoaddress.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeoaddress/qgeoaddress.pro b/tests/auto/qgeoaddress/qgeoaddress.pro
deleted file mode 100644
index e12b9e18..00000000
--- a/tests/auto/qgeoaddress/qgeoaddress.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qgeoaddress
-
-SOURCES += tst_qgeoaddress.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeoaddress/tst_qgeoaddress.cpp b/tests/auto/qgeoaddress/tst_qgeoaddress.cpp
deleted file mode 100644
index 0dd06e97..00000000
--- a/tests/auto/qgeoaddress/tst_qgeoaddress.cpp
+++ /dev/null
@@ -1,647 +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 <QtCore/QString>
-#include <QtTest/QtTest>
-
-#include <QtPositioning/qgeoaddress.h>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoAddress : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QGeoAddress();
-
-private Q_SLOTS:
- void constructorTest();
- void moveConstructTest();
- void moveAssignTest();
- void textTest();
- void cityTest();
- void countryCodeTest();
- void countryTest();
- void countyTest();
- void districtTest();
- void postalCodeTest();
- void stateTest();
- void streetTest();
- void streetNumberTest();
- void generatedText();
- void generatedText_data();
- void operatorsTest();
- void emptyClearTest();
- void hashingTest();
- void hashingTest_data();
-};
-
-tst_QGeoAddress::tst_QGeoAddress()
-{
-}
-
-void tst_QGeoAddress::constructorTest()
-{
- QGeoAddress testObj;
-
- testObj.setStreet("testId");
- auto testObjPtr = std::make_unique<QGeoAddress>(testObj);
- QVERIFY2(testObjPtr != NULL, "Copy constructor - null");
- QVERIFY2(*testObjPtr == testObj, "Copy constructor - compare");
-}
-
-void tst_QGeoAddress::moveConstructTest()
-{
- QGeoAddress address;
- address.setCountry("country");
- address.setCity("city");
- address.setPostalCode("postcode");
- address.setStreet("street");
- address.setStreetNumber("number");
-
- const QGeoAddress addressCopy = address;
- QCOMPARE(QGeoAddress(std::move(address)), addressCopy);
-}
-
-void tst_QGeoAddress::moveAssignTest()
-{
- QGeoAddress address;
- address.setCountry("country");
- address.setCity("city");
- address.setPostalCode("postcode");
- address.setStreet("street");
- address.setStreetNumber("number");
-
- QGeoAddress addressCopy = address;
-
- QGeoAddress otherAddress;
- otherAddress = std::move(address);
- QCOMPARE(otherAddress, addressCopy);
-
- // Check that (move)assigning to a moved-from object is fine
- address = std::move(addressCopy);
- QCOMPARE(address, otherAddress);
-}
-
-void tst_QGeoAddress::textTest()
-{
- QGeoAddress address;
- QVERIFY(address.text().isEmpty());
- address.setText(QStringLiteral("123 Fake Street\nSpringfield"));
- QCOMPARE(address.text(), QStringLiteral("123 Fake Street\nSpringfield"));
-}
-
-void tst_QGeoAddress::cityTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.city() == QString(), "Wrong default value");
- testObj.setCity("testText");
- QVERIFY2(testObj.city() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::countryCodeTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.countryCode() == QString(), "Wrong default value");
- testObj.setCountryCode("testText");
- QVERIFY2(testObj.countryCode() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::countryTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.country() == QString(), "Wrong default value");
- testObj.setCountry("testText");
- QVERIFY2(testObj.country() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::countyTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.county() == QString(), "Wrong default value");
- testObj.setCounty("testText");
- QVERIFY2(testObj.county() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::districtTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.district() == QString(), "Wrong default value");
- testObj.setDistrict("testText");
- QVERIFY2(testObj.district() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::postalCodeTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.postalCode() == QString(), "Wrong default value");
- testObj.setPostalCode("testText");
- QVERIFY2(testObj.postalCode() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::stateTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.state() == QString(), "Wrong default value");
- testObj.setState("testText");
- QVERIFY2(testObj.state() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::streetTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.street() == QString(), "Wrong default value");
- testObj.setStreet("testText");
- QVERIFY2(testObj.street() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::streetNumberTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.streetNumber() == QString(), "Wrong default value");
- const auto streetNumber = QStringLiteral("some street number");
- testObj.setStreetNumber(streetNumber);
- QVERIFY2(testObj.streetNumber() == streetNumber, "Wrong value returned");
-}
-
-void tst_QGeoAddress::generatedText()
-{
- QFETCH(QString, countryCode);
- QFETCH(QString, expectedPostalCodeOnly);
- QFETCH(QString, expectedFullAddress);
-
- QGeoAddress streetOnly;
- streetOnly.setStreet("street");
- streetOnly.setCountryCode(countryCode);
-
- QCOMPARE(streetOnly.text(), QStringLiteral("street"));
-
- QGeoAddress cityOnly;
- cityOnly.setCity("city");
- cityOnly.setCountryCode(countryCode);
- if (countryCode == QLatin1String("CYM") || countryCode == QLatin1String("IRL"))
- QCOMPARE(cityOnly.text(), QString());
- else
- QCOMPARE(cityOnly.text(), QStringLiteral("city"));
-
- QGeoAddress postalCodeOnly;
- postalCodeOnly.setPostalCode("postcode");
- postalCodeOnly.setCountryCode(countryCode);
- QCOMPARE(postalCodeOnly.text(), expectedPostalCodeOnly);
-
- QGeoAddress fullAddress;
- fullAddress.setStreet("street");
- fullAddress.setStreetNumber("number");
- fullAddress.setDistrict("district");
- fullAddress.setPostalCode("postcode");
- fullAddress.setCity("city");
- fullAddress.setState("state");
- fullAddress.setCountry("country");
- fullAddress.setCountryCode(countryCode);
-
- QCOMPARE(fullAddress.text(), expectedFullAddress);
-}
-
-void tst_QGeoAddress::generatedText_data()
-{
- QTest::addColumn<QString>("countryCode");
- QTest::addColumn<QString>("expectedPostalCodeOnly");
- QTest::addColumn<QString>("expectedFullAddress");
-
- QTest::newRow("Albania") << QString::fromLatin1("ALB")
- << QString::fromLatin1("postcode") /* postal code only */
- << QString::fromLatin1("street number<br/>" /* full address */
- "postcode, city<br/>"
- "country");
-
- QTest::newRow("Andorra") << QString::fromLatin1("AND")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("United Arab Emirates") << QString::fromLatin1("ARE")
- << QString()
- << QString::fromLatin1("street number<br/>"
- "district city<br/>"
- "country");
- QTest::newRow("Australia") << QString::fromLatin1("AUS")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district state postcode<br/>"
- "country");
- QTest::newRow("Austria") << QString::fromLatin1("AUT")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Bahamas") << QString::fromLatin1("BHS")
- << QString()
- << QString::fromLatin1("street number<br/>"
- "district city<br/>"
- "country");
- QTest::newRow("Bahrain") << QString::fromLatin1("BHR")
- << QString()
- << QString::fromLatin1("street number<br/>"
- "district, city, state<br/>"
- "country");
- QTest::newRow("Brazil") << QString::fromLatin1("BRA")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "district city-state postcode<br/>"
- "country");
- QTest::newRow("Brunei Darussalam") << QString::fromLatin1("BRN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district city postcode<br/>"
- "country");
- QTest::newRow("Canada") << QString::fromLatin1("CAN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "city, state postcode<br/>"
- "country");
- QTest::newRow("China") << QString::fromLatin1("CHN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number, city<br/>"
- "postcode state<br/>"
- "country");
- QTest::newRow("Chile") << QString::fromLatin1("CHL")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode district, city, state<br/>"
- "country");
- QTest::newRow("Cayman Islands") << QString::fromLatin1("CYM")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "state postcode<br/>"
- "country");
- QTest::newRow("France") << QString::fromLatin1("FRA")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "country");
-
- QTest::newRow("United Kingdom") << QString::fromLatin1("GBR")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district, city, postcode<br/>"
- "country");
- QTest::newRow("Gibraltar") << QString::fromLatin1("GIB")
- << QString()
- << QString::fromLatin1("number street<br/>"
- "city<br/>"
- "country");
- QTest::newRow("Guadeloupe") << QString::fromLatin1("GLP")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("French Guiana") << QString::fromLatin1("GUF")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Hong Kong") << QString::fromLatin1("HKG")
- << QString()
- << QString::fromLatin1("number street<br/>"
- "district<br/>"
- "city");
- QTest::newRow("India") << QString::fromLatin1("IND")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "city postcode state<br/>"
- "country");
- QTest::newRow("Indonesia") << QString::fromLatin1("IDN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "city, postcode<br/>"
- "country");
- QTest::newRow("Ireland") << QString::fromLatin1("IRL")
- << QString()
- << QString::fromLatin1("number street<br/>"
- "district, state<br/>"
- "country");
- QTest::newRow("Italy") << QString::fromLatin1("ITA")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Jersey") << QString::fromLatin1("JEY")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "city, postcode<br/>"
- "country");
- QTest::newRow("Jordan") << QString::fromLatin1("JOR")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district city postcode<br/>"
- "country");
- QTest::newRow("Kuwait") << QString::fromLatin1("KWT")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode, district, city<br/>"
- "country");
- QTest::newRow("Latvia") << QString::fromLatin1("LVA")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "city, postcode<br/>"
- "country");
- QTest::newRow("Lebanon") << QString::fromLatin1("LBN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district city postcode<br/>"
- "country");
- QTest::newRow("Luxembourg") << QString::fromLatin1("LUX")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Malta") << QString::fromLatin1("MLT")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "city postcode<br/>"
- "country");
- QTest::newRow("Monaco") << QString::fromLatin1("MCO")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Mexico") << QString::fromLatin1("MEX")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "district<br/>"
- "postcode city, state<br/>"
- "country");
- QTest::newRow("Martinique") << QString::fromLatin1("MTQ")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode, city<br/>"
- "country");
- QTest::newRow("Malaysia") << QString::fromLatin1("MYS")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "state<br/>"
- "country");
- QTest::newRow("New Zealand") << QString::fromLatin1("NZL")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district city postcode<br/>"
- "country");
- QTest::newRow("Oman") << QString::fromLatin1("OMN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district, postcode, city, country");
- QTest::newRow("Puerto Rico") << QString::fromLatin1("PRI")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "district, city, state, postcode<br/>"
- "country");
- QTest::newRow("Qatar") << QString::fromLatin1("QAT")
- << QString()
- << QString::fromLatin1("street number<br/>"
- "district city, country");
- QTest::newRow("Reunion") << QString::fromLatin1("REU")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Russian Federation") << QString::fromLatin1("RUS")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Saudi Arabia") << QString::fromLatin1("SAU")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street district<br/>"
- "city postcode<br/>"
- "country");
- QTest::newRow("Singapore") << QString::fromLatin1("SGP")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "city postcode<br/>"
- "country");
- QTest::newRow("Marino") << QString::fromLatin1("SMR")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Taiwan") << QString::fromLatin1("TWN")
- << QString()
- << QString::fromLatin1("street number, district, city<br/>"
- "country");
- QTest::newRow("Thailand") << QString::fromLatin1("THA")
- << QString("postcode")
- << QString::fromLatin1("street number<br/>"
- "district, city postcode<br/>"
- "country");
- QTest::newRow("Turkey") << QString::fromLatin1("TUR")
- << QString("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode district, city<br/>"
- "country");
- QTest::newRow("Ukraine") << QString::fromLatin1("UKR")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "city postcode<br/>"
- "country");
- QTest::newRow("United States") << QString::fromLatin1("USA")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "city, state postcode<br/>"
- "country");
- QTest::newRow("Virgin Islands, US") << QString::fromLatin1("VIR")
- << QString("postcode")
- << QString::fromLatin1("number street<br/>"
- "city, state postcode<br/>"
- "country");
- QTest::newRow("Vatican City State") << QString::fromLatin1("VAT")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Venezuela") << QString::fromLatin1("VEN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "city postcode, state<br/>"
- "country");
- QTest::newRow("South Africa") << QString::fromLatin1("ZAF")
- << QString()
- << QString::fromLatin1("street number<br/>"
- "district, city<br/>"
- "country");
- QTest::newRow("Finland") << QString::fromLatin1("FIN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
-}
-
-void tst_QGeoAddress::operatorsTest()
-{
- QGeoAddress testObj;
- testObj.setStreet("testValue");
- QGeoAddress testObj2;
- testObj2 = testObj;
- QVERIFY2(testObj == testObj2, "Not copied correctly");
- testObj2.setCountry("testValue2");
- QVERIFY2(testObj != testObj2, "Object should be different");
-}
-
-void tst_QGeoAddress::emptyClearTest()
-{
- QGeoAddress testObj;
- QVERIFY(testObj.isEmpty());
-
- testObj.setCountry(QStringLiteral("country"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setCountryCode(QStringLiteral("countryCode"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setState(QStringLiteral("state"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setCounty(QStringLiteral("county"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setCity(QStringLiteral("city"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setDistrict(QStringLiteral("district"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setPostalCode(QStringLiteral("postalCode"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setStreet(QStringLiteral("street"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setStreetNumber(QStringLiteral("street number"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setText(QStringLiteral("formatted address"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- QVERIFY(testObj.isEmpty());
-}
-
-void tst_QGeoAddress::hashingTest()
-{
- QFETCH(QGeoAddress, leftAddress);
- QFETCH(QGeoAddress, rightAddress);
- QFETCH(bool, result);
-
- const size_t leftHash = qHash(leftAddress);
- const size_t rightHash = qHash(rightAddress);
- QCOMPARE(leftHash == rightHash, result);
-}
-
-void tst_QGeoAddress::hashingTest_data()
-{
- QTest::addColumn<QGeoAddress>("leftAddress");
- QTest::addColumn<QGeoAddress>("rightAddress");
- QTest::addColumn<bool>("result");
-
- QGeoAddress leftAddress;
- QGeoAddress rightAddress;
-
- QTest::newRow("empty") << leftAddress << rightAddress << true;
- // country
- leftAddress.setCountry("country");
- QTest::newRow("different country") << leftAddress << rightAddress << false;
- rightAddress.setCountry("country");
- QTest::newRow("same country") << leftAddress << rightAddress << true;
- // country code
- leftAddress.setCountryCode("country code");
- QTest::newRow("different code") << leftAddress << rightAddress << false;
- rightAddress.setCountryCode("country code");
- QTest::newRow("same code") << leftAddress << rightAddress << true;
- // state
- leftAddress.setState("state");
- QTest::newRow("different state") << leftAddress << rightAddress << false;
- rightAddress.setState("state");
- QTest::newRow("same state") << leftAddress << rightAddress << true;
- // county
- leftAddress.setCounty("county");
- QTest::newRow("different county") << leftAddress << rightAddress << false;
- rightAddress.setCounty("county");
- QTest::newRow("same county") << leftAddress << rightAddress << true;
- // city
- leftAddress.setCity("city");
- QTest::newRow("different city") << leftAddress << rightAddress << false;
- rightAddress.setCity("city");
- QTest::newRow("same city") << leftAddress << rightAddress << true;
- // district
- leftAddress.setDistrict("district");
- QTest::newRow("different district") << leftAddress << rightAddress << false;
- rightAddress.setDistrict("district");
- QTest::newRow("same district") << leftAddress << rightAddress << true;
- // street
- leftAddress.setStreet("street");
- QTest::newRow("different street") << leftAddress << rightAddress << false;
- rightAddress.setStreet("street");
- QTest::newRow("same street") << leftAddress << rightAddress << true;
- // street number
- leftAddress.setStreetNumber("number");
- QTest::newRow("different number") << leftAddress << rightAddress << false;
- rightAddress.setStreetNumber("number");
- QTest::newRow("same number") << leftAddress << rightAddress << true;
- // postal code
- leftAddress.setPostalCode("postal code");
- QTest::newRow("different postcode") << leftAddress << rightAddress << false;
- rightAddress.setPostalCode("postal code");
- QTest::newRow("same postcode") << leftAddress << rightAddress << true;
- // custom text
- leftAddress.setText("some custom text");
- QTest::newRow("different custom text") << leftAddress << rightAddress << false;
- rightAddress.setText("some custom text");
- QTest::newRow("same custom text") << leftAddress << rightAddress << true;
-
- // empty with custom text
- leftAddress.clear();
- leftAddress.setText("some custom text");
- rightAddress.clear();
- QTest::newRow("empty with different custom text") << leftAddress << rightAddress << false;
- rightAddress.setText("some custom text");
- QTest::newRow("empty with same custom text") << leftAddress << rightAddress << true;
-}
-
-QTEST_APPLESS_MAIN(tst_QGeoAddress)
-
-#include "tst_qgeoaddress.moc"
diff --git a/tests/auto/qgeoareamonitor/CMakeLists.txt b/tests/auto/qgeoareamonitor/CMakeLists.txt
deleted file mode 100644
index de39e942..00000000
--- a/tests/auto/qgeoareamonitor/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-# Generated from qgeoareamonitor.pro.
-
-#####################################################################
-## tst_qgeoareamonitor Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeoareamonitor
- SOURCES
- logfilepositionsource.cpp logfilepositionsource.h
- positionconsumerthread.cpp positionconsumerthread.h
- tst_qgeoareamonitor.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeoareamonitor.pro:<TRUE>:
-# OTHER_FILES = "*.txt"
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeoareamonitor/logfilepositionsource.cpp b/tests/auto/qgeoareamonitor/logfilepositionsource.cpp
deleted file mode 100644
index c7cdc93c..00000000
--- a/tests/auto/qgeoareamonitor/logfilepositionsource.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QTimer>
-#include "logfilepositionsource.h"
-
-LogFilePositionSource::LogFilePositionSource(const QList<QByteArray> &data, QObject *parent)
- : QGeoPositionInfoSource(parent),
- timer(new QTimer(this)),
- lines(data)
-{
- connect(timer, SIGNAL(timeout()), this, SLOT(readNextPosition()));
-
- if (lines.isEmpty())
- qWarning() << "Error: the input data is empty!";
- else
- index = 0; // ready to read
-}
-
-QGeoPositionInfo LogFilePositionSource::lastKnownPosition(bool /*fromSatellitePositioningMethodsOnly*/) const
-{
- return lastPosition;
-}
-
-LogFilePositionSource::PositioningMethods LogFilePositionSource::supportedPositioningMethods() const
-{
- return AllPositioningMethods;
-}
-
-int LogFilePositionSource::minimumUpdateInterval() const
-{
- return 50;
-}
-
-void LogFilePositionSource::startUpdates()
-{
- lastError = QGeoPositionInfoSource::NoError;
- int interval = updateInterval();
- if (interval < minimumUpdateInterval())
- interval = minimumUpdateInterval();
-
- if (!timer->isActive()) {
- if (QMetaObject::invokeMethod(timer, "start", Q_ARG(int, interval)))
- emit updatesStarted();
- }
-}
-
-void LogFilePositionSource::stopUpdates()
-{
- if (timer->isActive()) {
- if (QMetaObject::invokeMethod(timer, "stop"))
- emit updatesStopped();
- }
-}
-
-void LogFilePositionSource::requestUpdate(int /*timeout*/)
-{
- // For simplicity, ignore timeout - assume that if data is not available
- // now, no data will be added to the file later
- lastError = QGeoPositionInfoSource::NoError;
- if (canReadLine()) {
- readNextPosition();
- } else {
- lastError = QGeoPositionInfoSource::UpdateTimeoutError;
- emit errorOccurred(lastError);
- }
-}
-
-void LogFilePositionSource::readNextPosition()
-{
- if (canReadLine()) {
- const QByteArray line = lines.at(index);
- if (!line.isEmpty()) {
- QList<QByteArray> data = line.split(' ');
- double latitude;
- double longitude;
- bool hasLatitude = false;
- bool hasLongitude = false;
- QDateTime timestamp = QDateTime::fromString(QString(data.value(0)), Qt::ISODate);
- latitude = data.value(1).toDouble(&hasLatitude);
- longitude = data.value(2).toDouble(&hasLongitude);
-
- if (hasLatitude && hasLongitude && timestamp.isValid()) {
- QGeoCoordinate coordinate(latitude, longitude);
- QGeoPositionInfo info(coordinate, timestamp);
- if (info.isValid()) {
- lastPosition = info;
- emit positionUpdated(info);
- }
- }
- }
- index++;
- } else if (!noDataEmitted) {
- emit noDataLeft();
- noDataEmitted = true;
- }
-}
-
-bool LogFilePositionSource::canReadLine() const
-{
- return (index >= 0) && (index < lines.size());
-}
-
-QGeoPositionInfoSource::Error LogFilePositionSource::error() const
-{
- return lastError;
-}
diff --git a/tests/auto/qgeoareamonitor/logfilepositionsource.h b/tests/auto/qgeoareamonitor/logfilepositionsource.h
deleted file mode 100644
index b175f7e9..00000000
--- a/tests/auto/qgeoareamonitor/logfilepositionsource.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
-
-#ifndef LOGFILEPOSITIONSOURCE_H
-#define LOGFILEPOSITIONSOURCE_H
-
-#include <QtPositioning/qgeopositioninfosource.h>
-
-QT_BEGIN_NAMESPACE
-class QTimer;
-QT_END_NAMESPACE
-
-class LogFilePositionSource : public QGeoPositionInfoSource
-{
- Q_OBJECT
-public:
- // This class is optimized to reduce the file IO.
- // Initially it was reading the file line-by-line.
- // It does not modify the data, so it was optimized to just hold the
- // const reference to the pre-existing data, that can now be read once
- // for all the instances of this class (for example, during the
- // initTestCase() call).
- LogFilePositionSource(const QList<QByteArray> &data, QObject *parent = 0);
-
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override;
-
- PositioningMethods supportedPositioningMethods() const override;
- int minimumUpdateInterval() const override;
- Error error() const override;
-
-signals:
- void noDataLeft();
- void updatesStarted();
- void updatesStopped();
-
-public slots:
- virtual void startUpdates() override;
- virtual void stopUpdates() override;
-
- virtual void requestUpdate(int timeout = 5000) override;
-
-private slots:
- void readNextPosition();
-
-private:
- bool canReadLine() const;
-
- QTimer *timer;
- QGeoPositionInfo lastPosition;
- Error lastError = QGeoPositionInfoSource::NoError;
- const QList<QByteArray> &lines;
- qsizetype index = -1;
- bool noDataEmitted = false;
-};
-
-#endif
diff --git a/tests/auto/qgeoareamonitor/positionconsumerthread.cpp b/tests/auto/qgeoareamonitor/positionconsumerthread.cpp
deleted file mode 100644
index 094e4488..00000000
--- a/tests/auto/qgeoareamonitor/positionconsumerthread.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QSignalSpy>
-#include <QtPositioning/qgeoareamonitorsource.h>
-#include "positionconsumerthread.h"
-
-PositionConsumerThread::PositionConsumerThread(QGeoAreaMonitorSource *source, QObject *parent)
- : QThread(parent), m_source(source)
-{
-}
-
-PositionConsumerThread::~PositionConsumerThread()
-{
- stopProcessing();
- wait();
-}
-
-int PositionConsumerThread::detectedEnterCount() const
-{
- QMutexLocker locker(&m_mutex);
- return m_detectedEnterCount;
-}
-
-int PositionConsumerThread::detectedExitCount() const
-{
- QMutexLocker locker(&m_mutex);
- return m_detectedExitCount;
-}
-
-void PositionConsumerThread::stopProcessing()
-{
- m_mutex.lock();
- m_waitCondition.wakeOne();
- m_mutex.unlock();
-}
-
-void PositionConsumerThread::run()
-{
- QSignalSpy enterSpy(m_source, &QGeoAreaMonitorSource::areaEntered);
- QSignalSpy exitSpy(m_source, &QGeoAreaMonitorSource::areaExited);
-
- m_mutex.lock();
- m_waitCondition.wait(&m_mutex);
- m_detectedEnterCount = enterSpy.count();
- m_detectedExitCount = exitSpy.count();
- m_mutex.unlock();
-}
diff --git a/tests/auto/qgeoareamonitor/positionconsumerthread.h b/tests/auto/qgeoareamonitor/positionconsumerthread.h
deleted file mode 100644
index acf5a933..00000000
--- a/tests/auto/qgeoareamonitor/positionconsumerthread.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
-
-#ifndef POSITIONCONSUMERTHREAD_H
-#define POSITIONCONSUMERTHREAD_H
-
-#include <QThread>
-#include <QMutex>
-#include <QWaitCondition>
-
-QT_BEGIN_NAMESPACE
-class QGeoAreaMonitorSource;
-QT_END_NAMESPACE
-
-// This class is created to test the behavior of QGeoAreaMonitorPolling class,
-// that reimplements the connectNotify() and disconnetNotify() methods, by
-// triggering these methods from multiple threads.
-// The thread creates two QSignalSpy instances, that connect to the signals of
-// QGeoAreaMonitorSource. Once constructed, they trigger connectNotify().
-// Once destroyed, they trigger disconnectNotify.
-// With the previous implementation of these overridden methods, that could lead
-// to a deadlock in a rare case.
-class PositionConsumerThread : public QThread
-{
- Q_OBJECT
-public:
- explicit PositionConsumerThread(QGeoAreaMonitorSource *source, QObject *parent = nullptr);
- ~PositionConsumerThread();
-
- int detectedEnterCount() const;
- int detectedExitCount() const;
-
-public slots:
- void stopProcessing();
-
-protected:
- void run() override;
-
-private:
- QGeoAreaMonitorSource *m_source;
-
- int m_detectedEnterCount = 0;
- int m_detectedExitCount = 0;
-
- mutable QMutex m_mutex;
- QWaitCondition m_waitCondition;
-};
-
-#endif // POSITIONCONSUMERTHREAD_H
diff --git a/tests/auto/qgeoareamonitor/qgeoareamonitor.pro b/tests/auto/qgeoareamonitor/qgeoareamonitor.pro
deleted file mode 100644
index d084df6e..00000000
--- a/tests/auto/qgeoareamonitor/qgeoareamonitor.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-TARGET=tst_qgeoareamonitor
-
-SOURCES += tst_qgeoareamonitor.cpp \
- logfilepositionsource.cpp
-
-HEADERS += logfilepositionsource.h
-
-OTHER_FILES += *.txt
-
-CONFIG -= app_bundle
-
-QT += positioning testlib
diff --git a/tests/auto/qgeoareamonitor/simplelog.txt b/tests/auto/qgeoareamonitor/simplelog.txt
deleted file mode 100644
index 5a14fb80..00000000
--- a/tests/auto/qgeoareamonitor/simplelog.txt
+++ /dev/null
@@ -1,87 +0,0 @@
-2009-08-24T22:24:34 -27.54 153.090718
-2009-08-24T22:24:35 -27.55 153.090718
-2009-08-24T22:24:36 -27.56 153.090718
-2009-08-24T22:24:37 -27.57 153.090718
-2009-08-24T22:24:38 -27.58 153.090783
-2009-08-24T22:24:39 -27.59 153.090845
-2009-08-24T22:24:40 -27.60 153.090908
-2009-08-24T22:24:41 -27.61 153.090971
-2009-08-24T22:24:42 -27.62 153.091036
-2009-08-24T22:24:43 -27.63 153.091102
-2009-08-24T22:24:44 -27.64 153.091167
-2009-08-24T22:24:45 -27.65 153.091232
-2009-08-24T22:24:46 -27.65 153.091298
-2009-08-24T22:24:47 -27.65 153.091366
-2009-08-24T22:24:48 -27.65 153.091435
-2009-08-24T22:24:49 -27.66 153.091507
-2009-08-24T22:24:50 -27.67 153.091581
-2009-08-24T22:24:51 -27.68 153.091654
-2009-08-24T22:24:52 -27.69 153.091729
-2009-08-24T22:24:53 -27.70 153.091800
-2009-08-24T22:24:54 -27.71 153.091870
-2009-08-24T22:24:55 -27.72 153.091940
-2009-08-24T22:24:56 -27.73 153.092010
-2009-08-24T22:24:57 -27.74 153.092078
-2009-08-24T22:24:58 -27.75 153.092144
-2009-08-24T22:24:59 -27.78 153.092218
-2009-08-24T22:25:00 -27.79 153.092308
-2009-08-24T22:25:01 -27.80 153.092415
-2009-08-24T22:25:02 -27.81 153.092530
-2009-08-24T22:25:03 -27.82 153.092648
-2009-08-24T22:25:04 -27.83 153.092763
-2009-08-24T22:25:05 -27.84 153.092879
-2009-08-24T22:25:06 -27.85 153.092990
-2009-08-24T22:25:07 -27.84 153.093099
-2009-08-24T22:25:08 -27.83 153.093204
-2009-08-24T22:25:09 -27.82 153.093303
-2009-08-24T22:25:10 -27.81 153.093396
-2009-08-24T22:25:11 -27.80 153.093484
-2009-08-24T22:25:12 -27.79 153.093568
-2009-08-24T22:25:13 -27.78 153.093647
-2009-08-24T22:25:14 -27.77 153.093727
-2009-08-24T22:25:15 -27.76 153.093810
-2009-08-24T22:25:16 -27.75 153.093896
-2009-08-24T22:25:17 -27.74 153.093984
-2009-08-24T22:25:18 -27.72 153.094074
-2009-08-24T22:25:19 -27.70 153.094168
-2009-08-24T22:25:20 -27.71 153.094267
-2009-08-24T22:25:21 -27.69 153.094370
-2009-08-24T22:25:22 -27.68 153.094474
-2009-08-24T22:25:23 -27.67 153.094581
-2009-08-24T22:25:24 -27.66 153.094688
-2009-08-24T22:25:25 -27.65 153.094796
-2009-08-24T22:25:26 -27.64 153.094905
-2009-08-24T22:25:27 -27.63 153.095012
-2009-08-24T22:25:28 -27.62 153.095121
-2009-08-24T22:25:29 -27.61 153.095231
-2009-08-24T22:25:30 -27.60 153.095340
-2009-08-24T22:25:31 -27.59 153.095449
-2009-08-24T22:25:32 -27.58 153.095558
-2009-08-24T22:25:33 -27.57 153.095667
-2009-08-24T22:25:34 -27.56 153.095776
-2009-08-24T22:25:35 -27.55 153.095885
-2009-08-24T22:25:36 -27.54 153.095995
-2009-08-24T22:25:37 -27.53 153.096109
-2009-08-24T22:25:38 -27.52 153.096226
-2009-08-24T22:25:39 -27.51 153.096337
-2009-08-24T22:25:40 -27.50 153.096441
-2009-08-24T22:25:41 -27.49 153.096537
-2009-08-24T22:25:42 -27.48 153.096628
-2009-08-24T22:25:43 -27.47 153.096714
-2009-08-24T22:25:44 -27.46 153.096795
-2009-08-24T22:25:45 -27.45 153.096847
-2009-08-24T22:25:46 -27.44 153.096855
-2009-08-24T22:25:47 -27.43 153.096873
-2009-08-24T22:25:48 -27.42 153.096875
-2009-08-24T22:25:49 -27.41 153.096878
-2009-08-24T22:25:50 -27.40 153.096880
-2009-08-24T22:25:51 -27.39 153.096880
-2009-08-24T22:25:52 -27.38 153.096881
-2009-08-24T22:25:53 -27.37 153.096882
-2009-08-24T22:25:54 -27.36 153.096883
-2009-08-24T22:25:55 -27.35 153.096883
-2009-08-24T22:25:56 -27.34 153.096883
-2009-08-24T22:25:57 -27.33 153.096890
-2009-08-24T22:25:58 -27.32 153.096919
-2009-08-24T22:25:59 -27.31 153.096985
-2009-08-24T22:26:00 -27.30 153.097060
diff --git a/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp b/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp
deleted file mode 100644
index 77d433fd..00000000
--- a/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp
+++ /dev/null
@@ -1,977 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include <QTest>
-#include <QMetaType>
-#include <QSignalSpy>
-
-#include <limits.h>
-#include <float.h>
-
-#include <QDebug>
-#include <QDataStream>
-#include <QFile>
-
-#include <QtPositioning/qgeoareamonitorinfo.h>
-#include <QtPositioning/qgeoareamonitorsource.h>
-#include <QtPositioning/qgeopositioninfo.h>
-#include <QtPositioning/qgeopositioninfosource.h>
-#include <QtPositioning/qnmeapositioninfosource.h>
-#include <QtPositioning/qgeocircle.h>
-#include <QtPositioning/qgeorectangle.h>
-
-#include "logfilepositionsource.h"
-#include "positionconsumerthread.h"
-
-QT_USE_NAMESPACE
-#define UPDATE_INTERVAL 50
-
-QString tst_qgeoareamonitorinfo_debug;
-
-void tst_qgeoareamonitorinfo_messageHandler(QtMsgType type,
- const QMessageLogContext &,
- const QString &msg)
-{
- switch (type) {
- case QtDebugMsg :
- tst_qgeoareamonitorinfo_debug = msg;
- break;
- default:
- break;
- }
-}
-
-static QList<QByteArray> readFileData(const QString &fileName)
-{
- QList<QByteArray> data;
- QFile logFile(fileName);
- if (logFile.open(QIODevice::ReadOnly)) {
- data = logFile.readAll().split('\n');
- logFile.close();
- } else {
- qWarning() << "Error: cannot open source file" << logFile.fileName();
- }
- return data;
-}
-
-class DummyMonitorSource : public QGeoAreaMonitorSource
-{
- Q_OBJECT
-public:
- static const QString kTestProperty;
-
- DummyMonitorSource(QObject *parent = nullptr) : QGeoAreaMonitorSource(parent)
- {}
-
- Error error() const override
- {
- return NoError;
- }
- AreaMonitorFeatures supportedAreaMonitorFeatures() const override
- {
- return AnyAreaMonitorFeature;
- }
-
- bool startMonitoring(const QGeoAreaMonitorInfo &monitor) override
- {
- Q_UNUSED(monitor);
- return false;
- }
- bool stopMonitoring(const QGeoAreaMonitorInfo &monitor) override
- {
- Q_UNUSED(monitor);
- return false;
- }
- bool requestUpdate(const QGeoAreaMonitorInfo &monitor, const char *signal) override
- {
- Q_UNUSED(monitor);
- Q_UNUSED(signal);
- return false;
- }
-
- QList<QGeoAreaMonitorInfo> activeMonitors() const override
- {
- return {};
- }
- QList<QGeoAreaMonitorInfo> activeMonitors(const QGeoShape &lookupArea) const override
- {
- Q_UNUSED(lookupArea);
- return {};
- }
-
- bool setBackendProperty(const QString &name, const QVariant &value) override
- {
- if (name == kTestProperty) {
- m_testPropertyValue = value.toInt();
- return true;
- }
- return false;
- }
- QVariant backendProperty(const QString &name) const override
- {
- if (name == kTestProperty)
- return m_testPropertyValue;
- return QVariant();
- }
-
-private:
- int m_testPropertyValue = 0;
-};
-
-const QString DummyMonitorSource::kTestProperty = "TestProperty";
-
-class tst_QGeoAreaMonitorSource : public QObject
-{
- Q_OBJECT
-
-private:
- QList<QByteArray> m_fileData;
-
-private slots:
- void initTestCase()
- {
-#if QT_CONFIG(library)
- /*
- * Set custom path since CI doesn't install plugins
- */
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
- + QStringLiteral("/../../../plugins"));
-#endif
-#endif
- qRegisterMetaType<QGeoAreaMonitorInfo>();
- m_fileData = readFileData(QFINDTESTDATA("simplelog.txt"));
- }
-
- void init()
- {
- }
-
- void cleanup()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
-
- QList<QGeoAreaMonitorInfo> list = obj->activeMonitors();
- if (list.count() > 0) {
- //cleanup installed monitors
- foreach (const QGeoAreaMonitorInfo& info, list) {
- QVERIFY(obj->stopMonitoring(info));
- }
- }
- QVERIFY(obj->activeMonitors().count() == 0);
- }
-
- void cleanupTestCase()
- {
- }
-
- void tst_monitor()
- {
- QGeoAreaMonitorInfo defaultMonitor;
- QVERIFY(defaultMonitor.name().isEmpty());
- QVERIFY(!defaultMonitor.identifier().isEmpty());
- QCOMPARE(defaultMonitor.isPersistent(), false);
- QVERIFY(!defaultMonitor.area().isValid());
- QVERIFY(!defaultMonitor.isValid());
- QCOMPARE(defaultMonitor.expiration(), QDateTime());
- QCOMPARE(defaultMonitor.notificationParameters(), QVariantMap());
-
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
- QVERIFY(!obj->startMonitoring(defaultMonitor));
- QCOMPARE(obj->activeMonitors().count(), 0);
- QVERIFY(!obj->requestUpdate(defaultMonitor,
- SIGNAL(areaEntered(QGeoMonitorInfo,QGeoAreaPositionInfo))));
-
- //copy constructor based
- QGeoAreaMonitorInfo copy(defaultMonitor);
- QVERIFY(copy.name().isEmpty());
- QCOMPARE(copy.identifier(), defaultMonitor.identifier());
- QVERIFY(copy == defaultMonitor);
- QVERIFY(!(copy != defaultMonitor));
- QCOMPARE(copy.isPersistent(), false);
-
- copy.setName(QString("my name"));
- QCOMPARE(copy.name(), QString("my name"));
-
-
- QDateTime now = QDateTime::currentDateTime().addSecs(1000); //little bit in the future
- copy.setExpiration(now);
- QVERIFY(copy != defaultMonitor);
- QCOMPARE(copy.expiration(), now);
-
- QCOMPARE(copy.isPersistent(), defaultMonitor.isPersistent());
- copy.setPersistent(true);
- QCOMPARE(copy.isPersistent(), true);
- QCOMPARE(defaultMonitor.isPersistent(), false);
- copy.setPersistent(false);
-
- QVERIFY(copy.area() == defaultMonitor.area());
- QVERIFY(!copy.area().isValid());
- copy.setArea(QGeoCircle(QGeoCoordinate(1, 2), 4));
- QVERIFY(copy.area().isValid());
- QVERIFY(copy.area() != defaultMonitor.area());
- QVERIFY(copy.area().contains(QGeoCoordinate(1, 2)));
-
- QVERIFY(copy.notificationParameters().isEmpty());
- QVariantMap map;
- map.insert(QString("MyKey"), QVariant(123));
- copy.setNotificationParameters(map);
- QVERIFY(!copy.notificationParameters().isEmpty());
- QCOMPARE(copy.notificationParameters().value(QString("MyKey")).toInt(), 123);
- QCOMPARE(defaultMonitor.notificationParameters().value(QString("MyKey")).toInt(), 0);
-
- QCOMPARE(defaultMonitor.identifier(), copy.identifier());
-
- //assignment operator based
- QGeoAreaMonitorInfo assignmentCopy;
- assignmentCopy = copy;
- QVERIFY(copy == assignmentCopy);
- QVERIFY(assignmentCopy != defaultMonitor);
-
- QVERIFY(assignmentCopy.area().contains(QGeoCoordinate(1, 2)));
- QCOMPARE(assignmentCopy.expiration(), now);
- QCOMPARE(assignmentCopy.isPersistent(), false);
- QCOMPARE(assignmentCopy.notificationParameters().value(QString("MyKey")).toInt(), 123);
- QCOMPARE(defaultMonitor.identifier(), assignmentCopy.identifier());
- QCOMPARE(assignmentCopy.name(), QString("my name"));
-
- //validity checks for requestUpdate()
- obj.reset(QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
- QCOMPARE(obj->activeMonitors().count(), 0);
- //reference -> should work
- QVERIFY(obj->requestUpdate(copy, SIGNAL(areaEntered(QGeoAreaMonitorInfo,QGeoPositionInfo))));
- QCOMPARE(obj->activeMonitors().count(), 1);
- //replaces areaEntered single shot
- QVERIFY(obj->requestUpdate(copy, SIGNAL(areaExited(QGeoAreaMonitorInfo,QGeoPositionInfo))));
- QCOMPARE(obj->activeMonitors().count(), 1);
- //replaces areaExited single shot
- QVERIFY(obj->startMonitoring(copy));
- QCOMPARE(obj->activeMonitors().count(), 1);
-
-
- //invalid signal
- QVERIFY(!obj->requestUpdate(copy, 0));
- QCOMPARE(obj->activeMonitors().count(), 1);
-
- //signal that doesn't exist
- QVERIFY(!obj->requestUpdate(copy, SIGNAL(areaEntered(QGeoMonitor))));
- QCOMPARE(obj->activeMonitors().count(), 1);
-
- QVERIFY(!obj->requestUpdate(copy, "SIGNAL(areaEntered(QGeoMonitor))"));
- QCOMPARE(obj->activeMonitors().count(), 1);
-
- //ensure that we cannot add a persistent monitor to a source
- //that doesn't support persistence
- QGeoAreaMonitorInfo persistenceMonitor(copy);
- persistenceMonitor.setPersistent(obj->supportedAreaMonitorFeatures() & QGeoAreaMonitorSource::PersistentAreaMonitorFeature);
- persistenceMonitor.setPersistent(!persistenceMonitor.isPersistent());
-
- QVERIFY(!obj->requestUpdate(persistenceMonitor, SIGNAL(areaEntered(QGeoAreaMonitorInfo,QGeoPositionInfo))));
- QCOMPARE(obj->activeMonitors().count(), 1);
- QVERIFY(!obj->startMonitoring(persistenceMonitor));
- QCOMPARE(obj->activeMonitors().count(), 1);
-
- //ensure that persistence was only reason for rejection
- persistenceMonitor.setPersistent(!persistenceMonitor.isPersistent());
- QVERIFY(obj->startMonitoring(persistenceMonitor));
- //persistenceMonitor is copy of already added monitor
- //the last call was an update
- QCOMPARE(obj->activeMonitors().count(), 1);
- }
-
- void tst_monitor_move_semantics()
- {
- QGeoAreaMonitorInfo info1("test");
- info1.setArea(QGeoCircle(QGeoCoordinate(1.0, 1.0), 100));
- info1.setExpiration(QDateTime::currentDateTimeUtc());
- QGeoAreaMonitorInfo infoCopy(info1);
-
- QGeoAreaMonitorInfo info2(std::move(info1));
- QCOMPARE(info2, infoCopy);
-
- QGeoAreaMonitorInfo info3;
- info3.setName("name");
- info3.setArea(QGeoRectangle(QGeoCoordinate(1, 2), QGeoCoordinate(2, 1)));
- info3.setPersistent(true);
- infoCopy = info3;
-
- // check that (move)assigning to the moved-from object is ok
- info1 = std::move(info3);
- QCOMPARE(info1, infoCopy);
-
- // The moved-from object info3 will go out of scope and will be
- // destroyed here, so we also implicitly check that moved-from object's
- // destructor is called without any issues.
- }
-
- void tst_monitorValid()
- {
- QGeoAreaMonitorInfo mon;
- QVERIFY(!mon.isValid());
- QCOMPARE(mon.name(), QString());
- QCOMPARE(mon.area().isValid(), false);
-
- QGeoAreaMonitorInfo mon2 = mon;
- QVERIFY(!mon2.isValid());
-
- QGeoShape invalidShape;
- QGeoCircle emptyCircle(QGeoCoordinate(0,1), 0);
- QGeoCircle validCircle(QGeoCoordinate(0,1), 1);
-
- //all invalid since no name set yet
- mon2.setArea(invalidShape);
- QVERIFY(mon2.area() == invalidShape);
- QVERIFY(!mon2.isValid());
-
- mon2.setArea(emptyCircle);
- QVERIFY(mon2.area() == emptyCircle);
- QVERIFY(!mon2.isValid());
-
- mon2.setArea(validCircle);
- QVERIFY(mon2.area() == validCircle);
- QVERIFY(!mon2.isValid());
-
- //valid since name and non-empy shape has been set
- QGeoAreaMonitorInfo validMonitor("TestMonitor");
- QVERIFY(validMonitor.name() == QString("TestMonitor"));
- QVERIFY(!validMonitor.isValid());
-
- validMonitor.setArea(invalidShape);
- QVERIFY(validMonitor.area() == invalidShape);
- QVERIFY(!validMonitor.isValid());
-
- validMonitor.setArea(emptyCircle);
- QVERIFY(validMonitor.area() == emptyCircle);
- QVERIFY(!validMonitor.isValid());
-
- validMonitor.setArea(validCircle);
- QVERIFY(validCircle == validMonitor.area());
- QVERIFY(validMonitor.isValid());
- }
-
- void tst_monitorStreaming()
- {
- QByteArray container;
- QDataStream stream(&container, QIODevice::ReadWrite);
-
- QGeoAreaMonitorInfo monitor("someName");
- monitor.setArea(QGeoCircle(QGeoCoordinate(1,3), 5.4));
- const QDateTime expirationTime = QDateTime::currentDateTime().addSecs(60);
- monitor.setExpiration(expirationTime);
- monitor.setPersistent(true);
- const QVariantMap params { {"string_param", "some string"},
- {"int_param", 1}, {"double_param", 3.5} };
- monitor.setNotificationParameters(params);
- QVERIFY(monitor.isValid());
- QCOMPARE(monitor.name(), QString("someName"));
- QCOMPARE(monitor.expiration(), expirationTime);
- QVERIFY(monitor.isPersistent());
- QCOMPARE(monitor.notificationParameters(), params);
-
- QGeoAreaMonitorInfo target;
- QVERIFY(!target.isValid());
- QVERIFY(target.name().isEmpty());
-
- QVERIFY(target != monitor);
-
- stream << monitor;
- stream.device()->seek(0);
- stream >> target;
-
- QVERIFY(target == monitor);
- QVERIFY(target.isValid());
- QCOMPARE(target.name(), QString("someName"));
- QVERIFY(target.area() == QGeoCircle(QGeoCoordinate(1,3), 5.4));
- QCOMPARE(target.expiration(), expirationTime);
- QVERIFY(target.isPersistent());
- QCOMPARE(target.notificationParameters(), params);
- }
-
- void tst_createDefaultSource()
- {
- std::unique_ptr<QObject> parent(new QObject);
-
- // Have to use a raw pointer here, because otherwise we'd end up
- // deleting the obj twice when deleting the parent
- QGeoAreaMonitorSource *obj = QGeoAreaMonitorSource::createDefaultSource(parent.get());
- QVERIFY(obj != nullptr);
- QVERIFY(obj->parent() == parent.get());
- delete obj;
-
- const QStringList monitors = QGeoAreaMonitorSource::availableSources();
- QVERIFY(!monitors.isEmpty());
- QVERIFY(monitors.contains(QStringLiteral("positionpoll")));
-
- obj = QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), parent.get());
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
- parent.reset();
-
- // using a smart pointer will cause a double delete here
- obj = QGeoAreaMonitorSource::createSource(QStringLiteral("randomNonExistingName"), 0);
- QVERIFY(obj == nullptr);
- }
-
- void tst_activeMonitors()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
-
- // using this -> no need for smart pointer
- LogFilePositionSource *source = new LogFilePositionSource(m_fileData, this);
- source->setUpdateInterval(UPDATE_INTERVAL);
- obj->setPositionInfoSource(source);
- QCOMPARE(obj->positionInfoSource(), source);
-
-
- QVERIFY(obj->activeMonitors().isEmpty());
-
- QGeoAreaMonitorInfo mon("Monitor_Circle");
- mon.setArea(QGeoCircle(QGeoCoordinate(1,1), 1000));
- QVERIFY(obj->startMonitoring(mon));
-
- QGeoAreaMonitorInfo mon2("Monitor_rectangle_below");
- QGeoRectangle r_below(QGeoCoordinate(1,1),2,2);
- mon2.setArea(r_below);
- QVERIFY(obj->startMonitoring(mon2));
-
- QGeoAreaMonitorInfo mon3("Monitor_rectangle_above");
- QGeoRectangle r_above(QGeoCoordinate(2,1),2,2);
- mon3.setArea(r_above);
- QVERIFY(obj->startMonitoring(mon3));
-
- QList<QGeoAreaMonitorInfo> results = obj->activeMonitors();
- QCOMPARE(results.count(), 3);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2 || info == mon3);
- }
-
- results = obj->activeMonitors(QGeoShape());
- QCOMPARE(results.count(), 0);
-
- results = obj->activeMonitors(QGeoRectangle(QGeoCoordinate(1,1),0.2, 0.2));
- QCOMPARE(results.count(), 2);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2);
- }
-
- results = obj->activeMonitors(QGeoCircle(QGeoCoordinate(1,1),1000));
- QCOMPARE(results.count(), 2);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2);
- }
-
- results = obj->activeMonitors(QGeoCircle(QGeoCoordinate(2,1),1000));
- QCOMPARE(results.count(), 1);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon3);
- }
-
- //same as above except that we use a different monitor source object instance
- //all monitor objects of same type share same active monitors
- std::unique_ptr<QGeoAreaMonitorSource> secondObj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(secondObj != nullptr);
- QCOMPARE(secondObj->sourceName(), QStringLiteral("positionpoll"));
-
- results = secondObj->activeMonitors();
- QCOMPARE(results.count(), 3);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2 || info == mon3);
- }
-
- results = secondObj->activeMonitors(QGeoShape());
- QCOMPARE(results.count(), 0);
-
- results = secondObj->activeMonitors(QGeoRectangle(QGeoCoordinate(1,1),0.2, 0.2));
- QCOMPARE(results.count(), 2);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2);
- }
-
- results = secondObj->activeMonitors(QGeoCircle(QGeoCoordinate(1,1),1000));
- QCOMPARE(results.count(), 2);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2);
- }
-
- results = secondObj->activeMonitors(QGeoCircle(QGeoCoordinate(2,1),1000));
- QCOMPARE(results.count(), 1);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon3);
- }
- }
-
- void tst_testExpiryTimeout()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
-
- std::unique_ptr<QGeoAreaMonitorSource> secondObj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(secondObj != nullptr);
- QCOMPARE(secondObj->sourceName(), QStringLiteral("positionpoll"));
-
- // using this -> no need for smart pointer
- LogFilePositionSource *source = new LogFilePositionSource(m_fileData, this);
- source->setUpdateInterval(UPDATE_INTERVAL);
- obj->setPositionInfoSource(source);
-
- //Singleton pattern behind QGeoAreaMonitorSource ensures same position info source
- QCOMPARE(obj->positionInfoSource(), source);
- QCOMPARE(secondObj->positionInfoSource(), source);
-
- QSignalSpy expirySpy(obj.get(), SIGNAL(monitorExpired(QGeoAreaMonitorInfo)));
- QSignalSpy expirySpy2(secondObj.get(), SIGNAL(monitorExpired(QGeoAreaMonitorInfo)));
-
- QDateTime now = QDateTime::currentDateTime();
-
- const int monitorCount = 4;
- for (int i = 1; i <= monitorCount; i++) {
- QGeoAreaMonitorInfo mon(QString::number(i));
- mon.setArea(QGeoRectangle(QGeoCoordinate(i,i), i, i));
- mon.setExpiration(now.addSecs(i*2));
- QVERIFY(mon.isValid());
- QVERIFY(obj->startMonitoring(mon));
- }
-
-
-
- QCOMPARE(obj->activeMonitors().count(), monitorCount);
- QCOMPARE(secondObj->activeMonitors().count(), monitorCount);
-
- QGeoAreaMonitorInfo info("InvalidExpiry");
- info.setArea(QGeoRectangle(QGeoCoordinate(10,10), 1, 1 ));
- QVERIFY(info.isValid());
- info.setExpiration(now.addSecs(-1000));
- QVERIFY(info.expiration() < now);
- QVERIFY(!obj->startMonitoring(info));
- QCOMPARE(obj->activeMonitors().count(), monitorCount);
- QVERIFY(!obj->requestUpdate(info, SIGNAL(areaEntered(QGeoAreaMonitorInfo,QGeoPositionInfo))));
- QCOMPARE(obj->activeMonitors().count(), monitorCount);
-
- for (int i = 1; i <= monitorCount; i++) {
- QTRY_VERIFY_WITH_TIMEOUT(expirySpy.count() == 1, 3000); //each expiry within 2 s
- QGeoAreaMonitorInfo mon = expirySpy.takeFirst().at(0).value<QGeoAreaMonitorInfo>();
- QCOMPARE(obj->activeMonitors().count(), monitorCount-i);
- QCOMPARE(mon.name(), QString::number(i));
- }
-
- QCOMPARE(expirySpy2.count(), monitorCount);
- QCOMPARE(secondObj->activeMonitors().count(), 0); //all monitors expired
- for (int i = 1; i <= monitorCount; i++) {
- QGeoAreaMonitorInfo mon = expirySpy2.takeFirst().at(0).value<QGeoAreaMonitorInfo>();
- QCOMPARE(mon.name(), QString::number(i));
- }
- }
-
- void tst_enteredExitedSignal()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
- obj->setObjectName("firstObject");
- QSignalSpy enteredSpy(obj.get(),
- SIGNAL(areaEntered(QGeoAreaMonitorInfo, QGeoPositionInfo)));
- QSignalSpy exitedSpy(obj.get(), SIGNAL(areaExited(QGeoAreaMonitorInfo, QGeoPositionInfo)));
-
- // using this -> no need for smart pointer
- LogFilePositionSource *source = new LogFilePositionSource(m_fileData, this);
- source->setUpdateInterval(UPDATE_INTERVAL);
- obj->setPositionInfoSource(source);
- QCOMPARE(obj->positionInfoSource(), source);
-
- std::unique_ptr<QGeoAreaMonitorSource> secondObj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(secondObj != nullptr);
- QCOMPARE(secondObj->sourceName(), QStringLiteral("positionpoll"));
- QSignalSpy enteredSpy2(secondObj.get(),
- SIGNAL(areaEntered(QGeoAreaMonitorInfo, QGeoPositionInfo)));
- QSignalSpy exitedSpy2(secondObj.get(),
- SIGNAL(areaExited(QGeoAreaMonitorInfo, QGeoPositionInfo)));
- secondObj->setObjectName("secondObject");
-
- QGeoAreaMonitorInfo infoRectangle("Rectangle");
- infoRectangle.setArea(QGeoRectangle(QGeoCoordinate(-27.65, 153.093), 0.2, 0.2));
- QVERIFY(infoRectangle.isValid());
- QVERIFY(obj->startMonitoring(infoRectangle));
-
- QGeoAreaMonitorInfo infoCircle("Circle");
- infoCircle.setArea(QGeoCircle(QGeoCoordinate(-27.70, 153.093),10000));
- QVERIFY(infoCircle.isValid());
- QVERIFY(obj->startMonitoring(infoCircle));
-
- QGeoAreaMonitorInfo singleShot_enter("SingleShot_on_Entered");
- singleShot_enter.setArea(QGeoRectangle(QGeoCoordinate(-27.67, 153.093), 0.2, 0.2));
- QVERIFY(singleShot_enter.isValid());
- QVERIFY(obj->requestUpdate(singleShot_enter,
- SIGNAL(areaEntered(QGeoAreaMonitorInfo,QGeoPositionInfo))));
-
- QGeoAreaMonitorInfo singleShot_exit("SingleShot_on_Exited");
- singleShot_exit.setArea(QGeoRectangle(QGeoCoordinate(-27.70, 153.093), 0.2, 0.2));
- QVERIFY(singleShot_exit.isValid());
- QVERIFY(obj->requestUpdate(singleShot_exit,
- SIGNAL(areaExited(QGeoAreaMonitorInfo,QGeoPositionInfo))));
-
- QVERIFY(obj->activeMonitors().count() == 4); //all monitors active
- QVERIFY(secondObj->activeMonitors().count() == 4); //all monitors active
-
- static const int Number_Of_Entered_Events = 6;
- static const int Number_Of_Exited_Events = 5;
- //takes 87 (lines)*50(timeout)/1000 seconds to finish
- QTRY_VERIFY_WITH_TIMEOUT(enteredSpy.count() == Number_Of_Entered_Events, 5000);
- QTRY_VERIFY_WITH_TIMEOUT(exitedSpy.count() == Number_Of_Exited_Events, 5000);
- QCOMPARE(enteredSpy.count(), Number_Of_Entered_Events);
- QCOMPARE(exitedSpy.count(), Number_Of_Exited_Events);
-
- QList<QGeoAreaMonitorInfo> monitorsInExpectedEnteredEventOrder;
- monitorsInExpectedEnteredEventOrder << infoRectangle << singleShot_enter << singleShot_exit
- << infoCircle << infoCircle << infoRectangle;
-
- QList<QGeoAreaMonitorInfo> monitorsInExpectedExitedEventOrder;
- monitorsInExpectedExitedEventOrder << infoRectangle << infoCircle
- << singleShot_exit << infoCircle << infoRectangle;
-
- QList<QGeoCoordinate> enteredEventCoordinateOrder;
- enteredEventCoordinateOrder << QGeoCoordinate(-27.55, 153.090718) //infoRectangle
- << QGeoCoordinate(-27.57, 153.090718) //singleshot_enter
- << QGeoCoordinate(-27.60, 153.090908) //singleshot_exit
- << QGeoCoordinate(-27.62, 153.091036) //infoCircle
- << QGeoCoordinate(-27.78, 153.093647) //infoCircle
- << QGeoCoordinate(-27.75, 153.093896);//infoRectangle
- QCOMPARE(enteredEventCoordinateOrder.count(), Number_Of_Entered_Events);
- QCOMPARE(monitorsInExpectedEnteredEventOrder.count(), Number_Of_Entered_Events);
-
- QList<QGeoCoordinate> exitedEventCoordinateOrder;
- exitedEventCoordinateOrder << QGeoCoordinate(-27.78, 153.092218) //infoRectangle
- << QGeoCoordinate(-27.79, 153.092308) //infoCircle
- << QGeoCoordinate(-27.81, 153.092530) //singleshot_exit
- << QGeoCoordinate(-27.61, 153.095231) //infoCircle
- << QGeoCoordinate(-27.54, 153.095995);//infoCircle
- QCOMPARE(exitedEventCoordinateOrder.count(), Number_Of_Exited_Events);
- QCOMPARE(monitorsInExpectedExitedEventOrder.count(), Number_Of_Exited_Events);
-
- //verify that both sources got the same signals
- for (int i = 0; i < Number_Of_Entered_Events; i++) {
- //first source
- QGeoAreaMonitorInfo monInfo = enteredSpy.first().at(0).value<QGeoAreaMonitorInfo>();
- QGeoPositionInfo posInfo = enteredSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY2(monInfo == monitorsInExpectedEnteredEventOrder.at(i),
- qPrintable(QString::number(i) + ": " + monInfo.name()));
- QVERIFY2(posInfo.coordinate() == enteredEventCoordinateOrder.at(i),
- qPrintable(QString::number(i) + ". posInfo"));
-
- //reset info objects to avoid comparing the same
- monInfo = QGeoAreaMonitorInfo();
- posInfo = QGeoPositionInfo();
-
- //second source
- monInfo = enteredSpy2.first().at(0).value<QGeoAreaMonitorInfo>();
- posInfo = enteredSpy2.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY2(monInfo == monitorsInExpectedEnteredEventOrder.at(i),
- qPrintable(QString::number(i) + ": " + monInfo.name()));
- QVERIFY2(posInfo.coordinate() == enteredEventCoordinateOrder.at(i),
- qPrintable(QString::number(i) + ". posInfo"));
- }
-
- for (int i = 0; i < Number_Of_Exited_Events; i++) {
- //first source
- QGeoAreaMonitorInfo monInfo = exitedSpy.first().at(0).value<QGeoAreaMonitorInfo>();
- QGeoPositionInfo posInfo = exitedSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY2(monInfo == monitorsInExpectedExitedEventOrder.at(i),
- qPrintable(QString::number(i) + ": " + monInfo.name()));
- QVERIFY2(posInfo.coordinate() == exitedEventCoordinateOrder.at(i),
- qPrintable(QString::number(i) + ". posInfo"));
-
- //reset info objects to avoid comparing the same
- monInfo = QGeoAreaMonitorInfo();
- posInfo = QGeoPositionInfo();
-
- //second source
- monInfo = exitedSpy2.first().at(0).value<QGeoAreaMonitorInfo>();
- posInfo = exitedSpy2.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY2(monInfo == monitorsInExpectedExitedEventOrder.at(i),
- qPrintable(QString::number(i) + ": " + monInfo.name()));
- QVERIFY2(posInfo.coordinate() == exitedEventCoordinateOrder.at(i),
- qPrintable(QString::number(i) + ". posInfo"));
- }
-
- QCOMPARE(obj->activeMonitors().count(), 2); //single shot monitors have been removed
- QCOMPARE(secondObj->activeMonitors().count(), 2);
- }
-
- void tst_swapOfPositionSource()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
- obj->setObjectName("firstObject");
- QSignalSpy enteredSpy(obj.get(),
- SIGNAL(areaEntered(QGeoAreaMonitorInfo, QGeoPositionInfo)));
- QSignalSpy exitedSpy(obj.get(), SIGNAL(areaExited(QGeoAreaMonitorInfo, QGeoPositionInfo)));
-
- std::unique_ptr<QGeoAreaMonitorSource> obj2(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj2 != nullptr);
- QCOMPARE(obj2->sourceName(), QStringLiteral("positionpoll"));
- obj2->setObjectName("secondObject");
- QSignalSpy enteredSpy2(obj2.get(),
- SIGNAL(areaEntered(QGeoAreaMonitorInfo, QGeoPositionInfo)));
- QSignalSpy exitedSpy2(obj2.get(),
- SIGNAL(areaExited(QGeoAreaMonitorInfo, QGeoPositionInfo)));
-
- // using this -> no need for smart pointer
- LogFilePositionSource *source = new LogFilePositionSource(m_fileData, this);
- source->setUpdateInterval(UPDATE_INTERVAL);
- source->setObjectName("FirstLogFileSource");
-
- // using this -> no need for smart pointer
- LogFilePositionSource *source2 = new LogFilePositionSource(m_fileData, this);
- source2->setUpdateInterval(UPDATE_INTERVAL);
- source2->setObjectName("SecondLogFileSource");
-
- obj->setPositionInfoSource(source);
- QCOMPARE(obj->positionInfoSource(), obj2->positionInfoSource());
- QCOMPARE(obj2->positionInfoSource(), source);
-
- QGeoAreaMonitorInfo infoRectangle("Rectangle");
- infoRectangle.setArea(QGeoRectangle(QGeoCoordinate(-27.70, 153.092), 0.2, 0.2));
- QVERIFY(infoRectangle.isValid());
- QVERIFY(obj->startMonitoring(infoRectangle));
-
- QCOMPARE(obj->activeMonitors().count(), 1);
- QCOMPARE(obj2->activeMonitors().count(), 1);
-
- QGeoCoordinate firstBorder(-27.6, 153.090908);
- QGeoCoordinate secondBorder(-27.81, 153.092530);
-
- /***********************************/
- //1. trigger events on source (until areaExit
- QTRY_VERIFY_WITH_TIMEOUT(exitedSpy.count() == 1, 5000);
- QCOMPARE(enteredSpy.count(), enteredSpy2.count());
- QCOMPARE(exitedSpy.count(), exitedSpy2.count());
-
- //compare entered event
- QVERIFY(enteredSpy.first().at(0).value<QGeoAreaMonitorInfo>() ==
- enteredSpy2.first().at(0).value<QGeoAreaMonitorInfo>());
- QGeoPositionInfo info = enteredSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY(info == enteredSpy2.takeFirst().at(1).value<QGeoPositionInfo>());
- QVERIFY(info.coordinate() == firstBorder);
- //compare exit event
- QVERIFY(exitedSpy.first().at(0).value<QGeoAreaMonitorInfo>() ==
- exitedSpy2.first().at(0).value<QGeoAreaMonitorInfo>());
- info = exitedSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY(info == exitedSpy2.takeFirst().at(1).value<QGeoPositionInfo>());
- QVERIFY(info.coordinate() == secondBorder);
-
- QCOMPARE(exitedSpy.count(), 0);
- QCOMPARE(enteredSpy.count(), 0);
- QCOMPARE(exitedSpy2.count(), 0);
- QCOMPARE(enteredSpy2.count(), 0);
-
- /***********************************/
- //2. change position source -> which restarts at beginning again
- obj2->setPositionInfoSource(source2);
- QCOMPARE(obj->positionInfoSource(), obj2->positionInfoSource());
- QCOMPARE(obj2->positionInfoSource(), source2);
-
- QTRY_VERIFY_WITH_TIMEOUT(exitedSpy.count() == 1, 5000);
- QCOMPARE(enteredSpy.count(), enteredSpy2.count());
- QCOMPARE(exitedSpy.count(), exitedSpy2.count());
-
- //compare entered event
- QVERIFY(enteredSpy.first().at(0).value<QGeoAreaMonitorInfo>() ==
- enteredSpy2.first().at(0).value<QGeoAreaMonitorInfo>());
- info = enteredSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY(info == enteredSpy2.takeFirst().at(1).value<QGeoPositionInfo>());
- QVERIFY(info.coordinate() == firstBorder);
- //compare exit event
- QVERIFY(exitedSpy.first().at(0).value<QGeoAreaMonitorInfo>() ==
- exitedSpy2.first().at(0).value<QGeoAreaMonitorInfo>());
- info = exitedSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY(info == exitedSpy2.takeFirst().at(1).value<QGeoPositionInfo>());
- QVERIFY(info.coordinate() == secondBorder);
- }
-
- void debug_data()
- {
- QTest::addColumn<QGeoAreaMonitorInfo>("info");
- QTest::addColumn<int>("nextValue");
- QTest::addColumn<QString>("debugString");
-
- QGeoAreaMonitorInfo info;
- QTest::newRow("uninitialized") << info << 45
- << QString("QGeoAreaMonitorInfo(\"\", QGeoShape(Unknown), "
- "persistent: false, expiry: QDateTime(Invalid)) 45");
-
- info.setArea(QGeoRectangle());
- info.setPersistent(true);
- info.setName("RectangleAreaMonitor");
- QTest::newRow("Rectangle Test") << info << 45
- << QString("QGeoAreaMonitorInfo(\"RectangleAreaMonitor\", QGeoShape(Rectangle), "
- "persistent: true, expiry: QDateTime(Invalid)) 45");
-
- info = QGeoAreaMonitorInfo();
- info.setArea(QGeoCircle());
- info.setPersistent(false);
- info.setName("CircleAreaMonitor");
- QVariantMap map;
- map.insert(QString("foobarKey"), QVariant(45)); //should be ignored
- info.setNotificationParameters(map);
- QTest::newRow("Circle Test") << info << 45
- << QString("QGeoAreaMonitorInfo(\"CircleAreaMonitor\", QGeoShape(Circle), "
- "persistent: false, expiry: QDateTime(Invalid)) 45");
-
- // we ignore any further QDateTime related changes to avoid depending on QDateTime related
- // failures in case its QDebug string changes
- }
-
- void debug()
- {
- QFETCH(QGeoAreaMonitorInfo, info);
- QFETCH(int, nextValue);
- QFETCH(QString, debugString);
-
- qInstallMessageHandler(tst_qgeoareamonitorinfo_messageHandler);
- qDebug() << info << nextValue;
- qInstallMessageHandler(0);
- QCOMPARE(tst_qgeoareamonitorinfo_debug, debugString);
- }
-
- void multipleThreads()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
-
- QVERIFY(obj->activeMonitors().isEmpty());
-
- LogFilePositionSource *source = new LogFilePositionSource(m_fileData, this);
- source->setUpdateInterval(UPDATE_INTERVAL);
- obj->setPositionInfoSource(source);
- QCOMPARE(obj->positionInfoSource(), source);
-
- QSignalSpy noDataSpy(source, &LogFilePositionSource::noDataLeft);
- QSignalSpy updatesStartedSpy(source, &LogFilePositionSource::updatesStarted);
- QSignalSpy updatesStoppedSpy(source, &LogFilePositionSource::updatesStopped);
-
- // generate threads
- const int threadCount = 10;
- QList<PositionConsumerThread *> threads;
- for (int i = 0; i < threadCount; ++i) {
- auto threadObj = new PositionConsumerThread(obj.get(), this);
- threadObj->start();
- threads.push_back(threadObj);
- }
-
- // generate objects to monitor
- QGeoAreaMonitorInfo infoRectangle("Rectangle");
- infoRectangle.setArea(QGeoRectangle(QGeoCoordinate(-27.65, 153.093), 0.2, 0.2));
- QVERIFY(infoRectangle.isValid());
- QVERIFY(obj->startMonitoring(infoRectangle));
-
- QGeoAreaMonitorInfo infoCircle("Circle");
- infoCircle.setArea(QGeoCircle(QGeoCoordinate(-27.70, 153.093), 10000));
- QVERIFY(infoCircle.isValid());
- QVERIFY(obj->startMonitoring(infoCircle));
-
- QGeoAreaMonitorInfo singleShot_enter("SingleShot_on_Entered");
- singleShot_enter.setArea(QGeoRectangle(QGeoCoordinate(-27.67, 153.093), 0.2, 0.2));
- QVERIFY(singleShot_enter.isValid());
- QVERIFY(obj->requestUpdate(singleShot_enter,
- SIGNAL(areaEntered(QGeoAreaMonitorInfo, QGeoPositionInfo))));
-
- QGeoAreaMonitorInfo singleShot_exit("SingleShot_on_Exited");
- singleShot_exit.setArea(QGeoRectangle(QGeoCoordinate(-27.70, 153.093), 0.2, 0.2));
- QVERIFY(singleShot_exit.isValid());
- QVERIFY(obj->requestUpdate(singleShot_exit,
- SIGNAL(areaExited(QGeoAreaMonitorInfo, QGeoPositionInfo))));
-
- // wait until we read all data
- QTRY_COMPARE_WITH_TIMEOUT(noDataSpy.count(), 1, 5000);
-
- // first request all the threads to terminate
- for (int i = 0; i < threadCount; ++i)
- threads[i]->stopProcessing();
-
- static const int Number_Of_Entered_Events = 6;
- static const int Number_Of_Exited_Events = 5;
- // wait until each thread is stopped, and compare the result values
- for (int i = 0; i < threadCount; ++i) {
- threads[i]->wait();
- QCOMPARE(threads[i]->detectedEnterCount(), Number_Of_Entered_Events);
- QCOMPARE(threads[i]->detectedExitCount(), Number_Of_Exited_Events);
- }
-
- // Verify that the source started and stopped updates only once.
- // This is needed to check that the connection tracking logic in
- // connectNotify()/disconnectNotify() is working properly.
- QCOMPARE(updatesStartedSpy.count(), 1);
- QCOMPARE(updatesStoppedSpy.count(), 1);
- }
-
- void backendProperties()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj = std::make_unique<DummyMonitorSource>();
-
- const QString invalidProperty = "SomePropertyName";
-
- QCOMPARE(obj->backendProperty(DummyMonitorSource::kTestProperty), 0);
- QCOMPARE(obj->backendProperty(invalidProperty), QVariant());
-
- QVERIFY(obj->setBackendProperty(DummyMonitorSource::kTestProperty, 10));
- QVERIFY(!obj->setBackendProperty(invalidProperty, 15));
-
- QCOMPARE(obj->backendProperty(DummyMonitorSource::kTestProperty), 10);
- QCOMPARE(obj->backendProperty(invalidProperty), QVariant());
- }
-};
-
-
-QTEST_GUILESS_MAIN(tst_QGeoAreaMonitorSource)
-#include "tst_qgeoareamonitor.moc"
diff --git a/tests/auto/qgeocircle/CMakeLists.txt b/tests/auto/qgeocircle/CMakeLists.txt
deleted file mode 100644
index 18b1266b..00000000
--- a/tests/auto/qgeocircle/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeocircle.pro.
-
-#####################################################################
-## tst_qgeocircle Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeocircle
- SOURCES
- tst_qgeocircle.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeocircle.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeocircle/qgeocircle.pro b/tests/auto/qgeocircle/qgeocircle.pro
deleted file mode 100644
index eb56a7fc..00000000
--- a/tests/auto/qgeocircle/qgeocircle.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qgeocircle
-
-SOURCES += \
- tst_qgeocircle.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeocircle/tst_qgeocircle.cpp b/tests/auto/qgeocircle/tst_qgeocircle.cpp
deleted file mode 100644
index f3ff436f..00000000
--- a/tests/auto/qgeocircle/tst_qgeocircle.cpp
+++ /dev/null
@@ -1,473 +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 <QtTest/QtTest>
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoRectangle>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoCircle : public QObject
-{
- Q_OBJECT
-
-private slots:
- void defaultConstructor();
- void centerRadiusConstructor();
- void assignment();
-
- void comparison();
- void type();
-
- void radius();
- void center();
-
- void translate_data();
- void translate();
-
- void valid_data();
- void valid();
-
- void empty_data();
- void empty();
-
- void contains_data();
- void contains();
-
- void boundingGeoRectangle_data();
- void boundingGeoRectangle();
-
- void extendCircle();
- void extendCircle_data();
-
- void areaComparison();
- void areaComparison_data();
-
- void boxComparison();
- void boxComparison_data();
-
- void hashing();
-};
-
-void tst_QGeoCircle::defaultConstructor()
-{
- QGeoCircle c;
- QVERIFY(!c.center().isValid());
- QCOMPARE(c.radius(), qreal(-1.0));
-}
-
-void tst_QGeoCircle::centerRadiusConstructor()
-{
- QGeoCircle c(QGeoCoordinate(1,1), qreal(50.0));
- QCOMPARE(c.center(), QGeoCoordinate(1,1));
- QCOMPARE(c.radius(), qreal(50.0));
-}
-
-void tst_QGeoCircle::assignment()
-{
- QGeoCircle c1 = QGeoCircle(QGeoCoordinate(10.0, 0.0), 20.0);
- QGeoCircle c2 = QGeoCircle(QGeoCoordinate(20.0, 0.0), 30.0);
-
- QVERIFY(c1 != c2);
-
- c2 = c1;
- QCOMPARE(c2.center(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(c2.radius(), 20.0);
- QCOMPARE(c1, c2);
-
- c2.setCenter(QGeoCoordinate(30.0, 0.0));
- c2.setRadius(15.0);
- QCOMPARE(c1.center(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(c1.radius(), 20.0);
-
- // Assign c1 to an area
- QGeoShape area = c1;
- QCOMPARE(area.type(), c1.type());
- QVERIFY(area == c1);
-
- // Assign the area back to a bounding circle
- QGeoCircle ca = area;
- QCOMPARE(ca.center(), c1.center());
- QCOMPARE(ca.radius(), c1.radius());
-
- // Check that the copy is not modified when modifying the original.
- c1.setCenter(QGeoCoordinate(15.0, 15.0));
- QVERIFY(ca.center() != c1.center());
- QVERIFY(ca != c1);
-}
-
-void tst_QGeoCircle::comparison()
-{
- QGeoCircle c1(QGeoCoordinate(1,1), qreal(50.0));
- QGeoCircle c2(QGeoCoordinate(1,1), qreal(50.0));
- QGeoCircle c3(QGeoCoordinate(1,1), qreal(35.0));
- QGeoCircle c4(QGeoCoordinate(1,2), qreal(50.0));
-
- QVERIFY(c1 == c2);
- QVERIFY(!(c1 != c2));
-
- QVERIFY(!(c1 == c3));
- QVERIFY(c1 != c3);
-
- QVERIFY(!(c1 == c4));
- QVERIFY(c1 != c4);
-
- QVERIFY(!(c2 == c3));
- QVERIFY(c2 != c3);
-
- QGeoRectangle b1(QGeoCoordinate(20,20),QGeoCoordinate(10,30));
- QVERIFY(!(c1 == b1));
- QVERIFY(c1 != b1);
-
- QGeoShape *c2Ptr = &c2;
- QVERIFY(c1 == *c2Ptr);
- QVERIFY(!(c1 != *c2Ptr));
-
- QGeoShape *c3Ptr = &c3;
- QVERIFY(!(c1 == *c3Ptr));
- QVERIFY(c1 != *c3Ptr);
-}
-
-void tst_QGeoCircle::type()
-{
- QGeoCircle c;
- QCOMPARE(c.type(), QGeoShape::CircleType);
-}
-
-void tst_QGeoCircle::radius()
-{
- QGeoCircle c;
- c.setRadius(1.0);
- QCOMPARE(c.radius(), qreal(1.0));
- c.setRadius(5.0);
- QCOMPARE(c.radius(), qreal(5.0));
-}
-
-void tst_QGeoCircle::center()
-{
- QGeoCircle c;
- c.setCenter(QGeoCoordinate(1,1));
- QCOMPARE(c.center(), QGeoCoordinate(1,1));
-
- QGeoShape shape = c;
- QCOMPARE(shape.center(), c.center());
-
- c.setCenter(QGeoCoordinate(5,10));
- QCOMPARE(c.center(), QGeoCoordinate(5,10));
-}
-
-void tst_QGeoCircle::translate_data()
-{
- QTest::addColumn<QGeoCoordinate>("center");
- QTest::addColumn<qreal>("radius");
- QTest::addColumn<double>("lat");
- QTest::addColumn<double>("lon");
- QTest::addColumn<QGeoCoordinate>("newCenter");
-
- QTest::newRow("from 0,0") << QGeoCoordinate(0,0) << qreal(10.0) <<
- 5.0 << 5.0 << QGeoCoordinate(5.0, 5.0);
- QTest::newRow("across 0,0") << QGeoCoordinate(-2, -2) << qreal(20.0) <<
- 5.0 << 5.0 << QGeoCoordinate(3.0, 3.0);
- QTest::newRow("backwards across 0,0") << QGeoCoordinate(5,5) << qreal(50.0)
- << -13.0 << 5.0
- << QGeoCoordinate(-8.0, 10.0);
-}
-
-void tst_QGeoCircle::translate()
-{
- QFETCH(QGeoCoordinate, center);
- QFETCH(qreal, radius);
- QFETCH(double, lat);
- QFETCH(double, lon);
- QFETCH(QGeoCoordinate, newCenter);
-
- QGeoCircle c(center, radius);
- QGeoCircle d = c;
-
- c.translate(lat, lon);
-
- QCOMPARE(c.radius(), radius);
- QCOMPARE(c.center(), newCenter);
-
- c = d.translated(lat, lon);
- d.setRadius(1.0);
-
- QCOMPARE(c.radius(), radius);
- QCOMPARE(d.center(), center);
- QCOMPARE(c.center(), newCenter);
-}
-
-void tst_QGeoCircle::valid_data()
-{
- QTest::addColumn<QGeoCoordinate>("center");
- QTest::addColumn<qreal>("radius");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("default") << QGeoCoordinate() << qreal(-1.0) << false;
- QTest::newRow("empty coord") << QGeoCoordinate() << qreal(5.0) << false;
- QTest::newRow("NaN coord") << QGeoCoordinate(500, 500) << qreal(5.0) << false;
- QTest::newRow("bad radius") << QGeoCoordinate(10, 10) << qreal(-5.0) << false;
- QTest::newRow("NaN radius") << QGeoCoordinate(10, 10) << qreal(qQNaN()) << false;
- QTest::newRow("zero radius") << QGeoCoordinate(10, 10) << qreal(0.0) << true;
- QTest::newRow("good") << QGeoCoordinate(10, 10) << qreal(5.0) << true;
-}
-
-void tst_QGeoCircle::valid()
-{
- QFETCH(QGeoCoordinate, center);
- QFETCH(qreal, radius);
- QFETCH(bool, valid);
-
- QGeoCircle c(center, radius);
- QCOMPARE(c.isValid(), valid);
-
- QGeoShape area = c;
- QCOMPARE(area.isValid(), valid);
-}
-
-void tst_QGeoCircle::empty_data()
-{
- QTest::addColumn<QGeoCoordinate>("center");
- QTest::addColumn<qreal>("radius");
- QTest::addColumn<bool>("empty");
-
- QTest::newRow("default") << QGeoCoordinate() << qreal(-1.0) << true;
- QTest::newRow("empty coord") << QGeoCoordinate() << qreal(5.0) << true;
- QTest::newRow("NaN coord") << QGeoCoordinate(500, 500) << qreal(5.0) << true;
- QTest::newRow("bad radius") << QGeoCoordinate(10, 10) << qreal(-5.0) << true;
- QTest::newRow("NaN radius") << QGeoCoordinate(10, 10) << qreal(qQNaN()) << true;
- QTest::newRow("zero radius") << QGeoCoordinate(10, 10) << qreal(0.0) << true;
- QTest::newRow("good") << QGeoCoordinate(10, 10) << qreal(5.0) << false;
-}
-
-void tst_QGeoCircle::empty()
-{
- QFETCH(QGeoCoordinate, center);
- QFETCH(qreal, radius);
- QFETCH(bool, empty);
-
- QGeoCircle c(center, radius);
- QCOMPARE(c.isEmpty(), empty);
-
- QGeoShape area = c;
- QCOMPARE(area.isEmpty(), empty);
-}
-
-void tst_QGeoCircle::contains_data()
-{
- QTest::addColumn<QGeoCoordinate>("center");
- QTest::addColumn<qreal>("radius");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QTest::newRow("own center") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1,1) << true;
- QTest::newRow("over the hills") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(30, 40) << false;
- QTest::newRow("at 0.5*radius") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00015374,1.00015274) << true;
- QTest::newRow("at 0.99*radius") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00077538, 0.99955527) << true;
- QTest::newRow("at 1.01*radius") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00071413, 0.99943423) << false;
- // TODO: add tests for edge circle cases: cross 1 pole, cross both poles
-}
-
-void tst_QGeoCircle::contains()
-{
- QFETCH(QGeoCoordinate, center);
- QFETCH(qreal, radius);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QGeoCircle c(center, radius);
- QCOMPARE(c.contains(probe), result);
-
- QGeoShape area = c;
- QCOMPARE(area.contains(probe), result);
-}
-
-void tst_QGeoCircle::boundingGeoRectangle_data()
-{
- QTest::addColumn<QGeoCoordinate>("center");
- QTest::addColumn<qreal>("radius");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QTest::newRow("own center") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1,1) << true;
- QTest::newRow("over the hills") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(30, 40) << false;
- QTest::newRow("at 0.5*radius") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00015374,1.00015274) << true;
- QTest::newRow("at 0.99*radius") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00077538, 0.99955527) << true;
- QTest::newRow("Outside the box") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00071413, 0.99903423) << false;
- // TODO: add tests for edge circle cases: cross 1 pole, cross both poles
-}
-
-void tst_QGeoCircle::boundingGeoRectangle()
-{
- QFETCH(QGeoCoordinate, center);
- QFETCH(qreal, radius);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QGeoCircle c(center, radius);
- QGeoRectangle box = c.boundingGeoRectangle();
- QCOMPARE(box.contains(probe), result);
-}
-
-void tst_QGeoCircle::extendCircle()
-{
- QFETCH(QGeoCircle, circle);
- QFETCH(QGeoCoordinate, coord);
- QFETCH(bool, containsFirst);
- QFETCH(bool, containsExtended);
-
- QCOMPARE(circle.contains(coord), containsFirst);
- circle.extendCircle(coord);
- QCOMPARE(circle.contains(coord), containsExtended);
-
-}
-
-void tst_QGeoCircle::extendCircle_data()
-{
- QTest::addColumn<QGeoCircle>("circle");
- QTest::addColumn<QGeoCoordinate>("coord");
- QTest::addColumn<bool>("containsFirst");
- QTest::addColumn<bool>("containsExtended");
-
- QGeoCoordinate co1(20.0, 20.0);
-
- QTest::newRow("own center")
- << QGeoCircle(co1, 100)
- << QGeoCoordinate(20.0, 20.0)
- << true
- << true;
- QTest::newRow("inside")
- << QGeoCircle(co1, 100)
- << QGeoCoordinate(20.0001, 20.0001)
- << true
- << true;
- QTest::newRow("far away")
- << QGeoCircle(co1, 100)
- << QGeoCoordinate(50.0001, 50.0001)
- << false
- << true;
- QTest::newRow("invalid circle")
- << QGeoCircle()
- << QGeoCoordinate(20.0, 20.0)
- << false
- << false;
- QTest::newRow("invalid coordinate")
- << QGeoCircle(co1, 100)
- << QGeoCoordinate(99.0, 190.0)
- << false
- << false;
-}
-
-void tst_QGeoCircle::areaComparison_data()
-{
- QTest::addColumn<QGeoShape>("area");
- QTest::addColumn<QGeoCircle>("circle");
- QTest::addColumn<bool>("equal");
-
- QGeoCircle c1(QGeoCoordinate(10.0, 0.0), 10.0);
- QGeoCircle c2(QGeoCoordinate(20.0, 10.0), 20.0);
- QGeoRectangle b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
-
- QTest::newRow("default constructed") << QGeoShape() << QGeoCircle() << false;
- QTest::newRow("c1 c1") << QGeoShape(c1) << c1 << true;
- QTest::newRow("c1 c2") << QGeoShape(c1) << c2 << false;
- QTest::newRow("c2 c1") << QGeoShape(c2) << c1 << false;
- QTest::newRow("c2 c2") << QGeoShape(c2) << c2 << true;
- QTest::newRow("b c1") << QGeoShape(b) << c1 << false;
-}
-
-void tst_QGeoCircle::areaComparison()
-{
- QFETCH(QGeoShape, area);
- QFETCH(QGeoCircle, circle);
- QFETCH(bool, equal);
-
- QCOMPARE((area == circle), equal);
- QCOMPARE((area != circle), !equal);
-
- QCOMPARE((circle == area), equal);
- QCOMPARE((circle != area), !equal);
-}
-
-void tst_QGeoCircle::boxComparison_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<QGeoCircle>("circle");
- QTest::addColumn<bool>("equal");
-
- QGeoCircle c(QGeoCoordinate(10.0, 0.0), 10.0);
- QGeoRectangle b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
-
- QTest::newRow("default constructed") << QGeoRectangle() << QGeoCircle() << false;
- QTest::newRow("b c") << b << c << false;
-}
-
-void tst_QGeoCircle::boxComparison()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(QGeoCircle, circle);
- QFETCH(bool, equal);
-
- QCOMPARE((box == circle), equal);
- QCOMPARE((box != circle), !equal);
-
- QCOMPARE((circle == box), equal);
- QCOMPARE((circle != box), !equal);
-}
-
-void tst_QGeoCircle::hashing()
-{
- const QGeoCircle circle(QGeoCoordinate(1, 1), 10);
- const size_t circleHash = qHash(circle);
-
- QGeoCircle otherCenterCircle = circle;
- otherCenterCircle.setCenter(QGeoCoordinate(1, 2));
- QVERIFY(qHash(otherCenterCircle) != circleHash);
-
- QGeoCircle otherRadiusCircle = circle;
- otherRadiusCircle.setRadius(100);
- QVERIFY(qHash(otherRadiusCircle) != circleHash);
-
- // Do not assign, so that they do not share same d_ptr
- QGeoCircle similarCircle(QGeoCoordinate(1, 1), 10);
- QCOMPARE(qHash(similarCircle), circleHash);
-}
-
-QTEST_MAIN(tst_QGeoCircle)
-#include "tst_qgeocircle.moc"
diff --git a/tests/auto/qgeocoordinate/CMakeLists.txt b/tests/auto/qgeocoordinate/CMakeLists.txt
deleted file mode 100644
index dd216a05..00000000
--- a/tests/auto/qgeocoordinate/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Generated from qgeocoordinate.pro.
-
-#####################################################################
-## tst_qgeocoordinate Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeocoordinate
- SOURCES
- ../utils/qlocationtestutils.cpp ../utils/qlocationtestutils_p.h
- tst_qgeocoordinate.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
diff --git a/tests/auto/qgeocoordinate/qgeocoordinate.pro b/tests/auto/qgeocoordinate/qgeocoordinate.pro
deleted file mode 100644
index 52795e16..00000000
--- a/tests/auto/qgeocoordinate/qgeocoordinate.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qgeocoordinate
-
-HEADERS += ../utils/qlocationtestutils_p.h
-SOURCES += tst_qgeocoordinate.cpp \
- ../utils/qlocationtestutils.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp b/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp
deleted file mode 100644
index 828b2ef4..00000000
--- a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp
+++ /dev/null
@@ -1,1000 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "../utils/qlocationtestutils_p.h"
-
-#include <QtPositioning/qgeocoordinate.h>
-#include <qtest.h>
-
-#include <QMetaType>
-#include <QDebug>
-
-#include <float.h>
-
-QT_USE_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoCoordinate::CoordinateFormat)
-Q_DECLARE_METATYPE(QGeoCoordinate::CoordinateType)
-
-static const QGeoCoordinate BRISBANE(-27.46758, 153.027892);
-static const QGeoCoordinate MELBOURNE(-37.814251, 144.963169);
-static const QGeoCoordinate LONDON(51.500152, -0.126236);
-static const QGeoCoordinate NEW_YORK(40.71453, -74.00713);
-static const QGeoCoordinate NORTH_POLE(90, 0);
-static const QGeoCoordinate SOUTH_POLE(-90, 0);
-
-static const QChar DEGREES_SYMB(0x00B0);
-
-
-QByteArray tst_qgeocoordinate_debug;
-
-void tst_qgeocoordinate_messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
-{
- switch (type) {
- case QtDebugMsg :
- tst_qgeocoordinate_debug = msg.toLocal8Bit();
- break;
- default:
- break;
- }
-}
-
-
-class tst_QGeoCoordinate : public QObject
-{
- Q_OBJECT
-
-private:
- enum TestDataType {
- Latitude,
- Longitude,
- Altitude
- };
-
-private slots:
- void initTestcase()
- {
- qRegisterMetaType<QGeoCoordinate>();
- }
-
- void constructor()
- {
- QGeoCoordinate c;
- QVERIFY(!c.isValid());
- QCOMPARE(c, QGeoCoordinate());
- }
-
- void constructor_lat_long()
- {
- QFETCH(double, latitude);
- QFETCH(double, longitude);
- QFETCH(QGeoCoordinate::CoordinateType, type);
-
- QGeoCoordinate c(latitude, longitude);
- QCOMPARE(c.type(), type);
- if (type != QGeoCoordinate::InvalidCoordinate) {
- QVERIFY(c.isValid());
- QCOMPARE(c.latitude(), latitude);
- QCOMPARE(c.longitude(), longitude);
- } else {
- QVERIFY(!c.isValid());
- QVERIFY(c.latitude() != latitude);
- QVERIFY(c.longitude() != longitude);
- }
- }
-
- void constructor_lat_long_data()
- {
- QTest::addColumn<double>("latitude");
- QTest::addColumn<double>("longitude");
- QTest::addColumn<QGeoCoordinate::CoordinateType>("type");
-
- QTest::newRow("both zero") << 0.0 << 0.0 << QGeoCoordinate::Coordinate2D;
- QTest::newRow("both negative") << -1.0 << -1.0 << QGeoCoordinate::Coordinate2D;
- QTest::newRow("both positive") << 1.0 << 1.0 << QGeoCoordinate::Coordinate2D;
- QTest::newRow("latitude negative") << -1.0 << 1.0 << QGeoCoordinate::Coordinate2D;
- QTest::newRow("longitude negative") << 1.0 << -1.0 << QGeoCoordinate::Coordinate2D;
-
- QTest::newRow("both too high") << 90.1 << 180.1 << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("latitude too high") << 90.1 << 0.1 << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("longitude too high") << 0.1 << 180.1 << QGeoCoordinate::InvalidCoordinate;
-
- QTest::newRow("both too low") << -90.1 << -180.1 << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("latitude too low") << -90.1 << 0.1 << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("longitude too low") << 0.1 << -180.1 << QGeoCoordinate::InvalidCoordinate;
-
- QTest::newRow("both not too high") << 90.0 << 180.0 << QGeoCoordinate::Coordinate2D;
- QTest::newRow("both not too low") << -90.0 << -180.0 << QGeoCoordinate::Coordinate2D;
-
- QTest::newRow("latitude too high and longitude too low") << 90.1 << -180.1 << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("latitude too low and longitude too high") << -90.1 << 180.1 << QGeoCoordinate::InvalidCoordinate;
- }
-
- void constructor_lat_long_alt()
- {
- QFETCH(double, latitude);
- QFETCH(double, longitude);
- QFETCH(double, altitude);
- QFETCH(QGeoCoordinate::CoordinateType, type);
-
- QGeoCoordinate c(latitude, longitude, altitude);
- QCOMPARE(c.type(), type);
- if (type != QGeoCoordinate::InvalidCoordinate) {
- QCOMPARE(c.latitude(), latitude);
- QCOMPARE(c.longitude(), longitude);
- QCOMPARE(c.altitude(), altitude);
- } else {
- QVERIFY(!c.isValid());
- QVERIFY(c.latitude() != latitude);
- QVERIFY(c.longitude() != longitude);
- QVERIFY(c.altitude() != altitude);
- }
- }
-
- void constructor_lat_long_alt_data()
- {
- QTest::addColumn<double>("latitude");
- QTest::addColumn<double>("longitude");
- QTest::addColumn<double>("altitude");
- QTest::addColumn<QGeoCoordinate::CoordinateType>("type");
-
- QTest::newRow("all zero") << 0.0 << 0.0 << 0.0 << QGeoCoordinate::Coordinate3D;
- QTest::newRow("all negative") << -1.0 << -1.0 << -2.0 << QGeoCoordinate::Coordinate3D;
- QTest::newRow("all positive") << 1.0 << 1.0 << 4.0 << QGeoCoordinate::Coordinate3D;
-
- QTest::newRow("latitude negative") << -1.0 << 1.0 << 1.0 << QGeoCoordinate::Coordinate3D;
- QTest::newRow("longitude negative") << 1.0 << -1.0 << 1.0 << QGeoCoordinate::Coordinate3D;
- QTest::newRow("altitude negative") << 1.0 << 1.0 << -1.0 << QGeoCoordinate::Coordinate3D;
-
- QTest::newRow("altitude not too high") << 1.0 << 1.0 << DBL_MAX << QGeoCoordinate::Coordinate3D;
- QTest::newRow("altitude not too low") << 1.0 << 1.0 << DBL_MIN << QGeoCoordinate::Coordinate3D;
-
- QTest::newRow("all not too high") << 90.0 << 180.0 << DBL_MAX << QGeoCoordinate::Coordinate3D;
- QTest::newRow("all not too low") << -90.0 << -180.0 << DBL_MIN << QGeoCoordinate::Coordinate3D;
-
- QTest::newRow("all too high") << 90.1 << 180.1 << DBL_MAX << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("all too low") << -90.1 << -180.1 << DBL_MIN << QGeoCoordinate::InvalidCoordinate;
- }
-
- void copy_constructor()
- {
- QFETCH(QGeoCoordinate, c);
-
- QGeoCoordinate copy(c);
- QCOMPARE(copy.type(), c.type());
- if (c.type() != QGeoCoordinate::InvalidCoordinate) {
- QCOMPARE(copy.latitude(), c.latitude());
- QCOMPARE(copy.longitude(), c.longitude());
- if (c.type() == QGeoCoordinate::Coordinate3D)
- QCOMPARE(copy.altitude(), c.altitude());
- }
- }
-
- void copy_constructor_data()
- {
- QTest::addColumn<QGeoCoordinate>("c");
-
- QTest::newRow("no argument") << QGeoCoordinate();
- QTest::newRow("latitude, longitude arguments all zero") << QGeoCoordinate(0.0, 0.0);
-
- QTest::newRow("latitude, longitude arguments not too high") << QGeoCoordinate(90.0, 180.0);
- QTest::newRow("latitude, longitude arguments not too low") << QGeoCoordinate(-90.0, -180.0);
- QTest::newRow("latitude, longitude arguments too high") << QGeoCoordinate(90.1, 180.1);
- QTest::newRow("latitude, longitude arguments too low") << QGeoCoordinate(-90.1, -180.1);
-
- QTest::newRow("latitude, longitude, altitude arguments all zero") << QGeoCoordinate(0.0, 0.0, 0.0);
- QTest::newRow("latitude, longitude, altitude arguments not too high values") << QGeoCoordinate(90.0, 180.0, DBL_MAX);
- QTest::newRow("latitude, longitude, altitude arguments not too low values") << QGeoCoordinate(-90.0, -180.0, DBL_MIN);
-
- QTest::newRow("latitude, longitude, altitude arguments too high latitude & longitude") << QGeoCoordinate(90.1, 180.1, DBL_MAX);
- QTest::newRow("latitude, longitude, altitude arguments too low latitude & longitude") << QGeoCoordinate(-90.1, -180.1, DBL_MAX);
- }
-
- void move_constructor()
- {
- QFETCH(QGeoCoordinate, c);
-
- const QGeoCoordinate coordinateCopy = c;
- QCOMPARE(std::move(c), coordinateCopy);
- }
-
- void move_constructor_data()
- {
- copy_constructor_data();
- }
-
- void destructor()
- {
- QGeoCoordinate *coordinate;
-
- coordinate = new QGeoCoordinate();
- delete coordinate;
-
- coordinate = new QGeoCoordinate(0.0, 0.0);
- delete coordinate;
-
- coordinate = new QGeoCoordinate(0.0, 0.0, 0.0);
- delete coordinate;
-
- coordinate = new QGeoCoordinate(90.0, 180.0);
- delete coordinate;
-
- coordinate = new QGeoCoordinate(-90.0, -180.0);
- delete coordinate;
-
- coordinate = new QGeoCoordinate(90.1, 180.1);
- delete coordinate;
-
- coordinate = new QGeoCoordinate(-90.1, -180.1);
- delete coordinate;
- }
-
- void destructor2()
- {
- QFETCH(QGeoCoordinate, c);
- QGeoCoordinate *coordinate = new QGeoCoordinate(c);
- delete coordinate;
- }
-
- void destructor2_data()
- {
- copy_constructor_data();
- }
-
- void assign()
- {
- QFETCH(QGeoCoordinate, c);
-
- QGeoCoordinate c1 = c;
- QCOMPARE(c.type(), c1.type());
- if (c.isValid()) {
- QCOMPARE(c.latitude(), c.latitude());
- QCOMPARE(c.longitude(), c.longitude());
- if (c.type() == QGeoCoordinate::Coordinate3D)
- QCOMPARE(c.altitude(), c.altitude());
- }
- }
-
- void assign_data()
- {
- copy_constructor_data();
- }
-
- void move_assign()
- {
- QFETCH(QGeoCoordinate, c);
-
- QGeoCoordinate copy = c;
-
- QGeoCoordinate otherCoordinate;
- otherCoordinate = std::move(c);
- QCOMPARE(otherCoordinate, copy);
-
- // check that (move)assinging to a moved-from object is fine
- c = std::move(copy);
- QCOMPARE(c, otherCoordinate);
- }
-
- void move_assign_data()
- {
- copy_constructor_data();
- }
-
- void comparison()
- {
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(bool, result);
-
- QCOMPARE(c1 == c2, result);
- QVariant v1 = QVariant::fromValue(c1);
- QVariant v2 = QVariant::fromValue(c2);
- QCOMPARE(v2 == v1, result);
- }
-
- void comparison_data()
- {
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<bool>("result");
-
- QTest::newRow("Invalid != BRISBANE")
- << QGeoCoordinate(-190,-1000) << BRISBANE << false;
- QTest::newRow("BRISBANE != MELBOURNE")
- << BRISBANE << MELBOURNE << false;
- QTest::newRow("equal")
- << BRISBANE << BRISBANE << true;
- QTest::newRow("LONDON != uninitialized data")
- << LONDON << QGeoCoordinate() << false;
- QTest::newRow("uninitialized data == uninitialized data")
- << QGeoCoordinate() << QGeoCoordinate() << true;
- QTest::newRow("invalid == same invalid")
- << QGeoCoordinate(-190,-1000) << QGeoCoordinate(-190,-1000) << true;
- QTest::newRow("invalid == different invalid")
- << QGeoCoordinate(-190,-1000) << QGeoCoordinate(190,1000) << true;
- QTest::newRow("valid != another valid")
- << QGeoCoordinate(-90,-180) << QGeoCoordinate(-45,+45) << false;
- QTest::newRow("valid == same valid")
- << QGeoCoordinate(-90,-180) << QGeoCoordinate(-90,-180) << true;
- QTest::newRow("different longitudes at north pole are equal")
- << QGeoCoordinate(90, 0) << QGeoCoordinate(90, 45) << true;
- QTest::newRow("different longitudes at south pole are equal")
- << QGeoCoordinate(-90, 0) << QGeoCoordinate(-90, 45) << true;
- }
-
- void type()
- {
- QFETCH(QGeoCoordinate, c);
- QFETCH(QGeoCoordinate::CoordinateType, type);
-
- QCOMPARE(c.type(), type);
- }
-
- void type_data()
- {
- QTest::addColumn<QGeoCoordinate>("c");
- QTest::addColumn<QGeoCoordinate::CoordinateType>("type");
-
- QGeoCoordinate c;
-
- QTest::newRow("no values set") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setAltitude(1.0);
- QTest::newRow("only altitude is set") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setLongitude(1.0);
- QTest::newRow("only latitude and altitude is set") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setLatitude(-1.0);
- QTest::newRow("all valid: 3D Coordinate") << c << QGeoCoordinate::Coordinate3D;
-
- c.setLatitude(-90.1);
- QTest::newRow("too low latitude and valid longitude") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setLongitude(-180.1);
- c.setLatitude(90.0);
- QTest::newRow("valid latitude and too low longitude") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setLatitude(90.1);
- c.setLongitude(-180.0);
- QTest::newRow("too high latitude and valid longitude") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setLatitude(-90.0);
- c.setLongitude(180.1);
- QTest::newRow("valid latitude and too high longitude") << c << QGeoCoordinate::InvalidCoordinate;
- }
-
- void valid()
- {
- QFETCH(QGeoCoordinate, c);
- QCOMPARE(c.isValid(), c.type() != QGeoCoordinate::InvalidCoordinate);
- }
-
- void valid_data()
- {
- type_data();
- }
-
- void addDataValues(TestDataType type)
- {
- QTest::addColumn<double>("value");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("negative") << -1.0 << true;
- QTest::newRow("zero") << 0.0 << true;
- QTest::newRow("positive") << 1.0 << true;
-
- switch (type) {
- case Latitude:
- QTest::newRow("too low") << -90.1 << false;
- QTest::newRow("not too low") << -90.0 << true;
- QTest::newRow("not too hight") << 90.0 << true;
- QTest::newRow("too high") << 90.1;
- break;
- case Longitude:
- QTest::newRow("too low") << -180.1 << false;
- QTest::newRow("not too low") << -180.0 << true;
- QTest::newRow("not too hight") << 180.0 << true;
- QTest::newRow("too high") << 180.1;
- break;
- case Altitude:
- break;
- }
- }
-
- void latitude()
- {
- QFETCH(double, value);
- QGeoCoordinate c;
- c.setLatitude(value);
- QCOMPARE(c.latitude(), value);
-
- QGeoCoordinate c2 = c;
- QCOMPARE(c.latitude(), value);
- QCOMPARE(c2, c);
- }
- void latitude_data() { addDataValues(Latitude); }
-
- void longitude()
- {
- QFETCH(double, value);
- QGeoCoordinate c;
- c.setLongitude(value);
- QCOMPARE(c.longitude(), value);
-
- QGeoCoordinate c2 = c;
- QCOMPARE(c.longitude(), value);
- QCOMPARE(c2, c);
- }
- void longitude_data() { addDataValues(Longitude); }
-
- void altitude()
- {
- QFETCH(double, value);
- QGeoCoordinate c;
- c.setAltitude(value);
- QCOMPARE(c.altitude(), value);
-
- QGeoCoordinate c2 = c;
- QCOMPARE(c.altitude(), value);
- QCOMPARE(c2, c);
- }
- void altitude_data() { addDataValues(Altitude); }
-
- void distanceTo()
- {
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(qreal, distance);
-
- QCOMPARE(QString::number(c1.distanceTo(c2)), QString::number(distance));
- }
-
- void distanceTo_data()
- {
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<qreal>("distance");
-
- QTest::newRow("invalid coord 1")
- << QGeoCoordinate() << BRISBANE << qreal(0.0);
- QTest::newRow("invalid coord 2")
- << BRISBANE << QGeoCoordinate() << qreal(0.0);
- QTest::newRow("brisbane -> melbourne")
- << BRISBANE << MELBOURNE << qreal(1374820.1618767744);
- QTest::newRow("london -> new york")
- << LONDON << NEW_YORK << qreal(5570538.4987236429);
- QTest::newRow("north pole -> south pole")
- << NORTH_POLE << SOUTH_POLE << qreal(20015109.4154876769);
- }
-
- void azimuthTo()
- {
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(qreal, azimuth);
-
- qreal result = c1.azimuthTo(c2);
- QVERIFY(result >= 0.0);
- QVERIFY(result < 360.0);
- QCOMPARE(QString::number(result), QString::number(azimuth));
- }
-
- void azimuthTo_data()
- {
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<qreal>("azimuth");
-
- QTest::newRow("invalid coord 1")
- << QGeoCoordinate() << BRISBANE << qreal(0.0);
- QTest::newRow("invalid coord 2")
- << BRISBANE << QGeoCoordinate() << qreal(0.0);
- QTest::newRow("brisbane -> melbourne")
- << BRISBANE << MELBOURNE << qreal(211.1717286649);
- QTest::newRow("london -> new york")
- << LONDON << NEW_YORK << qreal(288.3388804508);
- QTest::newRow("north pole -> south pole")
- << NORTH_POLE << SOUTH_POLE << qreal(180.0);
- QTest::newRow("Almost 360degrees bearing")
- << QGeoCoordinate(0.5,45.0,0.0) << QGeoCoordinate(0.5,-134.9999651,0.0) << qreal(359.998);
- }
-
- void atDistanceAndAzimuth()
- {
- QFETCH(QGeoCoordinate, origin);
- QFETCH(qreal, distance);
- QFETCH(qreal, azimuth);
- QFETCH(QGeoCoordinate, result);
-
- QCOMPARE(result, origin.atDistanceAndAzimuth(distance, azimuth));
- }
-
- void atDistanceAndAzimuth_data()
- {
- QTest::addColumn<QGeoCoordinate>("origin");
- QTest::addColumn<qreal>("distance");
- QTest::addColumn<qreal>("azimuth");
- QTest::addColumn<QGeoCoordinate>("result");
-
- QTest::newRow("invalid coord")
- << QGeoCoordinate()
- << qreal(1000.0)
- << qreal(10.0)
- << QGeoCoordinate();
- if (sizeof(qreal) == sizeof(double)) {
- QTest::newRow("brisbane -> melbourne")
- << BRISBANE
- << qreal(1374820.1618767744)
- << qreal(211.1717286649)
- << MELBOURNE;
- QTest::newRow("london -> new york")
- << LONDON
- << qreal(5570538.4987236429)
- << qreal(288.3388804508)
- << NEW_YORK;
- QTest::newRow("north pole -> south pole")
- << NORTH_POLE
- << qreal(20015109.4154876769)
- << qreal(180.0)
- << SOUTH_POLE;
- } else {
- QTest::newRow("brisbane -> melbourne")
- << BRISBANE
- << qreal(1374820.1618767744)
- << qreal(211.1717286649)
- << QGeoCoordinate(-37.8142515084775, 144.963170622944);
- QTest::newRow("london -> new york")
- << LONDON
- << qreal(5570538.4987236429)
- << qreal(288.3388804508)
- << QGeoCoordinate(40.7145220608416, -74.0071216045375);
- QTest::newRow("north pole -> south pole")
- << NORTH_POLE
- << qreal(20015109.4154876769)
- << qreal(180.0)
- << QGeoCoordinate(-89.9999947369857, -90.0);
- }
- }
-
- void degreesToString()
- {
- QFETCH(QGeoCoordinate, coord);
- QFETCH(QGeoCoordinate::CoordinateFormat, format);
- QFETCH(QString, string);
-
- QCOMPARE(coord.toString(format), string);
- }
-
- void degreesToString_data()
- {
- QTest::addColumn<QGeoCoordinate>("coord");
- QTest::addColumn<QGeoCoordinate::CoordinateFormat>("format");
- QTest::addColumn<QString>("string");
-
- QGeoCoordinate northEast(27.46758, 153.027892);
- QGeoCoordinate northEastWithAlt(27.46758, 153.027892, 28.23411);
- QGeoCoordinate southEast(-27.46758, 153.027892);
- QGeoCoordinate southEastWithAlt(-27.46758, 153.027892, 28.23411);
- QGeoCoordinate northWest(27.46758, -153.027892);
- QGeoCoordinate northWestWithAlt(27.46758, -153.027892, 28.23411);
- QGeoCoordinate southWest(-27.46758, -153.027892);
- QGeoCoordinate southWestWithAlt(-27.46758, -153.027892, 28.23411);
-
- QGeoCoordinate empty;
- QGeoCoordinate toohigh(90.1, 180.1);
- QGeoCoordinate toolow(-90.1, -180.1);
- QGeoCoordinate zeroLatLong(0.0, 0.0);
- QGeoCoordinate allZero(0.0, 0.0, 0.0);
-
- QTest::newRow("empty, dd, no hemisphere")
- << empty << QGeoCoordinate::Degrees
- << QString();
- QTest::newRow("empty, dd, hemisphere")
- << empty << QGeoCoordinate::DegreesWithHemisphere
- << QString();
- QTest::newRow("empty, dm, no hemisphere")
- << empty << QGeoCoordinate::DegreesMinutes
- << QString();
- QTest::newRow("empty, dm, hemisphere")
- << empty << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString();
- QTest::newRow("empty, dms, no hemisphere")
- << empty << QGeoCoordinate::DegreesMinutesSeconds
- << QString();
- QTest::newRow("empty, dms, hemisphere")
- << empty << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString();
-
- QTest::newRow("too low, dd, no hemisphere")
- << toolow << QGeoCoordinate::Degrees
- << QString();
- QTest::newRow("too low, dd, hemisphere")
- << toolow << QGeoCoordinate::DegreesWithHemisphere
- << QString();
- QTest::newRow("too low, dm, no hemisphere")
- << toolow << QGeoCoordinate::DegreesMinutes
- << QString();
- QTest::newRow("too low, dm, hemisphere")
- << toolow << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString();
- QTest::newRow("too low, dms, no hemisphere")
- << toolow << QGeoCoordinate::DegreesMinutesSeconds
- << QString();
- QTest::newRow("too low, dms, hemisphere")
- << toolow << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString();
-
- QTest::newRow("too high, dd, no hemisphere")
- << toohigh << QGeoCoordinate::Degrees
- << QString();
- QTest::newRow("too high, dd, hemisphere")
- << toohigh << QGeoCoordinate::DegreesWithHemisphere
- << QString();
- QTest::newRow("too high, dm, no hemisphere")
- << toohigh << QGeoCoordinate::DegreesMinutes
- << QString();
- QTest::newRow("too high, dm, hemisphere")
- << toohigh << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString();
- QTest::newRow("too high, dms, no hemisphere")
- << toohigh << QGeoCoordinate::DegreesMinutesSeconds
- << QString();
- QTest::newRow("too high, dms, hemisphere")
- << toohigh << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString();
-
- QTest::newRow("zeroLatLong, dd, no hemisphere")
- << zeroLatLong << QGeoCoordinate::Degrees
- << QString("0.00000%1, 0.00000%1").arg(DEGREES_SYMB);
- QTest::newRow("zeroLatLong, dd, hemisphere")
- << zeroLatLong << QGeoCoordinate::DegreesWithHemisphere
- << QString("0.00000%1, 0.00000%1").arg(DEGREES_SYMB);
- QTest::newRow("zeroLatLong, dm, no hemisphere")
- << zeroLatLong << QGeoCoordinate::DegreesMinutes
- << QString("0%1 0.000', 0%1 0.000'").arg(DEGREES_SYMB);
- QTest::newRow("zeroLatLong, dm, hemisphere")
- << zeroLatLong << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("0%1 0.000', 0%1 0.000'").arg(DEGREES_SYMB);
- QTest::newRow("zeroLatLong, dms, no hemisphere")
- << zeroLatLong << QGeoCoordinate::DegreesMinutesSeconds
- << QString("0%1 0' 0.0\", 0%1 0' 0.0\"").arg(DEGREES_SYMB);
- QTest::newRow("zeroLatLong, dms, hemisphere")
- << zeroLatLong << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("0%1 0' 0.0\", 0%1 0' 0.0\"").arg(DEGREES_SYMB);
-
- QTest::newRow("allZero, dd, no hemisphere")
- << allZero << QGeoCoordinate::Degrees
- << QString("0.00000%1, 0.00000%1, 0m").arg(DEGREES_SYMB);
- QTest::newRow("allZero, dd, hemisphere")
- << allZero << QGeoCoordinate::DegreesWithHemisphere
- << QString("0.00000%1, 0.00000%1, 0m").arg(DEGREES_SYMB);
- QTest::newRow("allZero, dm, no hemisphere")
- << allZero << QGeoCoordinate::DegreesMinutes
- << QString("0%1 0.000', 0%1 0.000', 0m").arg(DEGREES_SYMB);
- QTest::newRow("allZero, dm, hemisphere")
- << allZero << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("0%1 0.000', 0%1 0.000', 0m").arg(DEGREES_SYMB);
- QTest::newRow("allZero, dms, no hemisphere")
- << allZero << QGeoCoordinate::DegreesMinutesSeconds
- << QString("0%1 0' 0.0\", 0%1 0' 0.0\", 0m").arg(DEGREES_SYMB);
- QTest::newRow("allZero, dms, hemisphere")
- << allZero << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("0%1 0' 0.0\", 0%1 0' 0.0\", 0m").arg(DEGREES_SYMB);
-
- QTest::newRow("NE, dd, no hemisphere")
- << northEast << QGeoCoordinate::Degrees
- << QString("27.46758%1, 153.02789%1").arg(DEGREES_SYMB);
- QTest::newRow("NE, dd, hemisphere")
- << northEast << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 N, 153.02789%1 E").arg(DEGREES_SYMB);
- QTest::newRow("NE, dm, no hemisphere")
- << northEast << QGeoCoordinate::DegreesMinutes
- << QString("27%1 28.055', 153%1 1.674'").arg(DEGREES_SYMB);
- QTest::newRow("NE, dm, hemisphere")
- << northEast << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' N, 153%1 1.674' E").arg(DEGREES_SYMB);
- QTest::newRow("NE, dms, no hemisphere")
- << northEast << QGeoCoordinate::DegreesMinutesSeconds
- << QString("27%1 28' 3.3\", 153%1 1' 40.4\"").arg(DEGREES_SYMB);
- QTest::newRow("NE, dms, hemisphere")
- << northEast << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" E").arg(DEGREES_SYMB);
-
- QTest::newRow("NE with alt, dd, no hemisphere")
- << northEastWithAlt << QGeoCoordinate::Degrees
- << QString("27.46758%1, 153.02789%1, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NE with alt, dd, hemisphere")
- << northEastWithAlt << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 N, 153.02789%1 E, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NE with alt, dm, no hemisphere")
- << northEastWithAlt << QGeoCoordinate::DegreesMinutes
- << QString("27%1 28.055', 153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NE with alt, dm, hemisphere")
- << northEastWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' N, 153%1 1.674' E, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NE with alt, dms, no hemisphere")
- << northEastWithAlt << QGeoCoordinate::DegreesMinutesSeconds
- << QString("27%1 28' 3.3\", 153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NE with alt, dms, hemisphere")
- << northEastWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" E, 28.2341m").arg(DEGREES_SYMB);
-
- QTest::newRow("SE, dd, no hemisphere")
- << southEast << QGeoCoordinate::Degrees
- << QString("-27.46758%1, 153.02789%1").arg(DEGREES_SYMB);
- QTest::newRow("SE, dd, hemisphere")
- << southEast << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 S, 153.02789%1 E").arg(DEGREES_SYMB);
- QTest::newRow("SE, dm, no hemisphere")
- << southEast << QGeoCoordinate::DegreesMinutes
- << QString("-27%1 28.055', 153%1 1.674'").arg(DEGREES_SYMB);
- QTest::newRow("SE, dm, hemisphere")
- << southEast << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' S, 153%1 1.674' E").arg(DEGREES_SYMB);
- QTest::newRow("SE, dms, no hemisphere")
- << southEast << QGeoCoordinate::DegreesMinutesSeconds
- << QString("-27%1 28' 3.3\", 153%1 1' 40.4\"").arg(DEGREES_SYMB);
- QTest::newRow("SE, dms, hemisphere")
- << southEast << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" E").arg(DEGREES_SYMB);
-
- QTest::newRow("SE with alt, dd, no hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::Degrees
- << QString("-27.46758%1, 153.02789%1, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SE with alt, dd, hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 S, 153.02789%1 E, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SE with alt, dm, no hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::DegreesMinutes
- << QString("-27%1 28.055', 153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SE with alt, dm, hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' S, 153%1 1.674' E, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SE with alt, dms, no hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::DegreesMinutesSeconds
- << QString("-27%1 28' 3.3\", 153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SE with alt, dms, hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" E, 28.2341m").arg(DEGREES_SYMB);;
-
- QTest::newRow("NW, dd, no hemisphere")
- << northWest << QGeoCoordinate::Degrees
- << QString("27.46758%1, -153.02789%1").arg(DEGREES_SYMB);
- QTest::newRow("NW, dd, hemisphere")
- << northWest << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 N, 153.02789%1 W").arg(DEGREES_SYMB);
- QTest::newRow("NW, dm, no hemisphere")
- << northWest << QGeoCoordinate::DegreesMinutes
- << QString("27%1 28.055', -153%1 1.674'").arg(DEGREES_SYMB);
- QTest::newRow("NW, dm, hemisphere")
- << northWest << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' N, 153%1 1.674' W").arg(DEGREES_SYMB);
- QTest::newRow("NW, dms, no hemisphere")
- << northWest << QGeoCoordinate::DegreesMinutesSeconds
- << QString("27%1 28' 3.3\", -153%1 1' 40.4\"").arg(DEGREES_SYMB);
- QTest::newRow("NW, dms, hemisphere")
- << northWest << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" W").arg(DEGREES_SYMB);
-
- QTest::newRow("NW with alt, dd, no hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::Degrees
- << QString("27.46758%1, -153.02789%1, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NW with alt, dd, hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 N, 153.02789%1 W, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NW with alt, dm, no hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::DegreesMinutes
- << QString("27%1 28.055', -153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NW with alt, dm, hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' N, 153%1 1.674' W, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NW with alt, dms, no hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::DegreesMinutesSeconds
- << QString("27%1 28' 3.3\", -153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NW with alt, dms, hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" W, 28.2341m").arg(DEGREES_SYMB);
-
- QTest::newRow("SW, dd, no hemisphere")
- << southWest << QGeoCoordinate::Degrees
- << QString("-27.46758%1, -153.02789%1").arg(DEGREES_SYMB);
- QTest::newRow("SW, dd, hemisphere")
- << southWest << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 S, 153.02789%1 W").arg(DEGREES_SYMB);
- QTest::newRow("SW, dm, no hemisphere")
- << southWest << QGeoCoordinate::DegreesMinutes
- << QString("-27%1 28.055', -153%1 1.674'").arg(DEGREES_SYMB);
- QTest::newRow("SW, dm, hemisphere")
- << southWest << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' S, 153%1 1.674' W").arg(DEGREES_SYMB);
- QTest::newRow("SW, dms, no hemisphere")
- << southWest << QGeoCoordinate::DegreesMinutesSeconds
- << QString("-27%1 28' 3.3\", -153%1 1' 40.4\"").arg(DEGREES_SYMB);
- QTest::newRow("SW, dms, hemisphere")
- << southWest << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" W").arg(DEGREES_SYMB);
-
- QTest::newRow("SW with alt, dd, no hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::Degrees
- << QString("-27.46758%1, -153.02789%1, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SW with alt, dd, hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 S, 153.02789%1 W, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SW with alt, dm, no hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::DegreesMinutes
- << QString("-27%1 28.055', -153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SW with alt, dm, hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' S, 153%1 1.674' W, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SW with alt, dms, no hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::DegreesMinutesSeconds
- << QString("-27%1 28' 3.3\", -153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SW with alt, dms, hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" W, 28.2341m").arg(DEGREES_SYMB);
-
- QTest::newRow("Wrap seconds to Minutes DMSH")
- << QGeoCoordinate(1.1333333, 1.1333333) << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString( "1%1 8' 0.0\" N, 1%1 8' 0.0\" E").arg(DEGREES_SYMB);
- QTest::newRow("Wrap seconds to Minutes DMS")
- << QGeoCoordinate(1.1333333, 1.1333333) << QGeoCoordinate::DegreesMinutesSeconds
- << QString( "1%1 8' 0.0\", 1%1 8' 0.0\"").arg(DEGREES_SYMB);
- QTest::newRow("Wrap minutes to Degrees DMH")
- << QGeoCoordinate(1.999999, 1.999999) << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString( "2%1 0.000' N, 2%1 0.000' E").arg(DEGREES_SYMB);
- QTest::newRow("Wrap minutes to Degrees DM")
- << QGeoCoordinate(1.999999, 1.999999) << QGeoCoordinate::DegreesMinutes
- << QString( "2%1 0.000', 2%1 0.000'").arg(DEGREES_SYMB);
-
- QTest::newRow("Wrap seconds to minutes to Degrees DM -> above valid long/lat values")
- << QGeoCoordinate(89.999999, 179.999999) << QGeoCoordinate::DegreesMinutesSeconds
- << QString( "90%1 0' 0.0\", 180%1 0' 0.0\"").arg(DEGREES_SYMB);
-
- QTest::newRow("Seconds and minutes near valid long/lat values border")
- << QGeoCoordinate(89.9999, 179.9999) << QGeoCoordinate::DegreesMinutesSeconds
- << QString("89%1 59' 59.6\", 179%1 59' 59.6\"").arg(DEGREES_SYMB);
-
- QTest::newRow("Wrap minutes to Degrees DM ->above valid long/lat values")
- << QGeoCoordinate(89.999999, 179.999999) << QGeoCoordinate::DegreesMinutes
- << QString( "90%1 0.000', 180%1 0.000'").arg(DEGREES_SYMB);
-
- QTest::newRow("Minutes near valid long/lat values border")
- << QGeoCoordinate(89.9999, 179.9999) << QGeoCoordinate::DegreesMinutes
- << QString("89%1 59.994', 179%1 59.994'").arg(DEGREES_SYMB);
-
- QTest::newRow("Fix incorrect wrap minutes to degrees")
- << QGeoCoordinate(0.995833, 0.995833) << QGeoCoordinate::DegreesMinutes
- << QString("0%1 59.750', 0%1 59.750'").arg(DEGREES_SYMB);
-
- QTest::newRow("Fix incorrect wrap seconds to minutes")
- << QGeoCoordinate(0.9832222, 0.9832222) << QGeoCoordinate::DegreesMinutesSeconds
- << QString("0%1 58' 59.6\", 0%1 58' 59.6\"").arg(DEGREES_SYMB);
-
- }
-
- void datastream()
- {
- QFETCH(QGeoCoordinate, c);
-
- QByteArray ba;
- QDataStream out(&ba, QIODevice::WriteOnly);
- out << c;
-
- QDataStream in(&ba, QIODevice::ReadOnly);
- QGeoCoordinate inCoord;
- in >> inCoord;
- QCOMPARE(inCoord, c);
- }
-
- void datastream_data()
- {
- QTest::addColumn<QGeoCoordinate>("c");
-
- QTest::newRow("invalid") << QGeoCoordinate();
- QTest::newRow("valid lat, long") << BRISBANE;
- QTest::newRow("valid lat, long, alt") << QGeoCoordinate(-1, -1, -1);
- QTest::newRow("valid lat, long, alt again") << QGeoCoordinate(1, 1, 1);
- }
-
- void debug()
- {
- QFETCH(QGeoCoordinate, c);
- QFETCH(int, nextValue);
- QFETCH(QByteArray, debugString);
-
- qInstallMessageHandler(tst_qgeocoordinate_messageHandler);
- qDebug() << c << nextValue;
- qInstallMessageHandler(0);
- QCOMPARE(tst_qgeocoordinate_debug, debugString);
- }
-
- void debug_data()
- {
- QTest::addColumn<QGeoCoordinate>("c");
- QTest::addColumn<int>("nextValue");
- QTest::addColumn<QByteArray>("debugString");
-
- QTest::newRow("uninitialized") << QGeoCoordinate() << 45
- << QByteArray("QGeoCoordinate(?, ?) 45");
- QTest::newRow("initialized without altitude") << BRISBANE << 45
- << (QString("QGeoCoordinate(%1, %2) 45").arg(BRISBANE.latitude(), 0, 'g', 9)
- .arg(BRISBANE.longitude(), 0, 'g', 9)).toLatin1();
- QTest::newRow("invalid initialization") << QGeoCoordinate(-100,-200) << 45
- << QByteArray("QGeoCoordinate(?, ?) 45");
- QTest::newRow("initialized with altitude") << QGeoCoordinate(1,2,3) << 45
- << QByteArray("QGeoCoordinate(1, 2, 3) 45");
- QTest::newRow("extra long coordinates") << QGeoCoordinate(89.123412341, 179.123412341)
- << 45 << QByteArray("QGeoCoordinate(89.123412341, 179.12341234) 45");
- }
-
- void hash()
- {
- uint s1 = qHash(QGeoCoordinate(1, 1, 2));
- uint s2 = qHash(QGeoCoordinate(2, 1, 1));
- uint s3 = qHash(QGeoCoordinate(1, 2, 1));
- uint s10 = qHash(QGeoCoordinate(0, 0, 2));
- uint s20 = qHash(QGeoCoordinate(2, 0, 0));
- uint s30 = qHash(QGeoCoordinate(0, 2, 0));
- uint s30NoAlt = qHash(QGeoCoordinate(0, 2));
- uint s30WithSeed = qHash(QGeoCoordinate(0, 2, 0), 1);
- uint nullCoordinate = qHash(QGeoCoordinate());
-
- uint north1 = qHash(QGeoCoordinate(90.0, 34.7, 0));
- uint north2 = qHash(QGeoCoordinate(90.0, 180, 0));
-
- uint south1 = qHash(QGeoCoordinate(90.0, 67.7, 34.0));
- uint south2 = qHash(QGeoCoordinate(90.0, 111, 34.0));
-
- QVERIFY(s1 != s2);
- QVERIFY(s2 != s3);
- QVERIFY(s1 != s3);
- QVERIFY(s10 != s20);
- QVERIFY(s20 != s30);
- QVERIFY(s10 != s30);
- QVERIFY(s30NoAlt != s30);
- QVERIFY(s30WithSeed != s30);
-
- QVERIFY(nullCoordinate != s1);
- QVERIFY(nullCoordinate != s2);
- QVERIFY(nullCoordinate != s3);
- QVERIFY(nullCoordinate != s10);
- QVERIFY(nullCoordinate != s20);
- QVERIFY(nullCoordinate != s30);
- QVERIFY(nullCoordinate != s30NoAlt);
- QVERIFY(nullCoordinate != s30WithSeed);
-
- QVERIFY(north1 == north2);
- QVERIFY(south1 == south2);
- }
-};
-
-QTEST_GUILESS_MAIN(tst_QGeoCoordinate)
-#include "tst_qgeocoordinate.moc"
diff --git a/tests/auto/qgeocoordinateobject/CMakeLists.txt b/tests/auto/qgeocoordinateobject/CMakeLists.txt
deleted file mode 100644
index b8af5b9b..00000000
--- a/tests/auto/qgeocoordinateobject/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-qt_internal_add_test(tst_qgeocoordinateobject
- SOURCES
- tst_qgeocoordinateobject.cpp
- LIBRARIES
- Qt::Core
- Qt::PositioningPrivate
- Qt::TestPrivate
-)
diff --git a/tests/auto/qgeocoordinateobject/tst_qgeocoordinateobject.cpp b/tests/auto/qgeocoordinateobject/tst_qgeocoordinateobject.cpp
deleted file mode 100644
index aaf1920d..00000000
--- a/tests/auto/qgeocoordinateobject/tst_qgeocoordinateobject.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QtPositioning/private/qgeocoordinateobject_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoCoordinateObject : public QObject
-{
- Q_OBJECT
-private slots:
- void constructor();
- void equality();
- void equality_data();
- void coordinateBinding();
-};
-
-void tst_QGeoCoordinateObject::constructor()
-{
- QGeoCoordinateObject defaultConstructed;
- QCOMPARE(defaultConstructed.coordinate(), QGeoCoordinate());
-
- QGeoCoordinate c(1.0, 2.0, 3.0);
- QGeoCoordinateObject co(c);
- QCOMPARE(co.coordinate(), c);
-}
-
-void tst_QGeoCoordinateObject::equality()
-{
- QFETCH(QGeoCoordinate, lhs);
- QFETCH(QGeoCoordinate, rhs);
- QFETCH(bool, expectedResult);
-
- QGeoCoordinateObject leftObj(lhs);
- QGeoCoordinateObject rightObj(rhs);
-
- QVERIFY(leftObj == lhs);
- QVERIFY(rightObj == rhs);
-
- QCOMPARE(leftObj == rhs, expectedResult);
- QCOMPARE(leftObj != rhs, !expectedResult);
- QCOMPARE(rightObj == lhs, expectedResult);
- QCOMPARE(rightObj != lhs, !expectedResult);
- QCOMPARE(leftObj == rightObj, expectedResult);
- QCOMPARE(leftObj != rightObj, !expectedResult);
-}
-
-void tst_QGeoCoordinateObject::equality_data()
-{
- QTest::addColumn<QGeoCoordinate>("lhs");
- QTest::addColumn<QGeoCoordinate>("rhs");
- QTest::addColumn<bool>("expectedResult");
-
- QTest::newRow("two invalid") << QGeoCoordinate() << QGeoCoordinate() << true;
- QTest::newRow("same valid") << QGeoCoordinate(1.0, 2.0, 3.0) << QGeoCoordinate(1.0, 2.0, 3.0)
- << true;
- QTest::newRow("invalid vs valid") << QGeoCoordinate() << QGeoCoordinate(1.0, 2.0, 3.0) << false;
- QTest::newRow("different valid")
- << QGeoCoordinate(1.0, 2.0, 3.0) << QGeoCoordinate(2.0, 3.0, 4.0) << false;
-}
-
-void tst_QGeoCoordinateObject::coordinateBinding()
-{
- QGeoCoordinateObject obj;
- const QGeoCoordinate initial(1, 2, 3);
- const QGeoCoordinate changed(4, 5, 6);
- QTestPrivate::testReadWritePropertyBasics<QGeoCoordinateObject, QGeoCoordinate>(
- obj, initial, changed, "coordinate");
-}
-
-QTEST_GUILESS_MAIN(tst_QGeoCoordinateObject)
-#include "tst_qgeocoordinateobject.moc"
diff --git a/tests/auto/qgeolocation/CMakeLists.txt b/tests/auto/qgeolocation/CMakeLists.txt
deleted file mode 100644
index bb551612..00000000
--- a/tests/auto/qgeolocation/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Generated from qgeolocation.pro.
-
-#####################################################################
-## tst_qgeolocation Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeolocation
- SOURCES
- ../utils/qlocationtestutils.cpp ../utils/qlocationtestutils_p.h
- tst_qgeolocation.cpp tst_qgeolocation.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
diff --git a/tests/auto/qgeolocation/qgeolocation.pro b/tests/auto/qgeolocation/qgeolocation.pro
deleted file mode 100644
index 3b5b3a32..00000000
--- a/tests/auto/qgeolocation/qgeolocation.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qgeolocation
-
-HEADERS += ../utils/qlocationtestutils_p.h \
- tst_qgeolocation.h
-SOURCES += tst_qgeolocation.cpp \
- ../utils/qlocationtestutils.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeolocation/tst_qgeolocation.cpp b/tests/auto/qgeolocation/tst_qgeolocation.cpp
deleted file mode 100644
index 553d32cd..00000000
--- a/tests/auto/qgeolocation/tst_qgeolocation.cpp
+++ /dev/null
@@ -1,412 +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 "tst_qgeolocation.h"
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoPolygon>
-
-QT_USE_NAMESPACE
-
-tst_QGeoLocation::tst_QGeoLocation()
-{
-}
-
-void tst_QGeoLocation::initTestCase()
-{
-
-}
-
-void tst_QGeoLocation::cleanupTestCase()
-{
-
-}
-
-void tst_QGeoLocation::init()
-{
-}
-
-void tst_QGeoLocation::cleanup()
-{
-}
-
-void tst_QGeoLocation::constructor()
-{
- QCOMPARE(m_location.address(), m_address);
- QCOMPARE(m_location.coordinate(), m_coordinate);
- QCOMPARE(m_location.boundingShape(), m_viewport);
- QCOMPARE(m_location.extendedAttributes(), m_extendedAttributes);
-}
-
-void tst_QGeoLocation::copy_constructor()
-{
- auto qgeolocationcopy = std::make_unique<QGeoLocation>(m_location);
- QCOMPARE(m_location, *qgeolocationcopy);
-}
-
-void tst_QGeoLocation::move_constructor()
-{
- QGeoAddress address;
- address.setCity("Berlin");
- address.setCountry("Germany");
- address.setCountryCode("DEU");
- address.setDistrict("Adlershof");
- address.setPostalCode("12489");
- address.setStreet("Erich-Thilo-Strasse");
-
- QGeoLocation location;
- location.setAddress(address);
- location.setCoordinate(QGeoCoordinate(1.3, 2.4, 3.1));
- location.setBoundingShape(QGeoCircle(QGeoCoordinate(1.3, 2.4), 100));
-
- QGeoLocation locationCopy = location;
- QCOMPARE(std::move(location), locationCopy);
-}
-
-void tst_QGeoLocation::move_assignment()
-{
- QGeoAddress address;
- address.setCity("Berlin");
- address.setCountry("Germany");
- address.setCountryCode("DEU");
- address.setDistrict("Adlershof");
- address.setPostalCode("12489");
- address.setStreet("Erich-Thilo-Strasse");
-
- QGeoLocation location;
- location.setAddress(address);
- location.setCoordinate(QGeoCoordinate(1.3, 2.4, 3.1));
- location.setBoundingShape(QGeoCircle(QGeoCoordinate(1.3, 2.4), 100));
-
- QGeoLocation locationCopy = location;
-
- QGeoLocation otherLocation;
- otherLocation = std::move(location);
- QCOMPARE(otherLocation, locationCopy);
-
- // Check that (move)assignment to a moved-from object is fine
- location = std::move(locationCopy);
- QCOMPARE(location, otherLocation);
-}
-
-void tst_QGeoLocation::destructor()
-{
- QGeoLocation *qgeolocationcopy;
-
- qgeolocationcopy = new QGeoLocation();
- delete qgeolocationcopy;
-
- qgeolocationcopy = new QGeoLocation(m_location);
- delete qgeolocationcopy;
-}
-
-void tst_QGeoLocation::address()
-{
- m_address.setCity("Berlin");
- m_address.setCountry("Germany");
- m_address.setCountryCode("DEU");
- m_address.setDistrict("Mitte");
- m_address.setPostalCode("10115");
- m_address.setStreet("Invalidenstrasse");
-
- m_location.setAddress(m_address);
-
- QCOMPARE(m_location.address(),m_address);
-
- m_address.setPostalCode("10125");
- QVERIFY(m_location.address() != m_address);
-}
-
-void tst_QGeoLocation::coordinate()
-{
- m_coordinate.setLatitude(13.3851);
- m_coordinate.setLongitude(52.5312);
- m_coordinate.setAltitude(134.23);
-
- m_location.setCoordinate(m_coordinate);
-
- QCOMPARE(m_location.coordinate(), m_coordinate);
-
- m_coordinate.setAltitude(0);
- QVERIFY(m_location.coordinate() != m_coordinate);
-}
-
-void tst_QGeoLocation::viewport()
-{
- m_coordinate.setLatitude(13.3851);
- m_coordinate.setLongitude(52.5312);
-
- // rectangle bounding box
- QGeoRectangle qgeoboundingboxcopy(m_coordinate, 0.4, 0.4);
- m_location.setBoundingShape(qgeoboundingboxcopy);
-
- QCOMPARE(m_location.boundingShape(), qgeoboundingboxcopy);
- // test that QGeoShape::boundingGeoRectangle() matches with
- // the qgeoboundingboxcopy. It simplifies code porting
- QCOMPARE(m_location.boundingShape().boundingGeoRectangle(), qgeoboundingboxcopy);
-
- qgeoboundingboxcopy.setHeight(1);
-
- QVERIFY(m_location.boundingShape() != qgeoboundingboxcopy);
-
- // circle bounding box
- QGeoCircle circle(m_coordinate, 10);
- m_location.setBoundingShape(circle);
-
- QCOMPARE(m_location.boundingShape(), circle);
-
- auto point = QGeoCoordinate(0.5, 0.5);
- QVERIFY(!circle.contains(point));
- circle.extendCircle(point);
-
- QVERIFY(m_location.boundingShape() != circle);
- QVERIFY(!m_location.boundingShape().contains(point));
-
- // polygon bounding box
- const QList<QGeoCoordinate> points = {QGeoCoordinate(1.0, 1.0), QGeoCoordinate(1.0, 2.0), QGeoCoordinate(2.0, 2.0)};
- QGeoPolygon polygon(points);
-
- point = QGeoCoordinate(1.75, 1.25);
- QVERIFY(!polygon.contains(point));
-
- m_location.setBoundingShape(polygon);
- QCOMPARE(m_location.boundingShape(), polygon);
-
- polygon.addCoordinate(QGeoCoordinate(2.0, 1.0));
- QVERIFY(m_location.boundingShape() != polygon);
- QVERIFY(polygon.contains(point));
- QVERIFY(!m_location.boundingShape().contains(point));
-}
-
-void tst_QGeoLocation::extendedAttributes()
-{
- m_extendedAttributes = QVariantMap({{ "foo" , 42 }});
- m_location.setExtendedAttributes(m_extendedAttributes);
- QCOMPARE(m_location.extendedAttributes(), m_extendedAttributes);
-
- m_extendedAttributes["foo"] = 41;
- QVERIFY(m_location.extendedAttributes() != m_extendedAttributes);
-}
-
-void tst_QGeoLocation::operators()
-{
- QGeoAddress qgeoaddresscopy;
- qgeoaddresscopy.setCity("Berlin");
- qgeoaddresscopy.setCountry("Germany");
- qgeoaddresscopy.setCountryCode("DEU");
-
- QGeoCoordinate qgeocoordinatecopy (32.324 , 41.324 , 24.55);
- QVariantMap extendedAttributesCopy {{ "foo" , 42 }};
-
- m_address.setCity("Madrid");
- m_address.setCountry("Spain");
- m_address.setCountryCode("SPA");
-
- m_coordinate.setLatitude(21.3434);
- m_coordinate.setLongitude(38.43443);
- m_coordinate.setAltitude(634.21);
-
- m_extendedAttributes["foo"] = 43;
-
- m_location.setAddress(m_address);
- m_location.setCoordinate(m_coordinate);
- m_location.setExtendedAttributes(m_extendedAttributes);
-
- //Create a copy and see that they are the same
- QGeoLocation qgeolocationcopy(m_location);
- QVERIFY(m_location == qgeolocationcopy);
- QVERIFY(!(m_location != qgeolocationcopy));
-
- //Modify one and test if they are different
- qgeolocationcopy.setAddress(qgeoaddresscopy);
- QVERIFY(!(m_location == qgeolocationcopy));
- QVERIFY(m_location != qgeolocationcopy);
- qgeolocationcopy.setAddress(m_address);
- qgeolocationcopy.setCoordinate(qgeocoordinatecopy);
- QVERIFY(!(m_location == qgeolocationcopy));
- QVERIFY(m_location != qgeolocationcopy);
- qgeolocationcopy.setCoordinate(m_coordinate);
- qgeolocationcopy.setExtendedAttributes(extendedAttributesCopy);
- QVERIFY(!(m_location == qgeolocationcopy));
- QVERIFY(m_location != qgeolocationcopy);
-
-
- //delete qgeolocationcopy;
- //Asign and test that they are the same
- qgeolocationcopy = m_location;
- QVERIFY(m_location ==qgeolocationcopy);
- QVERIFY(!(m_location != qgeolocationcopy));
-}
-
-void tst_QGeoLocation::comparison()
-{
- QFETCH(QString, dataField);
-
- QGeoLocation location;
-
- //set address
- QGeoAddress address;
- address.setStreet("21 jump st");
- address.setCountry("USA");
- location.setAddress(address);
-
- //set coordinate
- location.setCoordinate(QGeoCoordinate(5,10));
-
- //set viewport
- location.setBoundingShape(QGeoRectangle(QGeoCoordinate(5,5),0.4,0.4));
-
- QGeoLocation otherLocation(location);
-
- if (dataField == "no change") {
- QCOMPARE(location, otherLocation);
- } else {
- if (dataField == "address") {
- QGeoAddress otherAddress;
- otherAddress.setStreet("42 evergreen tce");
- otherAddress.setCountry("USA");
- otherLocation.setAddress(otherAddress);
- } else if (dataField == "coordinate") {
- otherLocation.setCoordinate(QGeoCoordinate(12,13));
- } else if (dataField == "viewport"){
- otherLocation.setBoundingShape(QGeoRectangle(QGeoCoordinate(1,2), 0.5,0.5));
- } else if (dataField == "extendedAttributes"){
- otherLocation.setExtendedAttributes(QVariantMap({{"foo", 44}}));
- } else {
- qFatal("Unknown data field to test");
- }
-
- QVERIFY(location != otherLocation);
- }
-}
-
-void tst_QGeoLocation::comparison_data()
-{
- QTest::addColumn<QString> ("dataField");
- QTest::newRow("no change") << "no change";
- QTest::newRow("address") << "address";
- QTest::newRow("coordinate") << "coordinate";
- QTest::newRow("extendedAttributes") << "extendedAttributes";
-}
-
-void tst_QGeoLocation::isEmpty()
-{
- QGeoAddress address;
- address.setCity(QStringLiteral("Braunschweig"));
- QVERIFY(!address.isEmpty());
-
- QGeoRectangle boundingBox;
- boundingBox.setTopLeft(QGeoCoordinate(1, -1));
- boundingBox.setBottomRight(QGeoCoordinate(-1, 1));
- QVERIFY(!boundingBox.isEmpty());
-
- QVariantMap extendedAttributes({{"foo", 11}});
-
- QGeoLocation location;
-
- QVERIFY(location.isEmpty());
-
- // address
- location.setAddress(address);
- QVERIFY(!location.isEmpty());
- location.setAddress(QGeoAddress());
- QVERIFY(location.isEmpty());
-
- // coordinate
- location.setCoordinate(QGeoCoordinate(1, 2));
- QVERIFY(!location.isEmpty());
- location.setCoordinate(QGeoCoordinate());
- QVERIFY(location.isEmpty());
-
- // bounding box
- location.setBoundingShape(boundingBox);
- QVERIFY(!location.isEmpty());
- location.setBoundingShape(QGeoRectangle());
- QVERIFY(location.isEmpty());
-
- // extended attributes
- location.setExtendedAttributes(extendedAttributes);
- QVERIFY(!location.isEmpty());
- location.setExtendedAttributes(QVariantMap());
- QVERIFY(location.isEmpty());
-}
-
-void tst_QGeoLocation::hashing()
-{
- QFETCH(QGeoLocation, leftLocation);
- QFETCH(QGeoLocation, rightLocation);
- QFETCH(bool, result);
-
- const size_t leftHash = qHash(leftLocation);
- const size_t rightHash = qHash(rightLocation);
- QCOMPARE(leftHash == rightHash, result);
-}
-
-void tst_QGeoLocation::hashing_data()
-{
- QTest::addColumn<QGeoLocation>("leftLocation");
- QTest::addColumn<QGeoLocation>("rightLocation");
- QTest::addColumn<bool>("result");
-
- QTest::newRow("empty") << QGeoLocation() << QGeoLocation() << true;
-
- QGeoAddress address;
- address.setCity("city");
- address.setPostalCode("1234");
- address.setDistrict("district");
- address.setStreet("street");
- address.setStreetNumber("12");
-
- QGeoLocation leftLocation;
- leftLocation.setAddress(address);
- leftLocation.setCoordinate(QGeoCoordinate(1, 1));
- leftLocation.setBoundingShape(QGeoCircle(QGeoCoordinate(1, 1), 10));
-
- // do not copy, so that they have different d_ptr's
- QGeoLocation rightLocation;
- rightLocation.setAddress(address);
- rightLocation.setCoordinate(QGeoCoordinate(1, 1));
- rightLocation.setBoundingShape(QGeoCircle(QGeoCoordinate(1, 1), 10));
-
- QTest::newRow("same locations") << leftLocation << rightLocation << true;
-
- QGeoLocation rightLocationCopy = rightLocation;
- rightLocationCopy.setBoundingShape(QGeoRectangle(QGeoCoordinate(2, 0), QGeoCoordinate(0, 2)));
- QTest::newRow("different shapes") << leftLocation << rightLocationCopy << false;
-
- rightLocationCopy = rightLocation;
- rightLocationCopy.setCoordinate(QGeoCoordinate(2, 1));
- QTest::newRow("different coordinates") << leftLocation << rightLocationCopy << false;
-
- rightLocationCopy = rightLocation;
- address.setState("state");
- rightLocationCopy.setAddress(address);
- QTest::newRow("different addresses") << leftLocation << rightLocationCopy << false;
-}
-
-QTEST_APPLESS_MAIN(tst_QGeoLocation);
-
diff --git a/tests/auto/qgeolocation/tst_qgeolocation.h b/tests/auto/qgeolocation/tst_qgeolocation.h
deleted file mode 100644
index 28fae766..00000000
--- a/tests/auto/qgeolocation/tst_qgeolocation.h
+++ /dev/null
@@ -1,90 +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$
-**
-****************************************************************************/
-
-#ifndef TST_QGEOLOCATION_H
-#define TST_QGEOLOCATION_H
-
-#include <QtCore/QString>
-#include <QtTest/QtTest>
-#include <QtCore/QCoreApplication>
-#include <QMetaType>
-
-#include "../utils/qlocationtestutils_p.h"
-#include <QtPositioning/qgeoaddress.h>
-#include <QtPositioning/qgeocoordinate.h>
-#include <QtPositioning/qgeolocation.h>
-#include <QtPositioning/QGeoRectangle>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoLocation : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QGeoLocation();
-
-private Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
- //Start Unit Tests for qgeolocation.h
- void constructor();
- void copy_constructor();
- void move_constructor();
- void move_assignment();
- void destructor();
- void address();
- void coordinate();
- void viewport();
- void extendedAttributes();
- void operators();
- void comparison();
- void comparison_data();
- void isEmpty();
- void hashing();
- void hashing_data();
- //End Unit Tests for qgeolocation.h
-
-private:
- QGeoLocation m_location;
-
- QGeoAddress m_address;
- QGeoCoordinate m_coordinate;
- QGeoShape m_viewport;
- QVariantMap m_extendedAttributes;
-};
-
-Q_DECLARE_METATYPE( QGeoCoordinate::CoordinateFormat);
-Q_DECLARE_METATYPE( QGeoCoordinate::CoordinateType);
-Q_DECLARE_METATYPE( QList<double>);
-
-#endif
-
diff --git a/tests/auto/qgeopath/CMakeLists.txt b/tests/auto/qgeopath/CMakeLists.txt
deleted file mode 100644
index b301c140..00000000
--- a/tests/auto/qgeopath/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeopath.pro.
-
-#####################################################################
-## tst_qgeopath Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeopath
- SOURCES
- tst_qgeopath.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeopath.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeopath/qgeopath.pro b/tests/auto/qgeopath/qgeopath.pro
deleted file mode 100644
index eec05974..00000000
--- a/tests/auto/qgeopath/qgeopath.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qgeopath
-
-SOURCES += \
- tst_qgeopath.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeopath/tst_qgeopath.cpp b/tests/auto/qgeopath/tst_qgeopath.cpp
deleted file mode 100644
index ccaef0d7..00000000
--- a/tests/auto/qgeopath/tst_qgeopath.cpp
+++ /dev/null
@@ -1,392 +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 <QtTest/QtTest>
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoRectangle>
-#include <QtPositioning/QGeoPath>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoPath : public QObject
-{
- Q_OBJECT
-
-private slots:
- void defaultConstructor();
- void listConstructor();
- void assignment();
-
- void comparison();
- void type();
-
- void path();
- void width();
- void size();
-
- void translate_data();
- void translate();
-
- void valid_data();
- void valid();
-
- void contains_data();
- void contains();
-
- void boundingGeoRectangle_data();
- void boundingGeoRectangle();
-
- void hashing();
-};
-
-void tst_QGeoPath::defaultConstructor()
-{
- QGeoPath p;
- QVERIFY(!p.path().size());
- QCOMPARE(p.width(), qreal(0.0));
- QCOMPARE(p.length(), double(0.0));
-}
-
-void tst_QGeoPath::listConstructor()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
-
- QGeoPath p(coords, 1.0);
- QCOMPARE(p.width(), qreal(1.0));
- QCOMPARE(p.path().size(), 3);
-
- for (const QGeoCoordinate &c : coords) {
- QCOMPARE(p.path().contains(c), true);
- }
-}
-
-void tst_QGeoPath::assignment()
-{
- QGeoPath p1;
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
- QGeoPath p2(coords, 1.0);
-
- QVERIFY(p1 != p2);
-
- p1 = p2;
- QCOMPARE(p1.path(), coords);
- QCOMPARE(p1.width(), 1.0);
- QCOMPARE(p1, p2);
-
- // Assign c1 to an area
- QGeoShape area = p1;
- QCOMPARE(area.type(), p1.type());
- QVERIFY(area == p1);
-
- // Assign the area back to a bounding circle
- QGeoPath p3 = area;
- QCOMPARE(p3.path(), coords);
- QCOMPARE(p3.width(), 1.0);
-
- // Check that the copy is not modified when modifying the original.
- p1.setWidth(2.0);
- QVERIFY(p3.width() != p1.width());
- QVERIFY(p3 != p1);
-}
-
-void tst_QGeoPath::comparison()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
- QList<QGeoCoordinate> coords2;
- coords2.append(QGeoCoordinate(3,1));
- coords2.append(QGeoCoordinate(4,2));
- coords2.append(QGeoCoordinate(3,0));
- QGeoPath c1(coords, qreal(50.0));
- QGeoPath c2(coords, qreal(50.0));
- QGeoPath c3(coords, qreal(35.0));
- QGeoPath c4(coords2, qreal(50.0));
-
- QVERIFY(c1 == c2);
- QVERIFY(!(c1 != c2));
-
- QVERIFY(!(c1 == c3));
- QVERIFY(c1 != c3);
-
- QVERIFY(!(c1 == c4));
- QVERIFY(c1 != c4);
-
- QVERIFY(!(c2 == c3));
- QVERIFY(c2 != c3);
-
- QGeoRectangle b1(QGeoCoordinate(20,20),QGeoCoordinate(10,30));
- QVERIFY(!(c1 == b1));
- QVERIFY(c1 != b1);
-
- QGeoShape *c2Ptr = &c2;
- QVERIFY(c1 == *c2Ptr);
- QVERIFY(!(c1 != *c2Ptr));
-
- QGeoShape *c3Ptr = &c3;
- QVERIFY(!(c1 == *c3Ptr));
- QVERIFY(c1 != *c3Ptr);
-}
-
-void tst_QGeoPath::type()
-{
- QGeoPath c;
- QCOMPARE(c.type(), QGeoShape::PathType);
-}
-
-void tst_QGeoPath::path()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
-
- QGeoPath p;
- p.setPath(coords);
- QCOMPARE(p.path().size(), 3);
-
- for (const QGeoCoordinate &c : coords) {
- QCOMPARE(p.path().contains(c), true);
- }
-
- p.clearPath();
- QCOMPARE(p.path().size(), 0);
- QVERIFY(p.boundingGeoRectangle().isEmpty());
-}
-
-void tst_QGeoPath::width()
-{
- QGeoPath p;
- p.setWidth(10.0);
- QCOMPARE(p.width(), qreal(10.0));
-}
-
-void tst_QGeoPath::size()
-{
- QList<QGeoCoordinate> coords;
-
- QGeoPath p1(coords, 3);
- QCOMPARE(p1.size(), coords.size());
-
- coords.append(QGeoCoordinate(1,1));
- QGeoPath p2(coords, 3);
- QCOMPARE(p2.size(), coords.size());
-
- coords.append(QGeoCoordinate(2,2));
- QGeoPath p3(coords, 3);
- QCOMPARE(p3.size(), coords.size());
-
- coords.append(QGeoCoordinate(3,0));
- QGeoPath p4(coords, 3);
- QCOMPARE(p4.size(), coords.size());
-
- p4.removeCoordinate(2);
- QCOMPARE(p4.size(), coords.size() - 1);
-
- p4.removeCoordinate(coords.first());
- QCOMPARE(p4.size(), coords.size() - 2);
-}
-
-void tst_QGeoPath::translate_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<double>("lat");
- QTest::addColumn<double>("lon");
-
- QTest::newRow("Simple") << QGeoCoordinate(1,1) << QGeoCoordinate(2,2) <<
- QGeoCoordinate(3,0) << 5.0 << 4.0;
- QTest::newRow("Backward") << QGeoCoordinate(1,1) << QGeoCoordinate(2,2) <<
- QGeoCoordinate(3,0) << -5.0 << -4.0;
-}
-
-void tst_QGeoPath::translate()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(double, lat);
- QFETCH(double, lon);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPath p(coords);
-
- p.translate(lat, lon);
-
- for (int i = 0; i < p.path().size(); i++) {
- QCOMPARE(coords[i].latitude(), p.path()[i].latitude() - lat );
- QCOMPARE(coords[i].longitude(), p.path()[i].longitude() - lon );
- }
-}
-
-void tst_QGeoPath::valid_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<qreal>("width");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("empty coords") << QGeoCoordinate() << QGeoCoordinate() << QGeoCoordinate() << qreal(5.0) << false;
- QTest::newRow("invalid coord") << QGeoCoordinate(50, 50) << QGeoCoordinate(60, 60) << QGeoCoordinate(700, 700) << qreal(5.0) << false;
- QTest::newRow("bad width") << QGeoCoordinate(10, 10) << QGeoCoordinate(11, 11) << QGeoCoordinate(10, 12) << qreal(-5.0) << true;
- QTest::newRow("NaN width") << QGeoCoordinate(10, 10) << QGeoCoordinate(11, 11) << QGeoCoordinate(10, 12) << qreal(qQNaN()) << true;
- QTest::newRow("zero width") << QGeoCoordinate(10, 10) << QGeoCoordinate(11, 11) << QGeoCoordinate(10, 12) << qreal(0) << true;
- QTest::newRow("good") << QGeoCoordinate(10, 10) << QGeoCoordinate(11, 11) << QGeoCoordinate(10, 12) << qreal(5) << true;
-}
-
-void tst_QGeoPath::valid()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(qreal, width);
- QFETCH(bool, valid);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPath p(coords, width);
-
- QCOMPARE(p.isValid(), valid);
-
- QGeoShape area = p;
- QCOMPARE(area.isValid(), valid);
-}
-
-void tst_QGeoPath::contains_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<qreal>("width");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QList<QGeoCoordinate> c;
- c.append(QGeoCoordinate(1,1));
- c.append(QGeoCoordinate(2,2));
- c.append(QGeoCoordinate(3,0));
-
- QTest::newRow("One of the points") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(2, 2) << true;
- QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(0.8, 0.8) << false;
- QTest::newRow("Not so far away and large line") << c[0] << c[1] << c[2] << 100000.0 << QGeoCoordinate(0.8, 0.8) << true;
-}
-
-void tst_QGeoPath::contains()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(qreal, width);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPath p(coords, width);
-
- QCOMPARE(p.contains(probe), result);
-
- QGeoShape area = p;
- QCOMPARE(area.contains(probe), result);
-}
-
-void tst_QGeoPath::boundingGeoRectangle_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<qreal>("width");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QList<QGeoCoordinate> c;
- c.append(QGeoCoordinate(1,1));
- c.append(QGeoCoordinate(2,2));
- c.append(QGeoCoordinate(3,0));
-
- QTest::newRow("One of the points") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(2, 2) << true;
- QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(0, 0) << false;
- QTest::newRow("Inside the bounds") << c[0] << c[1] << c[2] << 100.0 << QGeoCoordinate(1, 0) << true;
- QTest::newRow("Inside the bounds") << c[0] << c[1] << c[2] << 100.0 << QGeoCoordinate(1.1, 0.1) << true;
-}
-
-void tst_QGeoPath::boundingGeoRectangle()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(qreal, width);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPath p(coords, width);
-
- QGeoRectangle box = p.boundingGeoRectangle();
- QCOMPARE(box.contains(probe), result);
-}
-
-void tst_QGeoPath::hashing()
-{
- const QGeoPath path({ QGeoCoordinate(1, 1), QGeoCoordinate(1, 2), QGeoCoordinate(2, 5) }, 1.0);
- const size_t pathHash = qHash(path);
-
- QGeoPath otherCoordsPath = path;
- otherCoordsPath.addCoordinate(QGeoCoordinate(3, 5));
- QVERIFY(qHash(otherCoordsPath) != pathHash);
-
- QGeoPath otherWidthPath = path;
- otherWidthPath.setWidth(1.5);
- QVERIFY(qHash(otherWidthPath) != pathHash);
-
- // Do not assign, so that they do not share same d_ptr
- QGeoPath similarPath({ QGeoCoordinate(1, 1), QGeoCoordinate(1, 2), QGeoCoordinate(2, 5) }, 1.0);
- QCOMPARE(qHash(similarPath), pathHash);
-}
-
-QTEST_MAIN(tst_QGeoPath)
-#include "tst_qgeopath.moc"
diff --git a/tests/auto/qgeopolygon/CMakeLists.txt b/tests/auto/qgeopolygon/CMakeLists.txt
deleted file mode 100644
index e38e2cab..00000000
--- a/tests/auto/qgeopolygon/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeopolygon.pro.
-
-#####################################################################
-## tst_qgeopolygon Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeopolygon
- SOURCES
- tst_qgeopolygon.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeopolygon.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeopolygon/qgeopolygon.pro b/tests/auto/qgeopolygon/qgeopolygon.pro
deleted file mode 100644
index f6314ca4..00000000
--- a/tests/auto/qgeopolygon/qgeopolygon.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qgeopolygon
-
-SOURCES += \
- tst_qgeopolygon.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeopolygon/tst_qgeopolygon.cpp b/tests/auto/qgeopolygon/tst_qgeopolygon.cpp
deleted file mode 100644
index 8a8a8fd7..00000000
--- a/tests/auto/qgeopolygon/tst_qgeopolygon.cpp
+++ /dev/null
@@ -1,382 +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 <QtTest/QtTest>
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoRectangle>
-#include <QtPositioning/QGeoPolygon>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoPolygon : public QObject
-{
- Q_OBJECT
-
-private slots:
- void defaultConstructor();
- void listConstructor();
- void assignment();
-
- void comparison();
- void type();
-
- void path();
- void size();
-
- void translate_data();
- void translate();
-
- void valid_data();
- void valid();
-
- void contains_data();
- void contains();
-
- void boundingGeoRectangle_data();
- void boundingGeoRectangle();
-
- void hashing();
-};
-
-void tst_QGeoPolygon::defaultConstructor()
-{
- QGeoPolygon p;
- QVERIFY(!p.perimeter().size());
- QVERIFY(!p.size());
- QVERIFY(!p.isValid());
- QVERIFY(p.isEmpty());
-}
-
-void tst_QGeoPolygon::listConstructor()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- QGeoPolygon p2(coords);
- QCOMPARE(p2.perimeter().size(), 2);
- QCOMPARE(p2.size(), 2);
- QVERIFY(!p2.isValid()); // a polygon can't have only 2 coords
- QVERIFY(!p2.isEmpty());
-
- coords.append(QGeoCoordinate(3,0));
-
- QGeoPolygon p(coords);
- QCOMPARE(p.perimeter().size(), 3);
- QCOMPARE(p.size(), 3);
- QVERIFY(p.isValid());
- QVERIFY(!p.isEmpty());
-
-
- for (const QGeoCoordinate &c : coords) {
- QCOMPARE(p.perimeter().contains(c), true);
- QCOMPARE(p.containsCoordinate(c), true);
- }
-}
-
-void tst_QGeoPolygon::assignment()
-{
- QGeoPolygon p1;
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
- QGeoPolygon p2(coords);
-
- QVERIFY(p1 != p2);
-
- p1 = p2;
- QCOMPARE(p1.perimeter(), coords);
- QCOMPARE(p1, p2);
-
- // Assign c1 to an area
- QGeoShape area = p1;
- QCOMPARE(area.type(), p1.type());
- QVERIFY(area == p1);
-
- // Assign the area back to a polygon
- QGeoPolygon p3 = area;
- QCOMPARE(p3.perimeter(), coords);
- QVERIFY(p3 == p1);
-
- // Check that the copy is not modified when modifying the original.
- p1.addCoordinate(QGeoCoordinate(4,0));
- QVERIFY(p3 != p1);
-}
-
-void tst_QGeoPolygon::comparison()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
- QList<QGeoCoordinate> coords2;
- coords2.append(QGeoCoordinate(3,1));
- coords2.append(QGeoCoordinate(4,2));
- coords2.append(QGeoCoordinate(3,0));
- QGeoPolygon c1(coords);
- QGeoPolygon c2(coords);
- QGeoPolygon c3(coords2);
-
- QVERIFY(c1 == c2);
- QVERIFY(!(c1 != c2));
-
- QVERIFY(!(c1 == c3));
- QVERIFY(c1 != c3);
-
- QVERIFY(!(c2 == c3));
- QVERIFY(c2 != c3);
-
- QGeoRectangle b1(QGeoCoordinate(20,20),QGeoCoordinate(10,30));
- QVERIFY(!(c1 == b1));
- QVERIFY(c1 != b1);
-
- QGeoShape *c2Ptr = &c2;
- QVERIFY(c1 == *c2Ptr);
- QVERIFY(!(c1 != *c2Ptr));
-
- QGeoShape *c3Ptr = &c3;
- QVERIFY(!(c1 == *c3Ptr));
- QVERIFY(c1 != *c3Ptr);
-}
-
-void tst_QGeoPolygon::type()
-{
- QGeoPolygon c;
- QCOMPARE(c.type(), QGeoShape::PolygonType);
-}
-
-void tst_QGeoPolygon::path()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
-
- QGeoPolygon p;
- p.setPerimeter(coords);
- QCOMPARE(p.perimeter().size(), 3);
- QCOMPARE(p.size(), 3);
-
- for (const QGeoCoordinate &c : coords) {
- QCOMPARE(p.perimeter().contains(c), true);
- QCOMPARE(p.containsCoordinate(c), true);
- }
-}
-
-void tst_QGeoPolygon::size()
-{
- QList<QGeoCoordinate> coords;
-
- QGeoPolygon p1(coords);
- QCOMPARE(p1.size(), coords.size());
-
- coords.append(QGeoCoordinate(1,1));
- QGeoPolygon p2(coords);
- QCOMPARE(p2.size(), coords.size());
-
- coords.append(QGeoCoordinate(2,2));
- QGeoPolygon p3(coords);
- QCOMPARE(p3.size(), coords.size());
-
- coords.append(QGeoCoordinate(3,0));
- QGeoPolygon p4(coords);
- QCOMPARE(p4.size(), coords.size());
-
- p4.removeCoordinate(2);
- QCOMPARE(p4.size(), coords.size() - 1);
-
- p4.removeCoordinate(coords.first());
- QCOMPARE(p4.size(), coords.size() - 2);
-}
-
-void tst_QGeoPolygon::translate_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<double>("lat");
- QTest::addColumn<double>("lon");
-
- QTest::newRow("Simple") << QGeoCoordinate(1,1) << QGeoCoordinate(2,2) <<
- QGeoCoordinate(3,0) << 5.0 << 4.0;
- QTest::newRow("Backward") << QGeoCoordinate(1,1) << QGeoCoordinate(2,2) <<
- QGeoCoordinate(3,0) << -5.0 << -4.0;
-}
-
-void tst_QGeoPolygon::translate()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(double, lat);
- QFETCH(double, lon);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPolygon p(coords);
-
- p.translate(lat, lon);
-
- for (int i = 0; i < p.perimeter().size(); i++) {
- QCOMPARE(coords[i].latitude(), p.perimeter()[i].latitude() - lat );
- QCOMPARE(coords[i].longitude(), p.perimeter()[i].longitude() - lon );
- }
-}
-
-void tst_QGeoPolygon::valid_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("empty coords") << QGeoCoordinate() << QGeoCoordinate() << QGeoCoordinate() << false;
- QTest::newRow("invalid coord") << QGeoCoordinate(50, 50) << QGeoCoordinate(60, 60) << QGeoCoordinate(700, 700) << false;
- QTest::newRow("good") << QGeoCoordinate(10, 10) << QGeoCoordinate(11, 11) << QGeoCoordinate(10, 12) << true;
-}
-
-void tst_QGeoPolygon::valid()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(bool, valid);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPolygon p(coords);
-
- QCOMPARE(p.isValid(), valid);
-
- QGeoShape area = p;
- QCOMPARE(area.isValid(), valid);
-}
-
-void tst_QGeoPolygon::contains_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QList<QGeoCoordinate> c;
- c.append(QGeoCoordinate(1,1));
- c.append(QGeoCoordinate(2,2));
- c.append(QGeoCoordinate(3,0));
-
- QTest::newRow("One of the points") << c[0] << c[1] << c[2] << QGeoCoordinate(2, 2) << true;
- QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << QGeoCoordinate(0.8, 0.8) << false;
- QTest::newRow("Not so far away and large line") << c[0] << c[1] << c[2] << QGeoCoordinate(0.8, 0.8) << false;
- QTest::newRow("Inside") << c[0] << c[1] << c[2] << QGeoCoordinate(2.0, 1.0) << true;
-}
-
-void tst_QGeoPolygon::contains()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPolygon p(coords);
-
- QCOMPARE(p.contains(probe), result);
-
- QGeoShape area = p;
- QCOMPARE(area.contains(probe), result);
-}
-
-void tst_QGeoPolygon::boundingGeoRectangle_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QList<QGeoCoordinate> c;
- c.append(QGeoCoordinate(1,1));
- c.append(QGeoCoordinate(2,2));
- c.append(QGeoCoordinate(3,0));
-
- QTest::newRow("One of the points") << c[0] << c[1] << c[2] << QGeoCoordinate(2, 2) << true;
- QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << QGeoCoordinate(0, 0) << false;
- QTest::newRow("Inside the bounds") << c[0] << c[1] << c[2] << QGeoCoordinate(1, 0) << true;
- QTest::newRow("Inside the bounds") << c[0] << c[1] << c[2] << QGeoCoordinate(1.1, 0.1) << true;
-}
-
-void tst_QGeoPolygon::boundingGeoRectangle()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPolygon p(coords);
-
- QGeoRectangle box = p.boundingGeoRectangle();
- QCOMPARE(box.contains(probe), result);
-}
-
-void tst_QGeoPolygon::hashing()
-{
- const QGeoPolygon polygon({ QGeoCoordinate(1, 1), QGeoCoordinate(2, 2),
- QGeoCoordinate(3, 0) });
- const size_t polygonHash = qHash(polygon);
-
- QGeoPolygon otherCoordsPolygon = polygon;
- otherCoordsPolygon.addCoordinate(QGeoCoordinate(4, 1));
- QVERIFY(qHash(otherCoordsPolygon) != polygonHash);
-
- QGeoPolygon otherHolesPolygon = polygon;
- otherHolesPolygon.addHole({ QGeoCoordinate(1.1, 1), QGeoCoordinate(2, 1.8),
- QGeoCoordinate(2, 1) });
- QVERIFY(qHash(otherHolesPolygon) != polygonHash);
-
- // Do not assign, so that they do not share same d_ptr
- QGeoPolygon similarPolygon({ QGeoCoordinate(1, 1), QGeoCoordinate(2, 2),
- QGeoCoordinate(3, 0) });
- QCOMPARE(qHash(similarPolygon), polygonHash);
-}
-
-QTEST_MAIN(tst_QGeoPolygon)
-#include "tst_qgeopolygon.moc"
diff --git a/tests/auto/qgeopositioninfo/CMakeLists.txt b/tests/auto/qgeopositioninfo/CMakeLists.txt
deleted file mode 100644
index 3ce93cff..00000000
--- a/tests/auto/qgeopositioninfo/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeopositioninfo.pro.
-
-#####################################################################
-## tst_qgeopositioninfo Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeopositioninfo
- SOURCES
- tst_qgeopositioninfo.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeopositioninfo.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeopositioninfo/qgeopositioninfo.pro b/tests/auto/qgeopositioninfo/qgeopositioninfo.pro
deleted file mode 100644
index f928c8bc..00000000
--- a/tests/auto/qgeopositioninfo/qgeopositioninfo.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-TARGET=tst_qgeopositioninfo
-
-SOURCES += tst_qgeopositioninfo.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp b/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp
deleted file mode 100644
index 572359e2..00000000
--- a/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp
+++ /dev/null
@@ -1,420 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include <QtPositioning/qgeopositioninfo.h>
-
-#include <QMetaType>
-#include <QObject>
-#include <QDebug>
-#include <QTest>
-#include <QtCore/QtNumeric>
-
-#include <float.h>
-
-QT_USE_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoPositionInfo::Attribute)
-
-QByteArray tst_qgeopositioninfo_debug;
-
-void tst_qgeopositioninfo_messageHandler(QtMsgType type, const QMessageLogContext&, const QString &msg)
-{
- switch (type) {
- case QtDebugMsg :
- tst_qgeopositioninfo_debug = msg.toLocal8Bit();
- break;
- default:
- break;
- }
-}
-
-QList<qreal> tst_qgeopositioninfo_qrealTestValues()
-{
- QList<qreal> values;
-
- if (qreal(DBL_MIN) == DBL_MIN)
- values << DBL_MIN;
-
- values << FLT_MIN;
- values << -1.0 << 0.0 << 1.0;
- values << FLT_MAX;
-
- if (qreal(DBL_MAX) == DBL_MAX)
- values << DBL_MAX;
-
- return values;
-}
-
-QList<QGeoPositionInfo::Attribute> tst_qgeopositioninfo_getAttributes()
-{
- QList<QGeoPositionInfo::Attribute> attributes;
- attributes << QGeoPositionInfo::Direction
- << QGeoPositionInfo::GroundSpeed
- << QGeoPositionInfo::VerticalSpeed
- << QGeoPositionInfo::MagneticVariation
- << QGeoPositionInfo::HorizontalAccuracy
- << QGeoPositionInfo::VerticalAccuracy;
- return attributes;
-}
-
-
-class tst_QGeoPositionInfo : public QObject
-{
- Q_OBJECT
-
-private:
- QGeoPositionInfo infoWithAttribute(QGeoPositionInfo::Attribute attribute, qreal value)
- {
- QGeoPositionInfo info;
- info.setAttribute(attribute, value);
- return info;
- }
-
- void addTestData_info()
- {
- QTest::addColumn<QGeoPositionInfo>("info");
-
- QTest::newRow("invalid") << QGeoPositionInfo();
-
- QTest::newRow("coord") << QGeoPositionInfo(QGeoCoordinate(-27.3422,150.2342), QDateTime());
- QTest::newRow("datetime") << QGeoPositionInfo(QGeoCoordinate(), QDateTime::currentDateTime());
-
- QList<QGeoPositionInfo::Attribute> attributes = tst_qgeopositioninfo_getAttributes();
- QList<qreal> values = tst_qgeopositioninfo_qrealTestValues();
- for (int i=0; i<attributes.count(); i++) {
- for (int j=0; j<values.count(); j++) {
- QTest::newRow(qPrintable(QString("Attribute %1 = %2").arg(attributes[i]).arg(values[j])))
- << infoWithAttribute(attributes[i], values[j]);
- }
- }
- }
-
-private slots:
- void constructor()
- {
- QGeoPositionInfo info;
- QVERIFY(!info.isValid());
- QVERIFY(!info.coordinate().isValid());
- QVERIFY(info.timestamp().isNull());
- }
-
- void constructor_coord_dateTime()
- {
- QFETCH(QGeoCoordinate, coord);
- QFETCH(QDateTime, dateTime);
- QFETCH(bool, valid);
-
- QGeoPositionInfo info(coord, dateTime);
- QCOMPARE(info.coordinate(), coord);
- QCOMPARE(info.timestamp(), dateTime);
- QCOMPARE(info.isValid(), valid);
- }
-
- void constructor_coord_dateTime_data()
- {
- QTest::addColumn<QGeoCoordinate>("coord");
- QTest::addColumn<QDateTime>("dateTime");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("both null") << QGeoCoordinate() << QDateTime() << false;
- QTest::newRow("both valid") << QGeoCoordinate(1,1) << QDateTime::currentDateTime() << true;
- QTest::newRow("valid coord") << QGeoCoordinate(1,1) << QDateTime() << false;
- QTest::newRow("valid datetime") << QGeoCoordinate() << QDateTime::currentDateTime() << false;
- QTest::newRow("valid time but not date == invalid")
- << QGeoCoordinate() << QDateTime(QDate(), QTime::currentTime()) << false;
- QTest::newRow("valid date but not time == valid due to QDateTime constructor")
- << QGeoCoordinate() << QDateTime(QDate::currentDate(), QTime()) << false;
- }
-
- void constructor_copy()
- {
- QFETCH(QGeoPositionInfo, info);
-
- QCOMPARE(QGeoPositionInfo(info), info);
- }
-
- void constructor_copy_data()
- {
- addTestData_info();
- }
-
- void constructor_move()
- {
- QFETCH(QGeoPositionInfo, info);
- QGeoPositionInfo infoCopy = info;
- QCOMPARE(QGeoPositionInfo(std::move(info)), infoCopy);
- // The moved-from object will go out of scope and will be destroyed
- // here, so we also implicitly check that moved-from object's destructor
- // is called without any issues.
- }
-
- void constructor_move_data()
- {
- addTestData_info();
- }
-
- void operator_assign()
- {
- QFETCH(QGeoPositionInfo, info);
-
- QGeoPositionInfo info2;
- info2 = info;
- QCOMPARE(info2, info);
- }
-
- void operator_assign_data()
- {
- addTestData_info();
- }
-
- void operator_move_assign()
- {
- QFETCH(QGeoPositionInfo, info);
- QGeoPositionInfo infoCopy = info;
-
- QGeoPositionInfo obj;
- obj = std::move(info);
- QCOMPARE(obj, infoCopy);
-
- // check that (move)assigning to the moved-from object is ok
- info = std::move(infoCopy);
- QCOMPARE(info, obj);
- }
-
- void operator_move_assign_data()
- {
- addTestData_info();
- }
-
- void operator_equals()
- {
- QFETCH(QGeoPositionInfo, info);
-
- QVERIFY(info == info);
- if (info.isValid())
- QCOMPARE(info == QGeoPositionInfo(), false);
- }
-
- void operator_equals_data()
- {
- addTestData_info();
- }
-
- void operator_notEquals()
- {
- QFETCH(QGeoPositionInfo, info);
-
- QCOMPARE(info != info, false);
- if (info.isValid())
- QCOMPARE(info != QGeoPositionInfo(), true);
- }
-
- void operator_notEquals_data()
- {
- addTestData_info();
- }
-
- void setDateTime()
- {
- QFETCH(QDateTime, dateTime);
-
- QGeoPositionInfo info;
- info.setTimestamp(dateTime);
- QCOMPARE(info.timestamp(), dateTime);
- }
-
- void setDateTime_data()
- {
- QTest::addColumn<QDateTime>("dateTime");
- QTest::newRow("invalid") << QDateTime();
- QTest::newRow("now") << QDateTime::currentDateTime();
- }
-
- void dateTime()
- {
- QGeoPositionInfo info;
- QVERIFY(info.timestamp().isNull());
- }
-
- void setCoordinate()
- {
-
- QFETCH(QGeoCoordinate, coord);
-
- QGeoPositionInfo info;
- info.setCoordinate(coord);
- QCOMPARE(info.coordinate(), coord);
- }
-
- void setCoordinate_data()
- {
- QTest::addColumn<QGeoCoordinate>("coord");
-
- QTest::newRow("invalid") << QGeoCoordinate();
- QTest::newRow("valid") << QGeoCoordinate(30,30);
- }
-
- void attribute()
- {
- QFETCH(QGeoPositionInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoPositionInfo info;
- QVERIFY(qIsNaN(info.attribute(attribute)));
-
- info.setAttribute(attribute, value);
- QCOMPARE(info.attribute(attribute), value);
-
- info.removeAttribute(attribute);
- QVERIFY(qIsNaN(info.attribute(attribute)));
- }
-
- void attribute_data()
- {
- QTest::addColumn<QGeoPositionInfo::Attribute>("attribute");
- QTest::addColumn<qreal>("value");
-
- QList<QGeoPositionInfo::Attribute> attributes = tst_qgeopositioninfo_getAttributes();
- QList<qreal> values = tst_qgeopositioninfo_qrealTestValues();
- for (int i=0; i<attributes.count(); i++) {
- for (int j=0; j<values.count(); j++) {
- QTest::newRow(qPrintable(QString("Attribute %1 = %2").arg(attributes[i]).arg(values[j])))
- << attributes[i] << values[j];
- }
- }
- }
-
- void hasAttribute()
- {
- QFETCH(QGeoPositionInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoPositionInfo info;
- QVERIFY(!info.hasAttribute(attribute));
-
- info.setAttribute(attribute, value);
- QVERIFY(info.hasAttribute(attribute));
-
- info.removeAttribute(attribute);
- QVERIFY(!info.hasAttribute(attribute));
- }
-
- void hasAttribute_data()
- {
- attribute_data();
- }
-
- void removeAttribute()
- {
- QFETCH(QGeoPositionInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoPositionInfo info;
- QVERIFY(!info.hasAttribute(attribute));
-
- info.setAttribute(attribute, value);
- QVERIFY(info.hasAttribute(attribute));
-
- info.removeAttribute(attribute);
- QVERIFY(!info.hasAttribute(attribute));
-
- info.setAttribute(attribute, value);
- QVERIFY(info.hasAttribute(attribute));
- }
-
- void removeAttribute_data()
- {
- attribute_data();
- }
-
- void datastream()
- {
- QFETCH(QGeoPositionInfo, info);
-
- QByteArray ba;
- QDataStream out(&ba, QIODevice::WriteOnly);
- out << info;
-
- QDataStream in(&ba, QIODevice::ReadOnly);
- QGeoPositionInfo inInfo;
- in >> inInfo;
- QCOMPARE(inInfo, info);
- }
-
- void datastream_data()
- {
- addTestData_info();
- }
-
- void debug()
- {
- QFETCH(QGeoPositionInfo, info);
- QFETCH(int, nextValue);
- QFETCH(QByteArray, debugStringEnd);
-
- qInstallMessageHandler(tst_qgeopositioninfo_messageHandler);
- qDebug() << info << nextValue;
- qInstallMessageHandler(0);
-
- // use endsWith() so we don't depend on QDateTime's debug() implementation
- QVERIFY2(tst_qgeopositioninfo_debug.endsWith(debugStringEnd),
- qPrintable(QString::fromLatin1("'%1' does not end with '%2'").
- arg(QLatin1String(tst_qgeopositioninfo_debug),
- QLatin1String(debugStringEnd))));
- }
-
- void debug_data()
- {
- QTest::addColumn<QGeoPositionInfo>("info");
- QTest::addColumn<int>("nextValue");
- QTest::addColumn<QByteArray>("debugStringEnd");
-
- QTest::newRow("no values") << QGeoPositionInfo() << 40
- << QString("QGeoCoordinate(?, ?)) 40").toLatin1();
-
- QGeoCoordinate coord(1, 1);
- QTest::newRow("coord, time") << QGeoPositionInfo(coord, QDateTime::currentDateTime())
- << 40 << QByteArray("QGeoCoordinate(1, 1)) 40");
-
- QGeoPositionInfo info;
- info.setAttribute(QGeoPositionInfo::Direction, 1.1);
- info.setAttribute(QGeoPositionInfo::GroundSpeed, 2.1);
- info.setAttribute(QGeoPositionInfo::VerticalSpeed, 3.1);
- info.setAttribute(QGeoPositionInfo::MagneticVariation, 4.1);
- info.setAttribute(QGeoPositionInfo::HorizontalAccuracy, 5.1);
- info.setAttribute(QGeoPositionInfo::VerticalAccuracy, 6.1);
- QTest::newRow("all attributes") << info << 40
- << QByteArray("QGeoCoordinate(?, ?), Direction=1.1, GroundSpeed=2.1, VerticalSpeed=3.1, MagneticVariation=4.1, HorizontalAccuracy=5.1, VerticalAccuracy=6.1) 40");
- }
-};
-
-
-QTEST_APPLESS_MAIN(tst_QGeoPositionInfo)
-#include "tst_qgeopositioninfo.moc"
diff --git a/tests/auto/qgeopositioninfosource/CMakeLists.txt b/tests/auto/qgeopositioninfosource/CMakeLists.txt
deleted file mode 100644
index 361b69e7..00000000
--- a/tests/auto/qgeopositioninfosource/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# Generated from qgeopositioninfosource.pro.
-
-#####################################################################
-## tst_qgeopositioninfosource Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeopositioninfosource
- SOURCES
- ../utils/qlocationtestutils.cpp ../utils/qlocationtestutils_p.h
- testqgeopositioninfosource.cpp testqgeopositioninfosource_p.h
- tst_qgeopositioninfosource.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qgeopositioninfosource.pro:<TRUE>:
-# TEMPLATE = "app"
-# testcase.timeout = "400"
diff --git a/tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro b/tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro
deleted file mode 100644
index ee494251..00000000
--- a/tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-testcase.timeout = 400 # this test is slow
-TARGET=tst_qgeopositioninfosource
-
-HEADERS += ../utils/qlocationtestutils_p.h \
- testqgeopositioninfosource_p.h
-
-SOURCES += ../utils/qlocationtestutils.cpp \
- testqgeopositioninfosource.cpp \
- tst_qgeopositioninfosource.cpp
-
-CONFIG -= app_bundle
-
-QT += positioning testlib
diff --git a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp b/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp
deleted file mode 100644
index 2ddcc9a0..00000000
--- a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp
+++ /dev/null
@@ -1,807 +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 <QMetaType>
-#include <QSignalSpy>
-#include <QDebug>
-#include <QTimer>
-
-#include <limits.h>
-
-#include <qnumeric.h>
-#include <QtPositioning/qgeopositioninfosource.h>
-#include <QtPositioning/qgeopositioninfo.h>
-
-#include "testqgeopositioninfosource_p.h"
-#include "../utils/qlocationtestutils_p.h"
-
-Q_DECLARE_METATYPE(QGeoPositionInfoSource::PositioningMethod)
-Q_DECLARE_METATYPE(QGeoPositionInfoSource::PositioningMethods)
-
-#define MAX_WAITING_TIME 50000
-
-// Must provide a valid source, unless testing the source
-// returned by QGeoPositionInfoSource::createDefaultSource() on a system
-// that has no default source
-#define CHECK_SOURCE_VALID { \
- if (!m_source) { \
- if (m_testingDefaultSource && QGeoPositionInfoSource::createDefaultSource(0) == 0) \
- QSKIP("No default position source on this system"); \
- else \
- QFAIL("createTestSource() must return a valid source!"); \
- } \
- }
-
-class MyPositionSource : public QGeoPositionInfoSource
-{
- Q_OBJECT
-public:
- MyPositionSource(QObject *parent = 0)
- : QGeoPositionInfoSource(parent) {
- }
-
- QGeoPositionInfo lastKnownPosition(bool /*fromSatellitePositioningMethodsOnly = false*/) const override {
- return QGeoPositionInfo();
- }
-
- void setSupportedPositioningMethods(PositioningMethods methods) {
- m_methods = methods;
- }
-
- virtual PositioningMethods supportedPositioningMethods() const override {
- return m_methods;
- }
- virtual int minimumUpdateInterval() const override {
- return 0;
- }
-
- virtual void startUpdates() override {}
- virtual void stopUpdates() override {}
-
- virtual void requestUpdate(int) override {}
-
- Error error() const override { return QGeoPositionInfoSource::NoError; }
-
-private:
- PositioningMethods m_methods;
-};
-
-class DefaultSourceTest : public TestQGeoPositionInfoSource
-{
- Q_OBJECT
-protected:
- QGeoPositionInfoSource *createTestSource() override {
- return QGeoPositionInfoSource::createSource(QStringLiteral("test.source"), 0);
- }
-};
-
-
-TestQGeoPositionInfoSource::TestQGeoPositionInfoSource(QObject *parent)
- : QObject(parent)
-{
- m_testingDefaultSource = false;
-#if QT_CONFIG(library)
- /*
- * Set custom path since CI doesn't install test plugins
- */
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
- + QStringLiteral("/../../../plugins"));
-#endif
-#endif
-}
-
-TestQGeoPositionInfoSource *TestQGeoPositionInfoSource::createDefaultSourceTest()
-{
- DefaultSourceTest *test = new DefaultSourceTest;
- test->m_testingDefaultSource = true;
- return test;
-}
-
-void TestQGeoPositionInfoSource::test_slot1()
-{
-}
-
-void TestQGeoPositionInfoSource::test_slot2()
-{
- m_testSlot2Called = true;
-}
-
-void TestQGeoPositionInfoSource::base_initTestCase()
-{
-
-}
-
-void TestQGeoPositionInfoSource::base_init()
-{
- m_source = createTestSource();
- m_testSlot2Called = false;
-}
-
-void TestQGeoPositionInfoSource::base_cleanup()
-{
- delete m_source;
- m_source = 0;
-}
-
-void TestQGeoPositionInfoSource::base_cleanupTestCase()
-{
-}
-
-void TestQGeoPositionInfoSource::initTestCase()
-{
- base_initTestCase();
-}
-
-void TestQGeoPositionInfoSource::init()
-{
- base_init();
-}
-
-void TestQGeoPositionInfoSource::cleanup()
-{
- base_cleanup();
-}
-
-void TestQGeoPositionInfoSource::cleanupTestCase()
-{
- base_cleanupTestCase();
-}
-
-// TC_ID_3_x_1
-void TestQGeoPositionInfoSource::constructor_withParent()
-{
- auto parent = std::make_unique<QObject>();
- new MyPositionSource(parent.get());
-}
-
-// TC_ID_3_x_2
-void TestQGeoPositionInfoSource::constructor_noParent()
-{
- MyPositionSource *obj = new MyPositionSource();
- delete obj;
-}
-
-void TestQGeoPositionInfoSource::updateInterval()
-{
- MyPositionSource s;
- QCOMPARE(s.updateInterval(), 0);
-}
-
-void TestQGeoPositionInfoSource::setPreferredPositioningMethods()
-{
- QFETCH(QGeoPositionInfoSource::PositioningMethod, supported);
- QFETCH(QGeoPositionInfoSource::PositioningMethod, preferred);
- QFETCH(QGeoPositionInfoSource::PositioningMethod, resulting);
-
- MyPositionSource s;
- s.setSupportedPositioningMethods(supported);
- s.setPreferredPositioningMethods(preferred);
- QCOMPARE(s.preferredPositioningMethods(), resulting);
-}
-
-void TestQGeoPositionInfoSource::setPreferredPositioningMethods_data()
-{
- QTest::addColumn<QGeoPositionInfoSource::PositioningMethod>("supported");
- QTest::addColumn<QGeoPositionInfoSource::PositioningMethod>("preferred");
- QTest::addColumn<QGeoPositionInfoSource::PositioningMethod>("resulting");
-
- QTest::newRow("Sat supported, Sat preferred")
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods;
- QTest::newRow("Sat supported, Non-Sat preferred")
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods;
- QTest::newRow("Sat supported, All preferred")
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods;
-
- QTest::newRow("Non-Sat supported, Sat preferred")
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods;
- QTest::newRow("Non-Sat supported, Non-Sat preferred")
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods;
- QTest::newRow("Non-Sat supported, All preferred")
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods;
-
- QTest::newRow("All supported, Sat preferred")
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods;
- QTest::newRow("All supported, Non-Sat preferred")
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods;
- QTest::newRow("All supported, All preferred")
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::AllPositioningMethods;
-}
-
-void TestQGeoPositionInfoSource::preferredPositioningMethods()
-{
- MyPositionSource s;
- QCOMPARE(s.preferredPositioningMethods(), 0);
-}
-
-//TC_ID_3_x_1 : Create a position source with the given parent that reads from the system's default
-// sources of location data
-void TestQGeoPositionInfoSource::createDefaultSource()
-{
- auto parent = std::make_unique<QObject>();
-
- // source will be deleted when parent goes out of scope
- QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(parent.get());
- // now all platforms have the dummy plugin at least
- QVERIFY(source != nullptr);
-}
-
-void TestQGeoPositionInfoSource::setUpdateInterval()
-{
- CHECK_SOURCE_VALID;
-
- QFETCH(int, interval);
- QFETCH(int, expectedInterval);
-
- m_source->setUpdateInterval(interval);
- QCOMPARE(m_source->updateInterval(), expectedInterval);
-}
-
-void TestQGeoPositionInfoSource::setUpdateInterval_data()
-{
- QTest::addColumn<int>("interval");
- QTest::addColumn<int>("expectedInterval");
- QGeoPositionInfoSource *source = createTestSource();
- int minUpdateInterval = source ? source->minimumUpdateInterval() : -1;
- if (source)
- delete source;
-
- QTest::newRow("0") << 0 << 0;
-
- if (minUpdateInterval > -1) {
- QTest::newRow("INT_MIN") << INT_MIN << minUpdateInterval;
- QTest::newRow("-1") << -1 << minUpdateInterval;
- }
-
- if (minUpdateInterval > 0) {
- QTest::newRow("more than minInterval") << minUpdateInterval + 1 << minUpdateInterval + 1;
- QTest::newRow("equal to minInterval") << minUpdateInterval << minUpdateInterval;
- }
-
- if (minUpdateInterval > 1) {
- QTest::newRow("less then minInterval") << minUpdateInterval - 1 << minUpdateInterval;
- QTest::newRow("in btw zero and minInterval") << 1 << minUpdateInterval;
- }
-}
-
-void TestQGeoPositionInfoSource::lastKnownPosition()
-{
- CHECK_SOURCE_VALID;
- QFETCH(QGeoPositionInfoSource::PositioningMethod, positioningMethod);
- QFETCH(bool, lastKnownPositionArgument);
-
- if ((m_source->supportedPositioningMethods() & positioningMethod) == 0)
- QSKIP("Not a supported positioning method for this position source");
-
- m_source->setPreferredPositioningMethods(positioningMethod);
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(1000);
- m_source->startUpdates();
-
- // Use QEventLoop instead of qWait() to ensure we stop as soon as a
- // position is emitted (otherwise the lastKnownPosition() may have
- // changed by the time it is checked)
- QEventLoop loop;
- QTimer timer;
- //simulated CI tests will quickly return -> real GPS tests take 2 minutes for satellite systems
- //use a 5 min timeout
- timer.setInterval(300000);
- connect(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)),
- &loop, SLOT(quit()));
- connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
- timer.start();
- loop.exec();
-
- QVERIFY((spy.count() > 0) && (timeout.count() == 0));
-
- QList<QVariant> list = spy.takeFirst();
- QGeoPositionInfo info = list.at(0).value<QGeoPositionInfo>();
- QGeoPositionInfo lastPositioninfo = m_source->lastKnownPosition(lastKnownPositionArgument);
-
- // lastPositioninfo is only gauranteed to be valid in all cases when only using satelite
- // positioning methods or when lastKnownPositionArgument is false
- if (!lastKnownPositionArgument ||
- positioningMethod == QGeoPositionInfoSource::SatellitePositioningMethods) {
- QVERIFY(lastPositioninfo.isValid());
- }
-
- if (lastPositioninfo.isValid()) {
- QCOMPARE(info.coordinate(), lastPositioninfo.coordinate());
- // On some CI machines the above evenloop code is not sufficient as positionUpdated
- // still fires causing last know position and last update to be out of sync.
- // To accommodate we check that the time stamps are no more than 1s apart
- // ideally they should be the same
- // doesn't work: QCOMPARE(info.timestamp(), lastPositioninfo.timestamp());
- const qint64 diff = qAbs(info.timestamp().msecsTo(lastPositioninfo.timestamp()));
- QCOMPARE(diff < 1000, true);
-
- QCOMPARE(info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy),
- lastPositioninfo.hasAttribute(QGeoPositionInfo::HorizontalAccuracy));
-
- if (info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy)) {
- bool isNaN1 = qIsNaN(info.attribute(QGeoPositionInfo::HorizontalAccuracy));
- bool isNaN2 = qIsNaN(lastPositioninfo.attribute(QGeoPositionInfo::HorizontalAccuracy));
- QCOMPARE(isNaN1, isNaN2);
- if (!isNaN1) {
- QCOMPARE(qFuzzyCompare(info.attribute(QGeoPositionInfo::HorizontalAccuracy),
- lastPositioninfo.attribute(QGeoPositionInfo::HorizontalAccuracy)), true);
- }
- }
-
- QCOMPARE(info.hasAttribute(QGeoPositionInfo::VerticalAccuracy),
- lastPositioninfo.hasAttribute(QGeoPositionInfo::VerticalAccuracy));
-
- if (info.hasAttribute(QGeoPositionInfo::VerticalAccuracy)) {
- bool isNaN1 = qIsNaN(info.attribute(QGeoPositionInfo::VerticalAccuracy));
- bool isNaN2 = qIsNaN(lastPositioninfo.attribute(QGeoPositionInfo::VerticalAccuracy));
- QCOMPARE(isNaN1, isNaN2);
- if (!isNaN1) {
- QCOMPARE(qFuzzyCompare(info.attribute(QGeoPositionInfo::VerticalAccuracy),
- lastPositioninfo.attribute(QGeoPositionInfo::VerticalAccuracy)), true);
- }
- }
- }
-
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::lastKnownPosition_data()
-{
- QTest::addColumn<QGeoPositionInfoSource::PositioningMethod>("positioningMethod");
- QTest::addColumn<bool>("lastKnownPositionArgument");
-
- // no good way to determine on MeeGo what are supported. If we ask for all or non-satellites, we
- // typically get geoclue-example provider, which is not suitable for this test.
- QTest::newRow("all - false") << QGeoPositionInfoSource::AllPositioningMethods << false;
- QTest::newRow("all - true") << QGeoPositionInfoSource::AllPositioningMethods << true;
- QTest::newRow("satellite - false") << QGeoPositionInfoSource::SatellitePositioningMethods << false;
- QTest::newRow("satellite - true") << QGeoPositionInfoSource::SatellitePositioningMethods << true;
-}
-
-void TestQGeoPositionInfoSource::minimumUpdateInterval()
-{
- CHECK_SOURCE_VALID;
-
- QVERIFY(m_source->minimumUpdateInterval() > 0);
-}
-
-//TC_ID_3_x_1
-void TestQGeoPositionInfoSource::startUpdates_testIntervals()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(1000);
- const int interval = 15000;
-
- m_source->startUpdates();
-
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, interval);
- for (int i = 0; i < 6; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 1) && (timeout.count() == 0), interval);
- spy.clear();
- }
-
- m_source->stopUpdates();
-}
-
-
-void TestQGeoPositionInfoSource::startUpdates_testIntervalChangesWhileRunning()
-{
- // There are two ways of dealing with an interval change, and we have left it system dependent.
- // The interval can be changed will running or after the next update.
- // WinCE uses the first method, S60 uses the second method.
-
- CHECK_SOURCE_VALID;
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
- m_source->setUpdateInterval(0);
-
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 3000);
- QCOMPARE(timeout.count(), 0);
- spy.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 15000);
- spy.clear();
-
- m_source->setUpdateInterval(2000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 30000);
- spy.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 15000);
- spy.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 15000);
- spy.clear();
-
- m_source->setUpdateInterval(0);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 7000);
- spy.clear();
-
- m_source->setUpdateInterval(0);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 7000);
- spy.clear();
-
- m_source->stopUpdates();
-}
-
-//TC_ID_3_x_2
-void TestQGeoPositionInfoSource::startUpdates_testDefaultInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->startUpdates();
- for (int i = 0; i < 3; i++) {
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 7000);
- spy.clear();
- }
- m_source->stopUpdates();
-}
-
-//TC_ID_3_x_3
-void TestQGeoPositionInfoSource::startUpdates_testZeroInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
- for (int i = 0; i < 3; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 7000);
- spy.clear();
- }
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::startUpdates_moreThanOnce()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- m_source->startUpdates(); // check there is no crash
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 7000);
-
- m_source->startUpdates(); // check there is no crash
-
- m_source->stopUpdates();
-}
-
-//TC_ID_3_x_1
-void TestQGeoPositionInfoSource::stopUpdates()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(1000);
- m_source->startUpdates();
- for (int i = 0; i < 2; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 9500);
- spy.clear();
- }
- m_source->stopUpdates();
- QTest::qWait(2000);
- QCOMPARE(spy.count(), 0);
- spy.clear();
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
- m_source->stopUpdates();
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 0, 9500);
-}
-
-//TC_ID_3_x_2
-void TestQGeoPositionInfoSource::stopUpdates_withoutStart()
-{
- CHECK_SOURCE_VALID;
- m_source->stopUpdates(); // check there is no crash
-}
-
-void TestQGeoPositionInfoSource::requestUpdate()
-{
- CHECK_SOURCE_VALID;
- QFETCH(int, timeout);
- QSignalSpy spy(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->requestUpdate(timeout);
- QTRY_COMPARE(spy.count(), 1);
- const QList<QVariant> arguments = spy.takeFirst();
- const auto error = arguments.at(0).value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
-}
-
-void TestQGeoPositionInfoSource::requestUpdate_data()
-{
- QTest::addColumn<int>("timeout");
- QTest::newRow("less than zero") << -1; //TC_ID_3_x_7
-}
-
-// TC_ID_3_x_1 : Create position source and call requestUpdate with valid timeout value
-void TestQGeoPositionInfoSource::requestUpdate_validTimeout()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- // currently all the sources have a minimumUpdateInterval <= 1000
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
-}
-
-void TestQGeoPositionInfoSource::requestUpdate_defaultTimeout()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- m_source->requestUpdate(0);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
-}
-
-// TC_ID_3_x_2 : Create position source and call requestUpdate with a timeout less than
-// minimumupdateInterval
-void TestQGeoPositionInfoSource::requestUpdate_timeoutLessThanMinimumInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->requestUpdate(1);
-
- QTRY_COMPARE_WITH_TIMEOUT(spyTimeout.count(), 1, 1000);
- const QList<QVariant> arguments = spyTimeout.takeFirst();
- const auto error = arguments.at(0).value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
-}
-
-// TC_ID_3_x_3 : Call requestUpdate() with same value repeatedly
-void TestQGeoPositionInfoSource::requestUpdate_repeatedCalls()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- // currently all the sources have a minimumUpdateInterval <= 1000
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
- spyUpdate.clear();
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
-}
-
-void TestQGeoPositionInfoSource::requestUpdate_overlappingCalls()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- // currently all the sources have a minimumUpdateInterval <= 1000
- m_source->requestUpdate(1500);
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
-}
-
-//TC_ID_3_x_4
-void TestQGeoPositionInfoSource::requestUpdateAfterStartUpdates_ZeroInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
- spyUpdate.clear();
-
- m_source->requestUpdate(1500);
- QTest::qWait(7000);
-
- QVERIFY((spyUpdate.count() > 0) && (spyTimeout.count() == 0));
- spyUpdate.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), MAX_WAITING_TIME);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::requestUpdateAfterStartUpdates_SmallInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- m_source->setUpdateInterval(2000);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 1) && (spyTimeout.count() == 0), 20000);
- spyUpdate.clear();
-
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 1) && (spyTimeout.count() == 0), 7000);
- spyUpdate.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 1) && (spyTimeout.count() == 0), 20000);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::requestUpdateBeforeStartUpdates_ZeroInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() >= 2) && (spyTimeout.count() == 0), 14000);
- spyUpdate.clear();
-
- QTest::qWait(1500);
-
- QCOMPARE(spyTimeout.count(), 0);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::requestUpdateBeforeStartUpdates_SmallInterval()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- m_source->setUpdateInterval(3000);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
- spyUpdate.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 20000);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::removeSlotForRequestTimeout()
-{
- CHECK_SOURCE_VALID;
-
- bool i = connect(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)),
- this, SLOT(test_slot1()));
- QVERIFY(i == true);
- i = connect(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)),
- this, SLOT(test_slot2()));
- QVERIFY(i == true);
- i = disconnect(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)),
- this, SLOT(test_slot1()));
- QVERIFY(i == true);
-
- m_source->requestUpdate(-1);
- QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 1000);
-}
-
-void TestQGeoPositionInfoSource::removeSlotForPositionUpdated()
-{
- CHECK_SOURCE_VALID;
-
- bool i = connect(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
- i = connect(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(test_slot2()));
- QVERIFY(i == true);
- i = disconnect(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
-
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
-}
-
-void TestQGeoPositionInfoSource::updateIntervalBinding()
-{
- auto parent = std::make_unique<QObject>();
- // source will be deleted when parent goes out of scope
- QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(parent.get());
- QVERIFY(source != nullptr);
-
- QTestPrivate::testReadWritePropertyBasics<QGeoPositionInfoSource, int>(*source, 1000, 2000,
- "updateInterval");
-}
-
-void TestQGeoPositionInfoSource::preferredMethodsBinding()
-{
- auto parent = std::make_unique<QObject>();
- // source will be deleted when parent goes out of scope
- QGeoPositionInfoSource *source =
- QGeoPositionInfoSource::createSource("test.source", parent.get());
- QVERIFY(source != nullptr);
-
- QTestPrivate::testReadWritePropertyBasics<QGeoPositionInfoSource,
- QGeoPositionInfoSource::PositioningMethods>(
- *source, QGeoPositionInfoSource::SatellitePositioningMethods,
- QGeoPositionInfoSource::AllPositioningMethods, "preferredPositioningMethods");
-}
-
-#include "testqgeopositioninfosource.moc"
diff --git a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource_p.h b/tests/auto/qgeopositioninfosource/testqgeopositioninfosource_p.h
deleted file mode 100644
index 382971fa..00000000
--- a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource_p.h
+++ /dev/null
@@ -1,129 +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$
-**
-****************************************************************************/
-
-#ifndef TESTQGEOPOSITIONINFOSOURCE_P_H
-#define TESTQGEOPOSITIONINFOSOURCE_P_H
-
-#ifdef TST_GEOCLUEMOCK_ENABLED
-#include "geocluemock.h"
-#include <QThread>
-#endif
-
-#include <QTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-class QGeoPositionInfoSource;
-QT_END_NAMESPACE
-
-class TestQGeoPositionInfoSource : public QObject
-{
- Q_OBJECT
-
-public:
- TestQGeoPositionInfoSource(QObject *parent = 0);
-
- static TestQGeoPositionInfoSource *createDefaultSourceTest();
-
-public slots:
- void test_slot1();
- void test_slot2();
-
-protected:
- virtual QGeoPositionInfoSource *createTestSource() = 0;
-
- // MUST be called by subclasses if they override respective test slots
- void base_initTestCase();
- void base_init();
- void base_cleanup();
- void base_cleanupTestCase();
-
-private slots:
- void initTestCase();
- void init();
- void cleanup();
- void cleanupTestCase();
-
- void constructor_withParent();
-
- void constructor_noParent();
-
- void updateInterval();
-
- void setPreferredPositioningMethods();
- void setPreferredPositioningMethods_data();
-
- void preferredPositioningMethods();
-
- void createDefaultSource();
-
- void setUpdateInterval();
- void setUpdateInterval_data();
-
- void lastKnownPosition();
- void lastKnownPosition_data();
-
- void minimumUpdateInterval();
-
- void startUpdates_testIntervals();
- void startUpdates_testIntervalChangesWhileRunning();
- void startUpdates_testDefaultInterval();
- void startUpdates_testZeroInterval();
- void startUpdates_moreThanOnce();
-
- void stopUpdates();
- void stopUpdates_withoutStart();
-
- void requestUpdate();
- void requestUpdate_data();
-
- void requestUpdate_validTimeout();
- void requestUpdate_defaultTimeout();
- void requestUpdate_timeoutLessThanMinimumInterval();
- void requestUpdate_repeatedCalls();
- void requestUpdate_overlappingCalls();
-
- void requestUpdateAfterStartUpdates_ZeroInterval();
- void requestUpdateAfterStartUpdates_SmallInterval();
- void requestUpdateBeforeStartUpdates_ZeroInterval();
- void requestUpdateBeforeStartUpdates_SmallInterval();
-
- void removeSlotForRequestTimeout();
- void removeSlotForPositionUpdated();
-
- void updateIntervalBinding();
- void preferredMethodsBinding();
-
-private:
- QGeoPositionInfoSource *m_source;
- bool m_testingDefaultSource;
- bool m_testSlot2Called;
-};
-
-#endif
diff --git a/tests/auto/qgeopositioninfosource/tst_qgeopositioninfosource.cpp b/tests/auto/qgeopositioninfosource/tst_qgeopositioninfosource.cpp
deleted file mode 100644
index 943eb65a..00000000
--- a/tests/auto/qgeopositioninfosource/tst_qgeopositioninfosource.cpp
+++ /dev/null
@@ -1,37 +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 "testqgeopositioninfosource_p.h"
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- std::unique_ptr<TestQGeoPositionInfoSource> test(
- TestQGeoPositionInfoSource::createDefaultSourceTest());
- return QTest::qExec(test.get(), argc, argv);
-}
diff --git a/tests/auto/qgeorectangle/CMakeLists.txt b/tests/auto/qgeorectangle/CMakeLists.txt
deleted file mode 100644
index 22c660bd..00000000
--- a/tests/auto/qgeorectangle/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeorectangle.pro.
-
-#####################################################################
-## tst_qgeorectangle Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeorectangle
- SOURCES
- tst_qgeorectangle.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeorectangle.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeorectangle/qgeorectangle.pro b/tests/auto/qgeorectangle/qgeorectangle.pro
deleted file mode 100644
index 9cb635ef..00000000
--- a/tests/auto/qgeorectangle/qgeorectangle.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qgeorectangle
-
-SOURCES += \
- tst_qgeorectangle.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeorectangle/tst_qgeorectangle.cpp b/tests/auto/qgeorectangle/tst_qgeorectangle.cpp
deleted file mode 100644
index 696ac6b1..00000000
--- a/tests/auto/qgeorectangle/tst_qgeorectangle.cpp
+++ /dev/null
@@ -1,2414 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include <QtTest/QtTest>
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoRectangle>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoRectangle : public QObject
-{
- Q_OBJECT
-
-private slots:
- void default_constructor();
- void center_constructor();
- void corner_constructor();
- void list_constructor();
- void copy_constructor();
- void assignment();
- void destructor();
-
- void equality();
- void equality_data();
-
- void isValid();
- void isValid_data();
-
- void isEmpty();
- void isEmpty_data();
-
- void corners();
- void corners_data();
-
- void setCorners();
-
- void width();
- void width_data();
-
- void height();
- void height_data();
-
- void center();
- void center_data();
-
- void boundingGeoRectangle();
- void boundingGeoRectangle_data();
-
- void containsCoord();
- void containsCoord_data();
-
- void containsBoxAndIntersects();
- void containsBoxAndIntersects_data();
-
- void translate();
- void translate_data();
-
- void unite();
- void unite_data();
-
- void extendRectangle();
- void extendRectangle_data();
-
- void areaComparison();
- void areaComparison_data();
-
- void circleComparison();
- void circleComparison_data();
-
- void hashing();
-};
-
-void tst_QGeoRectangle::default_constructor()
-{
- QGeoRectangle box;
- QCOMPARE(box.topLeft().isValid(), false);
- QCOMPARE(box.bottomRight().isValid(), false);
-}
-
-void tst_QGeoRectangle::center_constructor()
-{
- QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(5.0, 5.0), 10.0, 10.0);
-
- QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0));
-}
-
-void tst_QGeoRectangle::corner_constructor()
-{
- QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(10.0, 0.0),
- QGeoCoordinate(0.0, 10.0));
-
- QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0));
-}
-
-void tst_QGeoRectangle::list_constructor()
-{
- QList<QGeoCoordinate> coordinates;
- QGeoRectangle b1 = QGeoRectangle(coordinates);
- QCOMPARE(b1.isValid(), false);
-
- coordinates << QGeoCoordinate(10.0, 0.0);
- b1 = QGeoRectangle(coordinates);
- QCOMPARE(b1.isValid(), true);
- QCOMPARE(b1.isEmpty(), true);
-
- coordinates << QGeoCoordinate(0.0, 10.0) << QGeoCoordinate(0.0, 5.0);
- b1 = QGeoRectangle(coordinates);
- QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0,0.0));
- QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0));
-}
-
-void tst_QGeoRectangle::copy_constructor()
-{
- QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(10.0, 0.0),
- QGeoCoordinate(0.0, 10.0));
- QGeoRectangle b2 = QGeoRectangle(b1);
-
- QCOMPARE(b2.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b2.bottomRight(), QGeoCoordinate(0.0, 10.0));
-
- b2.setTopLeft(QGeoCoordinate(30.0, 0.0));
- b2.setBottomRight(QGeoCoordinate(0.0, 30.0));
- QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0));
-
- QGeoShape area;
- QGeoRectangle areaBox(area);
- QVERIFY(!areaBox.isValid());
- QVERIFY(areaBox.isEmpty());
-
- QGeoCircle circle;
- QGeoRectangle circleBox(circle);
- QVERIFY(!circleBox.isValid());
- QVERIFY(circleBox.isEmpty());
-}
-
-void tst_QGeoRectangle::destructor()
-{
- QGeoRectangle *box = new QGeoRectangle();
- delete box;
- // checking for a crash
-}
-
-void tst_QGeoRectangle::assignment()
-{
- QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(10.0, 0.0),
- QGeoCoordinate(0.0, 10.0));
- QGeoRectangle b2 = QGeoRectangle(QGeoCoordinate(20.0, 0.0),
- QGeoCoordinate(0.0, 20.0));
-
- QVERIFY(b1 != b2);
-
- b2 = b1;
- QCOMPARE(b2.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b2.bottomRight(), QGeoCoordinate(0.0, 10.0));
- QCOMPARE(b1, b2);
-
- b2.setTopLeft(QGeoCoordinate(30.0, 0.0));
- b2.setBottomRight(QGeoCoordinate(0.0, 30.0));
- QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0));
-
- // Assign b1 to an area
- QGeoShape area = b1;
- QCOMPARE(area.type(), b1.type());
- QVERIFY(area == b1);
-
- // Assign the area back to a bounding box
- QGeoRectangle ba = area;
- QCOMPARE(ba.topLeft(), b1.topLeft());
- QCOMPARE(ba.bottomRight(), b1.bottomRight());
-
- // Check that the copy is not modified when modifying the original.
- b1.setTopLeft(QGeoCoordinate(80, 30));
- QVERIFY(ba.topLeft() != b1.topLeft());
- QVERIFY(ba != b1);
-}
-
-void tst_QGeoRectangle::equality()
-{
- QFETCH(QGeoRectangle, box1);
- QFETCH(QGeoRectangle, box2);
- QFETCH(QGeoShape, area1);
- QFETCH(QGeoShape, area2);
- QFETCH(bool, equal);
-
- // compare boxes
- QCOMPARE((box1 == box2), equal);
- QCOMPARE((box1 != box2), !equal);
-
- // compare areas
- QCOMPARE((area1 == area2), equal);
- QCOMPARE((area1 != area2), !equal);
-
- // compare area to box
- QCOMPARE((area1 == box2), equal);
- QCOMPARE((area1 != box2), !equal);
-
- // compare box to area
- QCOMPARE((box1 == area2), equal);
- QCOMPARE((box1 != area2), !equal);
-}
-
-void tst_QGeoRectangle::equality_data()
-{
- QTest::addColumn<QGeoRectangle>("box1");
- QTest::addColumn<QGeoRectangle>("box2");
- QTest::addColumn<QGeoShape>("area1");
- QTest::addColumn<QGeoShape>("area2");
- QTest::addColumn<bool>("equal");
-
- QGeoCoordinate c1(10, 5);
- QGeoCoordinate c2(5, 10);
- QGeoCoordinate c3(20, 15);
- QGeoCoordinate c4(15, 20);
-
- QGeoRectangle b1(c1, c2);
- QGeoRectangle b2(c3, c4);
- QGeoRectangle b3(c3, c2);
- QGeoRectangle b4(c1, c3);
- QGeoRectangle b5(c1, c2);
-
- QGeoShape a1(b1);
- QGeoShape a2(b2);
- QGeoShape a3(b3);
- QGeoShape a4(b4);
- QGeoShape a5(b5);
-
- QTest::newRow("all unequal")
- << b1 << b2 << a1 << a2 << false;
- QTest::newRow("top left unequal")
- << b1 << b3 << a1 << a3 << false;
- QTest::newRow("bottom right unequal")
- << b1 << b4 << a1 << a4 << false;
- QTest::newRow("equal")
- << b1 << b5 << a1 << a5 << true;
-}
-
-void tst_QGeoRectangle::isValid()
-{
- QFETCH(QGeoRectangle, input);
- QFETCH(bool, valid);
-
- QCOMPARE(input.isValid(), valid);
-
- QGeoShape area = input;
- QCOMPARE(area.isValid(), valid);
-}
-
-void tst_QGeoRectangle::isValid_data()
-{
- QTest::addColumn<QGeoRectangle>("input");
- QTest::addColumn<bool>("valid");
-
- QGeoCoordinate c0;
- QGeoCoordinate c1(10, 5);
- QGeoCoordinate c2(5, 10);
-
- QTest::newRow("both corners invalid")
- << QGeoRectangle(c0, c0) << false;
- QTest::newRow("top left corner invalid")
- << QGeoRectangle(c0, c2) << false;
- QTest::newRow("bottom right corner invalid")
- << QGeoRectangle(c1, c0) << false;
- QTest::newRow("height in wrong order")
- << QGeoRectangle(c2, c1) << false;
- QTest::newRow("both corners valid")
- << QGeoRectangle(c1, c2) << true;
-}
-
-void tst_QGeoRectangle::isEmpty()
-{
- QFETCH(QGeoRectangle, input);
- QFETCH(bool, empty);
-
- QCOMPARE(input.isEmpty(), empty);
-
- QGeoShape area = input;
- QCOMPARE(area.isEmpty(), empty);
-}
-
-void tst_QGeoRectangle::isEmpty_data()
-{
- QTest::addColumn<QGeoRectangle>("input");
- QTest::addColumn<bool>("empty");
-
- QGeoCoordinate c0;
- QGeoCoordinate c1(10, 5);
- QGeoCoordinate c2(5, 10);
- QGeoCoordinate c3(10, 10);
-
- QTest::newRow("both corners invalid")
- << QGeoRectangle(c0, c0) << true;
- QTest::newRow("top left corner invalid")
- << QGeoRectangle(c0, c2) << true;
- QTest::newRow("bottom right corner invalid")
- << QGeoRectangle(c1, c0) << true;
- QTest::newRow("zero width")
- << QGeoRectangle(c1, c3) << true;
- QTest::newRow("zero height")
- << QGeoRectangle(c3, c2) << true;
- QTest::newRow("zero width and height")
- << QGeoRectangle(c1, c1) << true;
- QTest::newRow("non-zero width and height")
- << QGeoRectangle(c1, c2) << false;
-}
-
-void tst_QGeoRectangle::corners()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(QGeoCoordinate, topLeft);
- QFETCH(QGeoCoordinate, topRight);
- QFETCH(QGeoCoordinate, bottomLeft);
- QFETCH(QGeoCoordinate, bottomRight);
-
- QCOMPARE(box.topLeft(), topLeft);
- QCOMPARE(box.topRight(), topRight);
- QCOMPARE(box.bottomLeft(), bottomLeft);
- QCOMPARE(box.bottomRight(), bottomRight);
-}
-
-void tst_QGeoRectangle::corners_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<QGeoCoordinate>("topLeft");
- QTest::addColumn<QGeoCoordinate>("topRight");
- QTest::addColumn<QGeoCoordinate>("bottomLeft");
- QTest::addColumn<QGeoCoordinate>("bottomRight");
-
- QGeoCoordinate c0;
- QGeoCoordinate tl(10, 5);
- QGeoCoordinate br(5, 10);
- QGeoCoordinate tr(10, 10);
- QGeoCoordinate bl(5, 5);
-
- QTest::newRow("both invalid")
- << QGeoRectangle(c0, c0)
- << c0
- << c0
- << c0
- << c0;
- QTest::newRow("top left invalid")
- << QGeoRectangle(c0, br)
- << c0
- << c0
- << c0
- << br;
- QTest::newRow("bottom right invalid")
- << QGeoRectangle(tl, c0)
- << tl
- << c0
- << c0
- << c0;
- QTest::newRow("both valid")
- << QGeoRectangle(tl, br)
- << tl
- << tr
- << bl
- << br;
-}
-
-void tst_QGeoRectangle::setCorners()
-{
- QGeoRectangle box(QGeoCoordinate(10.0, 0.0),
- QGeoCoordinate(0.0, 10.0));
-
- box.setTopLeft(QGeoCoordinate(20.0, -10.0));
-
- QCOMPARE(box.topLeft(), QGeoCoordinate(20.0, -10.0));
- QCOMPARE(box.topRight(), QGeoCoordinate(20.0, 10.0));
- QCOMPARE(box.bottomLeft(), QGeoCoordinate(0.0, -10.0));
- QCOMPARE(box.bottomRight(), QGeoCoordinate(0.0, 10.0));
-
- box.setTopRight(QGeoCoordinate(30.0, 20.0));
-
- QCOMPARE(box.topLeft(), QGeoCoordinate(30.0, -10.0));
- QCOMPARE(box.topRight(), QGeoCoordinate(30.0, 20.0));
- QCOMPARE(box.bottomLeft(), QGeoCoordinate(0.0, -10.0));
- QCOMPARE(box.bottomRight(), QGeoCoordinate(0.0, 20.0));
-
- box.setBottomRight(QGeoCoordinate(-10.0, 30.0));
-
- QCOMPARE(box.topLeft(), QGeoCoordinate(30.0, -10.0));
- QCOMPARE(box.topRight(), QGeoCoordinate(30.0, 30.0));
- QCOMPARE(box.bottomLeft(), QGeoCoordinate(-10.0, -10.0));
- QCOMPARE(box.bottomRight(), QGeoCoordinate(-10.0, 30.0));
-
- box.setBottomLeft(QGeoCoordinate(-20.0, -20.0));
-
- QCOMPARE(box.topLeft(), QGeoCoordinate(30.0, -20.0));
- QCOMPARE(box.topRight(), QGeoCoordinate(30.0, 30.0));
- QCOMPARE(box.bottomLeft(), QGeoCoordinate(-20.0, -20.0));
- QCOMPARE(box.bottomRight(), QGeoCoordinate(-20.0, 30.0));
-
-
-}
-
-void tst_QGeoRectangle::width()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(double, oldWidth);
- QFETCH(double, newWidth);
- QFETCH(QGeoRectangle, newBox);
-
- if (qIsNaN(oldWidth))
- QVERIFY(qIsNaN(box.width()));
- else
- QCOMPARE(box.width(), oldWidth);
-
- box.setWidth(newWidth);
-
- QCOMPARE(box, newBox);
-}
-
-void tst_QGeoRectangle::width_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<double>("oldWidth");
- QTest::addColumn<double>("newWidth");
- QTest::addColumn<QGeoRectangle>("newBox");
-
- QTest::newRow("invalid box")
- << QGeoRectangle()
- << qQNaN()
- << 100.0
- << QGeoRectangle();
-
- QTest::newRow("0 width -> negative width")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << -1.0
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0));
-
- QTest::newRow("0 width -> 0 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << 0.0
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0));
-
- QTest::newRow("0 width -> non wrapping width")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << 10.0
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0));
-
- QTest::newRow("0 width -> wrapping width positive")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(10.0, -5.0),
- QGeoCoordinate(5.0, -175.0));
-
- QTest::newRow("0 width -> wrapping width negative")
- << QGeoRectangle(QGeoCoordinate(10.0, -90.0),
- QGeoCoordinate(5.0, -90.0))
- << 0.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, 5.0));
-
- QTest::newRow("0 width -> 360 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << 360.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-
- QTest::newRow("0 width -> 360+ width")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << 370.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-
- QTest::newRow("non wrapping width -> negative width")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << -1.0
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0));
-
- QTest::newRow("non wrapping width -> 0 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << 0.0
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0));
-
- QTest::newRow("non wrapping width -> non wrapping width")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(10.0, 80.0),
- QGeoCoordinate(5.0, 100.0));
-
- QTest::newRow("non wrapping width -> wrapping width positive")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(10.0, -5.0),
- QGeoCoordinate(5.0, -175.0));
-
- QTest::newRow("non wrapping width -> wrapping width negative")
- << QGeoRectangle(QGeoCoordinate(10.0, -95.0),
- QGeoCoordinate(5.0, -85.0))
- << 10.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, 5.0));
-
- QTest::newRow("non wrapping width -> 360 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << 360.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-
- QTest::newRow("non wrapping width width -> 360+ width")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << 370.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-
- QTest::newRow("wrapping width -> negative width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << -1.0
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0));
-
- QTest::newRow("wrapping width -> 0 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << 0.0
- << QGeoRectangle(QGeoCoordinate(10.0, -135.0),
- QGeoCoordinate(5.0, -135.0));
-
- QTest::newRow("wrapping width -> non wrapping width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << 80.0
- << QGeoRectangle(QGeoCoordinate(10.0, -175.0),
- QGeoCoordinate(5.0, -95.0));
-
- QTest::newRow("wrapping width -> wrapping width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << 120.0
- << QGeoRectangle(QGeoCoordinate(10.0, 165.0),
- QGeoCoordinate(5.0, -75.0));
-
- QTest::newRow("wrapping width -> 360 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << 360.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-
- QTest::newRow("wrapping width width -> 360+ width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << 370.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-}
-
-void tst_QGeoRectangle::height()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(double, oldHeight);
- QFETCH(double, newHeight);
- QFETCH(QGeoRectangle, newBox);
-
- if (qIsNaN(oldHeight))
- QVERIFY(qIsNaN(box.height()));
- else
- QCOMPARE(box.height(), oldHeight);
-
- box.setHeight(newHeight);
- QCOMPARE(box, newBox);
-}
-
-void tst_QGeoRectangle::height_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<double>("oldHeight");
- QTest::addColumn<double>("newHeight");
- QTest::addColumn<QGeoRectangle>("newBox");
-
- QTest::newRow("invalid box")
- << QGeoRectangle()
- << qQNaN()
- << 100.0
- << QGeoRectangle();
-
- QTest::newRow("0 height -> negative height")
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(10.0, 10.0))
- << 0.0
- << -1.0
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(10.0, 10.0));
-
- QTest::newRow("0 height -> 0 height")
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(10.0, 10.0))
- << 0.0
- << 0.0
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(10.0, 10.0));
-
- QTest::newRow("0 height -> non zero height")
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(10.0, 10.0))
- << 0.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(20.0, 5.0),
- QGeoCoordinate(0.0, 10.0));
-
- QTest::newRow("0 height -> squash top")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(70.0, 70.0))
- << 0.0
- << 60.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(50.0, 70.0));
-
- QTest::newRow("0 height -> squash bottom")
- << QGeoRectangle(QGeoCoordinate(-70.0, 30.0),
- QGeoCoordinate(-70.0, 70.0))
- << 0.0
- << 60.0
- << QGeoRectangle(QGeoCoordinate(-50.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("0 height -> 180")
- << QGeoRectangle(QGeoCoordinate(0.0, 5.0),
- QGeoCoordinate(0.0, 10.0))
- << 0.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-90.0, 10.0));
-
- QTest::newRow("0 height -> 180 squash top")
- << QGeoRectangle(QGeoCoordinate(20.0, 5.0),
- QGeoCoordinate(20.0, 10.0))
- << 0.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-50.0, 10.0));
-
- QTest::newRow("0 height -> 180 squash bottom")
- << QGeoRectangle(QGeoCoordinate(-20.0, 5.0),
- QGeoCoordinate(-20.0, 10.0))
- << 0.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(50.0, 5.0),
- QGeoCoordinate(-90.0, 10.0));
-
- QTest::newRow("0 height -> 180+")
- << QGeoRectangle(QGeoCoordinate(0.0, 5.0),
- QGeoCoordinate(0.0, 10.0))
- << 0.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-90.0, 10.0));
-
- QTest::newRow("0 height -> 180+ squash top")
- << QGeoRectangle(QGeoCoordinate(20.0, 5.0),
- QGeoCoordinate(20.0, 10.0))
- << 0.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-50.0, 10.0));
-
- QTest::newRow("0 height -> 180+ squash bottom")
- << QGeoRectangle(QGeoCoordinate(-20.0, 5.0),
- QGeoCoordinate(-20.0, 10.0))
- << 0.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(50.0, 5.0),
- QGeoCoordinate(-90.0, 10.0));
-
- QTest::newRow("non zero height -> negative height")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << -1.0
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0));
-
- QTest::newRow("non zero height -> 0 height")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << 0.0
- << QGeoRectangle(QGeoCoordinate(50.0, 30.0),
- QGeoCoordinate(50.0, 70.0));
-
- QTest::newRow("non zero height -> non zero height")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(60.0, 30.0),
- QGeoCoordinate(40.0, 70.0));
-
- QTest::newRow("non zero height -> squash top")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << 100.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(10.0, 70.0));
-
- QTest::newRow("non zero height -> squash bottom")
- << QGeoRectangle(QGeoCoordinate(-30.0, 30.0),
- QGeoCoordinate(-70.0, 70.0))
- << 40.0
- << 100.0
- << QGeoRectangle(QGeoCoordinate(-10.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("non zero height -> 180")
- << QGeoRectangle(QGeoCoordinate(20.0, 30.0),
- QGeoCoordinate(-20.0, 70.0))
- << 40.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("non zero height -> 180 squash top")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(10.0, 70.0));
-
- QTest::newRow("non zero height -> 180 squash bottom")
- << QGeoRectangle(QGeoCoordinate(-30.0, 30.0),
- QGeoCoordinate(-70.0, 70.0))
- << 40.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(-10.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("non zero height -> 180+")
- << QGeoRectangle(QGeoCoordinate(20.0, 30.0),
- QGeoCoordinate(-20.0, 70.0))
- << 40.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("non zero height -> 180+ squash top")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(10.0, 70.0));
-
- QTest::newRow("non zero height -> 180+ squash bottom")
- << QGeoRectangle(QGeoCoordinate(-30.0, 30.0),
- QGeoCoordinate(-70.0, 70.0))
- << 40.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(-10.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-}
-
-void tst_QGeoRectangle::center()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(QGeoCoordinate, oldCenter);
- QFETCH(QGeoCoordinate, newCenter);
- QFETCH(QGeoRectangle, newBox);
-
- QGeoShape shape = box;
- QCOMPARE(box.center(), oldCenter);
- QCOMPARE(shape.center(), oldCenter);
- box.setCenter(newCenter);
- QCOMPARE(box, newBox);
-}
-
-void tst_QGeoRectangle::center_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<QGeoCoordinate>("oldCenter");
- QTest::addColumn<QGeoCoordinate>("newCenter");
- QTest::addColumn<QGeoRectangle>("newBox");
-
- QTest::newRow("invalid")
- << QGeoRectangle()
- << QGeoCoordinate()
- << QGeoCoordinate(0.0, 0.0)
- << QGeoRectangle(QGeoCoordinate(0.0, 0.0), 0.0, 0.0);
-
- QTest::newRow("zero width")
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(5.0, 5.0))
- << QGeoCoordinate(7.5, 5.0)
- << QGeoCoordinate(20.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(22.5, 20.0),
- QGeoCoordinate(17.5, 20.0));
-
- QTest::newRow("360 width")
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0))
- << QGeoCoordinate(7.5, 0.0)
- << QGeoCoordinate(20.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(22.5, -180.0),
- QGeoCoordinate(17.5, 180.0));
-
- QTest::newRow("zero height")
- << QGeoRectangle(QGeoCoordinate(5.0, 5.0),
- QGeoCoordinate(5.0, 10.0))
- << QGeoCoordinate(5.0, 7.5)
- << QGeoCoordinate(20.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(20.0, 17.5),
- QGeoCoordinate(20.0, 22.5));
-
- QTest::newRow("180 height -> move")
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-90.0, 10.0))
- << QGeoCoordinate(0.0, 7.5)
- << QGeoCoordinate(0.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(90.0, 17.5),
- QGeoCoordinate(-90.0, 22.5));
-
- QTest::newRow("180 height -> squash top")
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-90.0, 10.0))
- << QGeoCoordinate(0.0, 7.5)
- << QGeoCoordinate(-20.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(50.0, 17.5),
- QGeoCoordinate(-90.0, 22.5));
-
- QTest::newRow("180 height -> squash bottom")
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-90.0, 10.0))
- << QGeoCoordinate(0.0, 7.5)
- << QGeoCoordinate(20.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(90.0, 17.5),
- QGeoCoordinate(-50.0, 22.5));
-
- QTest::newRow("non wrapping -> non wrapping")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << QGeoCoordinate(50.0, 50.0)
- << QGeoCoordinate(10.0, 10.0)
- << QGeoRectangle(QGeoCoordinate(30.0, -10.0),
- QGeoCoordinate(-10.0, 30.0));
-
- QTest::newRow("non wrapping -> wrapping")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << QGeoCoordinate(50.0, 50.0)
- << QGeoCoordinate(10.0, 170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-10.0, -170.0));
-
- QTest::newRow("non wrapping -> squash top")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << QGeoCoordinate(50.0, 50.0)
- << QGeoCoordinate(80.0, 50.0)
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(70.0, 70.0));
-
- QTest::newRow("non wrapping -> squash bottom")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << QGeoCoordinate(50.0, 50.0)
- << QGeoCoordinate(-80.0, 50.0)
- << QGeoRectangle(QGeoCoordinate(-70.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("wrapping -> non wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-10.0, -170.0))
- << QGeoCoordinate(10.0, 170.0)
- << QGeoCoordinate(50.0, 50.0)
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0));
-
- QTest::newRow("wrapping -> wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-10.0, -170.0))
- << QGeoCoordinate(10.0, 170.0)
- << QGeoCoordinate(10.0, -170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 170.0),
- QGeoCoordinate(-10.0, -150.0));
-
- QTest::newRow("wrapping -> squash top")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-10.0, -170.0))
- << QGeoCoordinate(10.0, 170.0)
- << QGeoCoordinate(80.0, 170.0)
- << QGeoRectangle(QGeoCoordinate(90.0, 150.0),
- QGeoCoordinate(70.0, -170.0));
-
- QTest::newRow("wrapping -> squash bottom")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-10.0, -170.0))
- << QGeoCoordinate(10.0, 170.0)
- << QGeoCoordinate(-80.0, 170.0)
- << QGeoRectangle(QGeoCoordinate(-70.0, 150.0),
- QGeoCoordinate(-90.0, -170.0));
-}
-
-void tst_QGeoRectangle::boundingGeoRectangle_data()
-{
- QTest::addColumn<QGeoRectangle>("rectangle");
-
- QGeoRectangle b1(QGeoCoordinate(70, 30), QGeoCoordinate(30, 70));
- QGeoRectangle b2(QGeoCoordinate(70, 150), QGeoCoordinate(30, -170));
- QGeoRectangle b3(QGeoCoordinate(90, 30), QGeoCoordinate(50, 70));
- QGeoRectangle b4(QGeoCoordinate(-50, 30), QGeoCoordinate(-90, 70));
-
- QTest::newRow("Box 1") << b1;
- QTest::newRow("Box 2") << b2;
- QTest::newRow("Box 3") << b3;
- QTest::newRow("Box 4") << b4;
-}
-
-void tst_QGeoRectangle::boundingGeoRectangle()
-{
- QFETCH(QGeoRectangle, rectangle);
-
- QGeoRectangle box = rectangle.boundingGeoRectangle();
- QCOMPARE(box, rectangle);
-}
-
-void tst_QGeoRectangle::containsCoord()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(QGeoCoordinate, coord);
- QFETCH(bool, contains);
-
- QCOMPARE(box.contains(coord), contains);
-
- QGeoShape area = box;
- QCOMPARE(area.contains(coord), contains);
-}
-
-void tst_QGeoRectangle::containsCoord_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<QGeoCoordinate>("coord");
- QTest::addColumn<bool>("contains");
-
- QGeoRectangle b1(QGeoCoordinate(70, 30), QGeoCoordinate(30, 70));
-
- double lonLO1 = 20.0;
- double lonL1 = 30.0;
- double lonLI1 = 40.0;
- double lonC1 = 50.0;
- double lonRI1 = 60.0;
- double lonR1 = 70.0;
- double lonRO1 = 80.0;
-
- double latTO1 = 80.0;
- double latT1 = 70.0;
- double latTI1 = 60.0;
- double latC1 = 50.0;
- double latBI1 = 40.0;
- double latB1 = 30.0;
- double latBO1 = 20.0;
-
- QTest::newRow("non wrapped - in center")
- << b1 << QGeoCoordinate(latC1, lonC1) << true;
- QTest::newRow("non wrapped - left edge - inside")
- << b1 << QGeoCoordinate(latC1, lonLI1) << true;
- QTest::newRow("non wrapped - left edge")
- << b1 << QGeoCoordinate(latC1, lonL1) << true;
- QTest::newRow("non wrapped - left edge - outside")
- << b1 << QGeoCoordinate(latC1, lonLO1) << false;
- QTest::newRow("non wrapped - right edge - inside")
- << b1 << QGeoCoordinate(latC1, lonRI1) << true;
- QTest::newRow("non wrapped - right edge")
- << b1 << QGeoCoordinate(latC1, lonR1) << true;
- QTest::newRow("non wrapped - right edge - outside")
- << b1 << QGeoCoordinate(latC1, lonRO1) << false;
- QTest::newRow("non wrapped - top edge - inside")
- << b1 << QGeoCoordinate(latTI1, lonC1) << true;
- QTest::newRow("non wrapped - top edge")
- << b1 << QGeoCoordinate(latT1, lonC1) << true;
- QTest::newRow("non wrapped - top edge - outside")
- << b1 << QGeoCoordinate(latTO1, lonC1) << false;
- QTest::newRow("non wrapped - bottom edge - inside")
- << b1 << QGeoCoordinate(latBI1, lonC1) << true;
- QTest::newRow("non wrapped - bottom edge")
- << b1 << QGeoCoordinate(latB1, lonC1) << true;
- QTest::newRow("non wrapped - bottom edge - outside")
- << b1 << QGeoCoordinate(latBO1, lonC1) << false;
- QTest::newRow("non wrapped - top left - inside")
- << b1 << QGeoCoordinate(latTI1, lonLI1) << true;
- QTest::newRow("non wrapped - top left")
- << b1 << QGeoCoordinate(latT1, lonL1) << true;
- QTest::newRow("non wrapped - top left - outside")
- << b1 << QGeoCoordinate(latTO1, lonLO1) << false;
- QTest::newRow("non wrapped - top right - inside")
- << b1 << QGeoCoordinate(latTI1, lonRI1) << true;
- QTest::newRow("non wrapped - top right")
- << b1 << QGeoCoordinate(latT1, lonR1) << true;
- QTest::newRow("non wrapped - top right - outside")
- << b1 << QGeoCoordinate(latTO1, lonRO1) << false;
- QTest::newRow("non wrapped - bottom left - inside")
- << b1 << QGeoCoordinate(latBI1, lonLI1) << true;
- QTest::newRow("non wrapped - bottom left")
- << b1 << QGeoCoordinate(latB1, lonL1) << true;
- QTest::newRow("non wrapped - bottom left - outside")
- << b1 << QGeoCoordinate(latBO1, lonLO1) << false;
- QTest::newRow("non wrapped - bottom right - inside")
- << b1 << QGeoCoordinate(latBI1, lonRI1) << true;
- QTest::newRow("non wrapped - bottom right")
- << b1 << QGeoCoordinate(latB1, lonR1) << true;
- QTest::newRow("non wrapped - bottom right - outside")
- << b1 << QGeoCoordinate(latBO1, lonRO1) << false;
-
- QGeoRectangle b2(QGeoCoordinate(70, 150), QGeoCoordinate(30, -170));
-
- double lonLO2 = 140.0;
- double lonL2 = 150.0;
- double lonLI2 = 160.0;
- double lonC2 = 170.0;
- double lonRI2 = 180.0;
- double lonR2 = -170.0;
- double lonRO2 = -160.0;
-
- double latTO2 = 80.0;
- double latT2 = 70.0;
- double latTI2 = 60.0;
- double latC2 = 50.0;
- double latBI2 = 40.0;
- double latB2 = 30.0;
- double latBO2 = 20.0;
-
- QTest::newRow("wrapped - in center")
- << b2 << QGeoCoordinate(latC2, lonC2) << true;
- QTest::newRow("wrapped - left edge - inside")
- << b2 << QGeoCoordinate(latC2, lonLI2) << true;
- QTest::newRow("wrapped - left edge")
- << b2 << QGeoCoordinate(latC2, lonL2) << true;
- QTest::newRow("wrapped - left edge - outside")
- << b2 << QGeoCoordinate(latC2, lonLO2) << false;
- QTest::newRow("wrapped - right edge - inside")
- << b2 << QGeoCoordinate(latC2, lonRI2) << true;
- QTest::newRow("wrapped - right edge")
- << b2 << QGeoCoordinate(latC2, lonR2) << true;
- QTest::newRow("wrapped - right edge - outside")
- << b2 << QGeoCoordinate(latC2, lonRO2) << false;
- QTest::newRow("wrapped - top edge - inside")
- << b2 << QGeoCoordinate(latTI2, lonC2) << true;
- QTest::newRow("wrapped - top edge")
- << b2 << QGeoCoordinate(latT2, lonC2) << true;
- QTest::newRow("wrapped - top edge - outside")
- << b2 << QGeoCoordinate(latTO2, lonC2) << false;
- QTest::newRow("wrapped - bottom edge - inside")
- << b2 << QGeoCoordinate(latBI2, lonC2) << true;
- QTest::newRow("wrapped - bottom edge")
- << b2 << QGeoCoordinate(latB2, lonC2) << true;
- QTest::newRow("wrapped - bottom edge - outside")
- << b2 << QGeoCoordinate(latBO2, lonC2) << false;
- QTest::newRow("wrapped - top left - inside")
- << b2 << QGeoCoordinate(latTI2, lonLI2) << true;
- QTest::newRow("wrapped - top left")
- << b2 << QGeoCoordinate(latT2, lonL2) << true;
- QTest::newRow("wrapped - top left - outside")
- << b2 << QGeoCoordinate(latTO2, lonLO2) << false;
- QTest::newRow("wrapped - top right - inside")
- << b2 << QGeoCoordinate(latTI2, lonRI2) << true;
- QTest::newRow("wrapped - top right")
- << b2 << QGeoCoordinate(latT2, lonR2) << true;
- QTest::newRow("wrapped - top right - outside")
- << b2 << QGeoCoordinate(latTO2, lonRO2) << false;
- QTest::newRow("wrapped - bottom left - inside")
- << b2 << QGeoCoordinate(latBI2, lonLI2) << true;
- QTest::newRow("wrapped - bottom left")
- << b2 << QGeoCoordinate(latB2, lonL2) << true;
- QTest::newRow("wrapped - bottom left - outside")
- << b2 << QGeoCoordinate(latBO2, lonLO2) << false;
- QTest::newRow("wrapped - bottom right - inside")
- << b2 << QGeoCoordinate(latBI2, lonRI2) << true;
- QTest::newRow("wrapped - bottom right")
- << b2 << QGeoCoordinate(latB2, lonR2) << true;
- QTest::newRow("wrapped - bottom right - outside")
- << b2 << QGeoCoordinate(latBO2, lonRO2) << false;
-
- QGeoRectangle b3(QGeoCoordinate(90, 30), QGeoCoordinate(50, 70));
-
- double lonLO3 = 20.0;
- double lonL3 = 30.0;
- double lonLI3 = 40.0;
- double lonC3 = 50.0;
- double lonRI3 = 60.0;
- double lonR3 = 70.0;
- double lonRO3 = 80.0;
-
- double latT3 = 90.0;
- double latTI3 = 80.0;
- double latC3 = 70.0;
- /* current unused:
- double latBI3 = 60.0;
- double latB3 = 50.0;
- double latBO3 = 40.0;
- */
-
- QTest::newRow("north pole - in center")
- << b3 << QGeoCoordinate(latC3, lonC3) << true;
- QTest::newRow("north pole - left edge - inside")
- << b3 << QGeoCoordinate(latC3, lonLI3) << true;
- QTest::newRow("north pole - left edge")
- << b3 << QGeoCoordinate(latC3, lonL3) << true;
- QTest::newRow("north pole - left edge - outside")
- << b3 << QGeoCoordinate(latC3, lonLO3) << false;
- QTest::newRow("north pole - right edge - inside")
- << b3 << QGeoCoordinate(latC3, lonRI3) << true;
- QTest::newRow("north pole - right edge")
- << b3 << QGeoCoordinate(latC3, lonR3) << true;
- QTest::newRow("north pole - right edge - outside")
- << b3 << QGeoCoordinate(latC3, lonRO3) << false;
- QTest::newRow("north pole - top edge - inside")
- << b3 << QGeoCoordinate(latTI3, lonC3) << true;
- QTest::newRow("north pole - top edge")
- << b3 << QGeoCoordinate(latT3, lonC3) << true;
- QTest::newRow("north pole - top left - inside")
- << b3 << QGeoCoordinate(latTI3, lonLI3) << true;
- QTest::newRow("north pole - top left")
- << b3 << QGeoCoordinate(latT3, lonL3) << true;
- QTest::newRow("north pole - top left - outside")
- << b3 << QGeoCoordinate(latT3, lonLO3) << true;
- QTest::newRow("north pole - top right - inside")
- << b3 << QGeoCoordinate(latTI3, lonRI3) << true;
- QTest::newRow("north pole - top right")
- << b3 << QGeoCoordinate(latT3, lonR3) << true;
- QTest::newRow("north pole - top right - outside")
- << b3 << QGeoCoordinate(latT3, lonRO3) << true;
-
- QGeoRectangle b4(QGeoCoordinate(-50, 30), QGeoCoordinate(-90, 70));
-
- double lonLO4 = 20.0;
- double lonL4 = 30.0;
- double lonLI4 = 40.0;
- double lonC4 = 50.0;
- double lonRI4 = 60.0;
- double lonR4 = 70.0;
- double lonRO4 = 80.0;
-
- /* currently unused:
- double latTO4 = -40.0;
- double latT4 = -50.0;
- double latTI4 = -60.0;
- */
- double latC4 = -70.0;
- double latBI4 = -80.0;
- double latB4 = -90.0;
-
- QTest::newRow("south pole - in center")
- << b4 << QGeoCoordinate(latC4, lonC4) << true;
- QTest::newRow("south pole - left edge - inside")
- << b4 << QGeoCoordinate(latC4, lonLI4) << true;
- QTest::newRow("south pole - left edge")
- << b4 << QGeoCoordinate(latC4, lonL4) << true;
- QTest::newRow("south pole - left edge - outside")
- << b4 << QGeoCoordinate(latC4, lonLO4) << false;
- QTest::newRow("south pole - right edge - inside")
- << b4 << QGeoCoordinate(latC4, lonRI4) << true;
- QTest::newRow("south pole - right edge")
- << b4 << QGeoCoordinate(latC4, lonR4) << true;
- QTest::newRow("south pole - right edge - outside")
- << b4 << QGeoCoordinate(latC4, lonRO4) << false;
- QTest::newRow("south pole - bottom edge - inside")
- << b4 << QGeoCoordinate(latBI4, lonC4) << true;
- QTest::newRow("south pole - bottom edge")
- << b4 << QGeoCoordinate(latB4, lonC4) << true;
- QTest::newRow("south pole - bottom left - inside")
- << b4 << QGeoCoordinate(latBI4, lonLI4) << true;
- QTest::newRow("south pole - bottom left")
- << b4 << QGeoCoordinate(latB4, lonL4) << true;
- QTest::newRow("south pole - bottom left - outside")
- << b4 << QGeoCoordinate(latB4, lonLO4) << true;
- QTest::newRow("south pole - bottom right - inside")
- << b4 << QGeoCoordinate(latBI4, lonRI4) << true;
- QTest::newRow("south pole - bottom right")
- << b4 << QGeoCoordinate(latB4, lonR4) << true;
- QTest::newRow("south pole - bottom right - outside")
- << b4 << QGeoCoordinate(latB4, lonRO4) << true;
-}
-
-void tst_QGeoRectangle::containsBoxAndIntersects()
-{
- QFETCH(QGeoRectangle, box1);
- QFETCH(QGeoRectangle, box2);
- QFETCH(bool, contains);
- QFETCH(bool, intersects);
-
- QCOMPARE(box1.contains(box2), contains);
- QCOMPARE(box1.intersects(box2), intersects);
-}
-
-void tst_QGeoRectangle::containsBoxAndIntersects_data()
-{
- QTest::addColumn<QGeoRectangle>("box1");
- QTest::addColumn<QGeoRectangle>("box2");
- QTest::addColumn<bool>("contains");
- QTest::addColumn<bool>("intersects");
-
- QGeoRectangle b1(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("non wrapped same")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << true << true;
-
- QTest::newRow("non wrapped smaller")
- << b1
- << QGeoRectangle(QGeoCoordinate(20.0, -20.0),
- QGeoCoordinate(-20.0, 20.0))
- << true << true;
-
- QTest::newRow("non wrapped larger")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -40.0),
- QGeoCoordinate(-40.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped outside top")
- << b1
- << QGeoRectangle(QGeoCoordinate(80.0, -30.0),
- QGeoCoordinate(50.0, 30.0))
- << false << false;
-
- QTest::newRow("non wrapped outside bottom")
- << b1
- << QGeoRectangle(QGeoCoordinate(-50.0, -30.0),
- QGeoCoordinate(-80.0, 30.0))
- << false << false;
-
- QTest::newRow("non wrapped outside left")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, -80.0),
- QGeoCoordinate(-30.0, -50.0))
- << false << false;
-
- QTest::newRow("non wrapped outside wrapped")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << false << false;
-
- QTest::newRow("non wrapped outside right")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, 50.0),
- QGeoCoordinate(-30.0, 80.0))
- << false << false;
-
- QTest::newRow("non wrapped top left cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -40.0),
- QGeoCoordinate(20.0, -20.0))
- << false << true;
-
- QTest::newRow("non wrapped top cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -10.0),
- QGeoCoordinate(20.0, 10.0))
- << false << true;
-
- QTest::newRow("non wrapped top right cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, 20.0),
- QGeoCoordinate(20.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped left cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, -40.0),
- QGeoCoordinate(-10.0, -20.0))
- << false << true;
-
- QTest::newRow("non wrapped right cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, 20.0),
- QGeoCoordinate(-10.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom left cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(-20.0, -40.0),
- QGeoCoordinate(-40.0, -20.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(-20.0, -10.0),
- QGeoCoordinate(-40.0, 10.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom right cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(-20.0, 20.0),
- QGeoCoordinate(-40.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped top left touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(50.0, -50.0),
- QGeoCoordinate(30.0, -30.0))
- << false << true;
-
- QTest::newRow("non wrapped top touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(50.0, -10.0),
- QGeoCoordinate(30.0, 10.0))
- << false << true;
-
- QTest::newRow("non wrapped top right touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(50.0, 30.0),
- QGeoCoordinate(30.0, 50.0))
- << false << true;
-
- QTest::newRow("non wrapped left touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, -50.0),
- QGeoCoordinate(-10.0, -30.0))
- << false << true;
-
- QTest::newRow("non wrapped right touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, 30.0),
- QGeoCoordinate(-10.0, 50.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom left touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-30.0, -30.0),
- QGeoCoordinate(-50.0, -50.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-30.0, -10.0),
- QGeoCoordinate(-50.0, 10.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom right touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-30.0, 30.0),
- QGeoCoordinate(-50.0, 50.0))
- << false << true;
-
- QTest::newRow("non wrapped top left touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(10.0, -10.0))
- << true << true;
-
- QTest::newRow("non wrapped top touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, -10.0),
- QGeoCoordinate(10.0, 10.0))
- << true << true;
-
- QTest::newRow("non wrapped top right touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(10.0, 30.0))
- << true << true;
-
- QTest::newRow("non wrapped left touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, -30.0),
- QGeoCoordinate(-10.0, -10.0))
- << true << true;
-
- QTest::newRow("non wrapped right touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, 10.0),
- QGeoCoordinate(-10.0, 30.0))
- << true << true;
-
- QTest::newRow("non wrapped bottom left touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-10.0, -30.0),
- QGeoCoordinate(-30.0, -10.0))
- << true << true;
-
- QTest::newRow("non wrapped bottom touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-10.0, -10.0),
- QGeoCoordinate(-30.0, 10.0))
- << true << true;
-
- QTest::newRow("non wrapped bottom right touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-10.0, 10.0),
- QGeoCoordinate(-30.0, 30.0))
- << true << true;
-
- QTest::newRow("non wrapped top lon strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -40.0),
- QGeoCoordinate(20.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped center lon strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, -40.0),
- QGeoCoordinate(-10.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom lon strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(-20.0, -40.0),
- QGeoCoordinate(-40.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped left lat strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -40.0),
- QGeoCoordinate(-40.0, -20.0))
- << false << true;
-
- QTest::newRow("non wrapped center lat strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -10.0),
- QGeoCoordinate(-40.0, 10.0))
- << false << true;
-
- QTest::newRow("non wrapped right lat strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, 20.0),
- QGeoCoordinate(-40.0, 40.0))
- << false << true;
-
- QGeoRectangle b2(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0));
-
- QTest::newRow("wrapped same")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << true << true;
-
- QTest::newRow("wrapped smaller")
- << b2
- << QGeoRectangle(QGeoCoordinate(20.0, 160.0),
- QGeoCoordinate(-20.0, -160.0))
- << true << true;
-
- QTest::newRow("wrapped larger")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 140.0),
- QGeoCoordinate(-40.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped outside top")
- << b2
- << QGeoRectangle(QGeoCoordinate(80.0, 150.0),
- QGeoCoordinate(50.0, -150.0))
- << false << false;
-
- QTest::newRow("wrapped outside bottom")
- << b2
- << QGeoRectangle(QGeoCoordinate(-50.0, 150.0),
- QGeoCoordinate(-80.0, -150.0))
- << false << false;
-
- QTest::newRow("wrapped outside left")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, 70.0),
- QGeoCoordinate(-30.0, 130.0))
- << false << false;
-
- QTest::newRow("wrapped outside right")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, -130.0),
- QGeoCoordinate(-30.0, -70.0))
- << false << false;
-
- QTest::newRow("wrapped top left cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 140.0),
- QGeoCoordinate(20.0, 160.0))
- << false << true;
-
- QTest::newRow("wrapped top cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 170.0),
- QGeoCoordinate(20.0, -170.0))
- << false << true;
-
- QTest::newRow("wrapped top right cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, -160.0),
- QGeoCoordinate(20.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped left cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, 140.0),
- QGeoCoordinate(-10.0, 160.0))
- << false << true;
-
- QTest::newRow("wrapped right cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, -160.0),
- QGeoCoordinate(-10.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped bottom left cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(-20.0, 140.0),
- QGeoCoordinate(-40.0, 160.0))
- << false << true;
-
- QTest::newRow("wrapped bottom cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(-20.0, 170.0),
- QGeoCoordinate(-40.0, -170.0))
- << false << true;
-
- QTest::newRow("wrapped bottom right cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(-20.0, -160.0),
- QGeoCoordinate(-40.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped top left touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(50.0, 130.0),
- QGeoCoordinate(30.0, 150.0))
- << false << true;
-
- QTest::newRow("wrapped top touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(50.0, 170.0),
- QGeoCoordinate(30.0, -170.0))
- << false << true;
-
- QTest::newRow("wrapped top right touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(50.0, -150.0),
- QGeoCoordinate(30.0, -130.0))
- << false << true;
-
- QTest::newRow("wrapped left touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, 130.0),
- QGeoCoordinate(-10.0, 150.0))
- << false << true;
-
- QTest::newRow("wrapped right touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, -150.0),
- QGeoCoordinate(-10.0, -130.0))
- << false << true;
-
- QTest::newRow("wrapped bottom left touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-30.0, 150.0),
- QGeoCoordinate(-50.0, 130.0))
- << false << true;
-
- QTest::newRow("wrapped bottom touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-30.0, 170.0),
- QGeoCoordinate(-50.0, -170.0))
- << false << true;
-
- QTest::newRow("wrapped bottom right touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-30.0, -150.0),
- QGeoCoordinate(-50.0, -130.0))
- << false << true;
-
- QTest::newRow("wrapped top left touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(10.0, 170.0))
- << true << true;
-
- QTest::newRow("wrapped top touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, 170.0),
- QGeoCoordinate(10.0, -170.0))
- << true << true;
-
- QTest::newRow("wrapped top right touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(10.0, -150.0))
- << true << true;
-
- QTest::newRow("wrapped left touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, 150.0),
- QGeoCoordinate(-10.0, 170.0))
- << true << true;
-
- QTest::newRow("wrapped right touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, -170.0),
- QGeoCoordinate(-10.0, -150.0))
- << true << true;
-
- QTest::newRow("wrapped bottom left touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-10.0, 150.0),
- QGeoCoordinate(-30.0, 170.0))
- << true << true;
-
- QTest::newRow("wrapped bottom touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-10.0, 170.0),
- QGeoCoordinate(-30.0, -170.0))
- << true << true;
-
- QTest::newRow("wrapped bottom right touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-10.0, -170.0),
- QGeoCoordinate(-30.0, -150.0))
- << true << true;
-
- QTest::newRow("wrapped top lon strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 140.0),
- QGeoCoordinate(20.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped center lon strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, 140.0),
- QGeoCoordinate(-10.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped bottom lon strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(-20.0, 140.0),
- QGeoCoordinate(-40.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped left lat strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 140.0),
- QGeoCoordinate(-40.0, 160.0))
- << false << true;
-
- QTest::newRow("wrapped center lat strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 170.0),
- QGeoCoordinate(-40.0, -170.0))
- << false << true;
-
- QTest::newRow("wrapped right lat strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, -160.0),
- QGeoCoordinate(-40.0, -140.0))
- << false << true;
-
- QTest::newRow("north pole touching")
- << QGeoRectangle(QGeoCoordinate(90.0, 20.0),
- QGeoCoordinate(40.0, 40.0))
- << QGeoRectangle(QGeoCoordinate(90.0, 60.0),
- QGeoCoordinate(30.0, 80.0))
- << false << true;
-
- QTest::newRow("south pole touching")
- << QGeoRectangle(QGeoCoordinate(40.0, 20.0),
- QGeoCoordinate(-90.0, 40.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 60.0),
- QGeoCoordinate(-90.0, 80.0))
- << false << true;
-}
-
-void tst_QGeoRectangle::translate()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(double, degreesLatitude);
- QFETCH(double, degreesLongitude);
- QFETCH(QGeoRectangle, newBox);
-
- QGeoRectangle test = box.translated(degreesLatitude, degreesLongitude);
- QCOMPARE(test, newBox);
- box.translate(degreesLatitude, degreesLongitude);
- QCOMPARE(box, newBox);
-
-}
-
-void tst_QGeoRectangle::translate_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<double>("degreesLatitude");
- QTest::addColumn<double>("degreesLongitude");
- QTest::addColumn<QGeoRectangle>("newBox");
-
- QTest::newRow("invalid")
- << QGeoRectangle()
- << 20.0
- << 20.0
- << QGeoRectangle();
-
- QTest::newRow("360 width")
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(50.0, -180.0),
- QGeoCoordinate(-10.0, 180.0));
-
- QTest::newRow("180 height")
- << QGeoRectangle(QGeoCoordinate(90.0, -30.0),
- QGeoCoordinate(-90.0, 30.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(90.0, -10.0),
- QGeoCoordinate(-90.0, 50.0));
-
- QTest::newRow("non wrapping -> non wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(50.0, -10.0),
- QGeoCoordinate(-10.0, 50.0));
-
- QTest::newRow("non wrapping -> wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, 110.0),
- QGeoCoordinate(-30.0, 170.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(50.0, 130.0),
- QGeoCoordinate(-10.0, -170.0));
-
- QTest::newRow("non wrapping -> north clip")
- << QGeoRectangle(QGeoCoordinate(80.0, -30.0),
- QGeoCoordinate(20.0, 30.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(90.0, -10.0),
- QGeoCoordinate(30.0, 50.0));
-
- QTest::newRow("non wrapping -> south clip")
- << QGeoRectangle(QGeoCoordinate(-20.0, -30.0),
- QGeoCoordinate(-80.0, 30.0))
- << -20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(-30.0, -10.0),
- QGeoCoordinate(-90.0, 50.0));
-
- QTest::newRow("wrapping -> non wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, -170.0))
- << 20.0
- << -20.0
- << QGeoRectangle(QGeoCoordinate(50.0, 110.0),
- QGeoCoordinate(-10.0, 170.0));
-
- QTest::newRow("wrapping -> wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, -170.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(50.0, 150.0),
- QGeoCoordinate(-10.0, -150.0));
-
- QTest::newRow("wrapping -> north clip")
- << QGeoRectangle(QGeoCoordinate(80.0, 130.0),
- QGeoCoordinate(20.0, -170.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(90.0, 150.0),
- QGeoCoordinate(30.0, -150.0));
-
- QTest::newRow("wrapping -> south clip")
- << QGeoRectangle(QGeoCoordinate(-20.0, 130.0),
- QGeoCoordinate(-80.0, -170.0))
- << -20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(-30.0, 150.0),
- QGeoCoordinate(-90.0, -150.0));
-}
-
-void tst_QGeoRectangle::unite()
-{
- QFETCH(QGeoRectangle, in1);
- QFETCH(QGeoRectangle, in2);
- QFETCH(QGeoRectangle, out);
-
- QCOMPARE(in1.united(in2), out);
- QCOMPARE(in2.united(in1), out);
-
- QCOMPARE(in1 | in2, out);
- QCOMPARE(in2 | in1, out);
-
- QGeoRectangle united1 = QGeoRectangle(in1);
- united1 |= in2;
- QCOMPARE(united1, out);
-
- QGeoRectangle united2 = QGeoRectangle(in2);
- united2 |= in1;
- QCOMPARE(united2, out);
-}
-
-void tst_QGeoRectangle::unite_data()
-{
- QTest::addColumn<QGeoRectangle>("in1");
- QTest::addColumn<QGeoRectangle>("in2");
- QTest::addColumn<QGeoRectangle>("out");
-
- QTest::newRow("central and taller")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(50.0, -30.0),
- QGeoCoordinate(-50.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(50.0, -30.0),
- QGeoCoordinate(-50.0, 30.0));
-
- QTest::newRow("central and 180 high")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(90.0, -30.0),
- QGeoCoordinate(-90.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(90.0, -30.0),
- QGeoCoordinate(-90.0, 30.0));
-
- QTest::newRow("central and non overlapping higher")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(50.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("central and overlapping higher")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(0.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("central and touching higher")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("central and non overlapping lower")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(-50.0, -30.0),
- QGeoCoordinate(-60.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-60.0, 30.0));
-
- QTest::newRow("central and overlapping lower")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(0.0, -30.0),
- QGeoCoordinate(-60.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-60.0, 30.0));
-
- QTest::newRow("central and touching lower")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(-30.0, -30.0),
- QGeoCoordinate(-60.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-60.0, 30.0));
-
- QTest::newRow("non wrapping central and wider")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -50.0),
- QGeoCoordinate(-30.0, 50.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -50.0),
- QGeoCoordinate(-30.0, 50.0));
-
- QTest::newRow("non wrapping central and 360 width")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("non wrapping central and non overlapping non wrapping left")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -110.0),
- QGeoCoordinate(-30.0, -50.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -110.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("non wrapping central and overlapping non wrapping left")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -80.0),
- QGeoCoordinate(-30.0, -20.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -80.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("non wrapping central and touching non wrapping left")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, -30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("non wrapping central and non overlapping non wrapping right")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 50.0),
- QGeoCoordinate(-30.0, 110.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 110.0));
-
- QTest::newRow("non wrapping central and overlapping non wrapping right")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 20.0),
- QGeoCoordinate(-30.0, 80.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 80.0));
-
- QTest::newRow("non wrapping central and touching non wrapping right")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 30.0),
- QGeoCoordinate(-30.0, 90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 90.0));
-
- QTest::newRow("wrapping and wider")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, -130.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, -130.0));
-
- QTest::newRow("wrapping and 360 width")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("wrapping and non overlapping right")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -130.0),
- QGeoCoordinate(-30.0, -70.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -70.0));
-
- QTest::newRow("wrapping and overlapping right")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -160.0),
- QGeoCoordinate(-30.0, -70.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -70.0));
-
- QTest::newRow("wrapping and touching right")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -150.0),
- QGeoCoordinate(-30.0, -90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -90.0));
-
- QTest::newRow("wrapping and non overlapping left")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 70.0),
- QGeoCoordinate(-30.0, 130.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 70.0),
- QGeoCoordinate(-30.0, -150.0));
-
- QTest::newRow("wrapping and overlapping left")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 100.0),
- QGeoCoordinate(-30.0, 160.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 100.0),
- QGeoCoordinate(-30.0, -150.0));
-
- QTest::newRow("wrapping and touching left")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, 150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, -150.0));
-
- QTest::newRow("wrapping and non overlapping center")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("wrapping and overlapping center")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -160.0),
- QGeoCoordinate(-30.0, 160.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("wrapping and touching center")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -150.0),
- QGeoCoordinate(-30.0, 150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("wrapping and one containing other")
- << QGeoRectangle(QGeoCoordinate(30.0, 40.0),
- QGeoCoordinate(-30.0, -40.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, 170.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 40.0),
- QGeoCoordinate(-30.0, -40.0));
-
- QTest::newRow("small gap over zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, -10.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0));
-
- QTest::newRow("small gap before zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -40.0),
- QGeoCoordinate(-30.0, -30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, -10.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -40.0),
- QGeoCoordinate(-30.0, -10.0));
-
- QTest::newRow("small gap after zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 30.0),
- QGeoCoordinate(-30.0, 40.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(-30.0, 40.0));
-
- QTest::newRow("small gap over dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, 170.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0));
-
- QTest::newRow("small gap before dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 140.0),
- QGeoCoordinate(-30.0, 150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, 170.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 140.0),
- QGeoCoordinate(-30.0, 170.0));
-
- QTest::newRow("small gap after dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -150.0),
- QGeoCoordinate(-30.0, -140.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(-30.0, -140.0));
-
- QTest::newRow("90-degree inner gap over zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -55.0),
- QGeoCoordinate(-30.0, -45.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 45.0),
- QGeoCoordinate(-30.0, 55.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -55.0),
- QGeoCoordinate(-30.0, 55.0));
-
- QTest::newRow("90-degree inner gap before zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, -10.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -65.0),
- QGeoCoordinate(-30.0, -55.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -65.0),
- QGeoCoordinate(-30.0, -10.0));
-
- QTest::newRow("90-degree inner gap after zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, 65.0),
- QGeoCoordinate(-30.0, 75.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(-30.0, 75.0));
-
- QTest::newRow("90-degree inner gap over dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 125.0),
- QGeoCoordinate(-30.0, 135.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -135.0),
- QGeoCoordinate(-30.0, -125.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 125.0),
- QGeoCoordinate(-30.0, -125.0));
-
- QTest::newRow("90-degree inner gap before dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, 170.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 50.0),
- QGeoCoordinate(-30.0, 60.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 50.0),
- QGeoCoordinate(-30.0, 170.0));
-
- QTest::newRow("90-degree inner gap after dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -60.0),
- QGeoCoordinate(-30.0, -50.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(-30.0, -50.0));
-
- QTest::newRow("180-degree inner gap centered on zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -100.0),
- QGeoCoordinate(-30.0, -90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, 100.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, -90.0));
-
- QTest::newRow("180-degree outer gap cenetered on zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, -80.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 80.0),
- QGeoCoordinate(-30.0, 90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, 90.0));
-
- QTest::newRow("180-degree shift centered on zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -100.0),
- QGeoCoordinate(-30.0, -80.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 80.0),
- QGeoCoordinate(-30.0, 100.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("180-degree inner gap centered on dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 80.0),
- QGeoCoordinate(-30.0, 90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, -80.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, 90.0));
-
- QTest::newRow("180-degree outer gap centered on dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, 100.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -100.0),
- QGeoCoordinate(-30.0, -90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, -90.0));
-
- QTest::newRow("180-degree shift centered on dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 80.0),
- QGeoCoordinate(-30.0, 100.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -100.0),
- QGeoCoordinate(-30.0, -80.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("Small outer gap centered on dateline")
- << QGeoRectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, 170))
- << QGeoRectangle(QGeoCoordinate(30, -170), QGeoCoordinate(-30, 160))
- << QGeoRectangle(QGeoCoordinate(30, -170), QGeoCoordinate(-30, 170));
-
- QTest::newRow("Overlapping over the dateline")
- << QGeoRectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, 170))
- << QGeoRectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, -170))
- << QGeoRectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, -170));
-}
-
-
-void tst_QGeoRectangle::extendRectangle()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(QGeoCoordinate, coord);
- QFETCH(QGeoRectangle, out);
-
- box.extendRectangle(coord);
- QCOMPARE(box, out);
-}
-
-void tst_QGeoRectangle::extendRectangle_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<QGeoCoordinate>("coord");
- QTest::addColumn<QGeoRectangle>("out");
-
- QTest::newRow("valid rect - invalid coordinate")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoCoordinate(100.0, 190.0)
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20));
- QTest::newRow("invalid rect - valid coordinate")
- << QGeoRectangle()
- << QGeoCoordinate(10.0, 10.0)
- << QGeoRectangle();
- QTest::newRow("inside rect - not wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoCoordinate(10.0, 10.0)
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20));
- QTest::newRow("lat outside rect - not wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoCoordinate(40.0, 10.0)
- << QGeoRectangle(QGeoCoordinate(40.0, -20.0),
- QGeoCoordinate(-30.0, 20));
- QTest::newRow("positive lon outside rect - not wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoCoordinate(10.0, 40.0)
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 40));
- QTest::newRow("negative lon outside rect - not wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoCoordinate(10.0, -40.0)
- << QGeoRectangle(QGeoCoordinate(30.0, -40.0),
- QGeoCoordinate(-30.0, 20.0));
- QTest::newRow("inside rect - wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoCoordinate(10.0, -170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0));
- QTest::newRow("lat outside rect - wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoCoordinate(-40.0, -170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-40.0, -160.0));
- QTest::newRow("positive lon outside rect - wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoCoordinate(10.0, 140.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 140.0),
- QGeoCoordinate(-30.0, -160.0));
- QTest::newRow("negative lon outside rect - wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoCoordinate(10.0, -140.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -140.0));
- QTest::newRow("extending over 180 degree line eastward")
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, 160.0))
- << QGeoCoordinate(10.0, -170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, -170));
- QTest::newRow("extending over -180 degree line westward")
- << QGeoRectangle(QGeoCoordinate(30.0, -160.0),
- QGeoCoordinate(-30.0, -130.0))
- << QGeoCoordinate(10.0, 170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 170.0),
- QGeoCoordinate(-30.0, -130));
-}
-
-void tst_QGeoRectangle::areaComparison_data()
-{
- QTest::addColumn<QGeoShape>("area");
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<bool>("equal");
-
- QGeoRectangle b1(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
- QGeoRectangle b2(QGeoCoordinate(20.0, 0.0), QGeoCoordinate(0.0, 20.0));
- QGeoCircle c(QGeoCoordinate(0.0, 0.0), 10);
-
- QTest::newRow("default constructed") << QGeoShape() << QGeoRectangle() << false;
- QTest::newRow("b1 b1") << QGeoShape(b1) << b1 << true;
- QTest::newRow("b1 b2") << QGeoShape(b1) << b2 << false;
- QTest::newRow("b2 b1") << QGeoShape(b2) << b1 << false;
- QTest::newRow("b2 b2") << QGeoShape(b2) << b2 << true;
- QTest::newRow("c b1") << QGeoShape(c) << b1 << false;
-}
-
-void tst_QGeoRectangle::areaComparison()
-{
- QFETCH(QGeoShape, area);
- QFETCH(QGeoRectangle, box);
- QFETCH(bool, equal);
-
- QCOMPARE((area == box), equal);
- QCOMPARE((area != box), !equal);
-
- QCOMPARE((box == area), equal);
- QCOMPARE((box != area), !equal);
-}
-
-void tst_QGeoRectangle::circleComparison_data()
-{
- QTest::addColumn<QGeoCircle>("circle");
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<bool>("equal");
-
- QGeoRectangle b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
- QGeoCircle c(QGeoCoordinate(0.0, 0.0), 10);
-
- QTest::newRow("default constructed") << QGeoCircle() << QGeoRectangle() << false;
- QTest::newRow("c b") << c << b << false;
-}
-
-void tst_QGeoRectangle::circleComparison()
-{
- QFETCH(QGeoCircle, circle);
- QFETCH(QGeoRectangle, box);
- QFETCH(bool, equal);
-
- QCOMPARE((circle == box), equal);
- QCOMPARE((circle != box), !equal);
-
- QCOMPARE((box == circle), equal);
- QCOMPARE((box != circle), !equal);
-}
-
-void tst_QGeoRectangle::hashing()
-{
- const QGeoRectangle rectangle(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
- const size_t rectangleHash = qHash(rectangle);
-
- QGeoRectangle otherTopLeftRectangle = rectangle;
- otherTopLeftRectangle.setTopLeft(QGeoCoordinate(20.0, 0.0));
- QVERIFY(qHash(otherTopLeftRectangle) != rectangleHash);
-
- QGeoRectangle otherBottomRightRectangle = rectangle;
- otherBottomRightRectangle.setBottomRight(QGeoCoordinate(0.0, 5.0));
- QVERIFY(qHash(otherBottomRightRectangle) != rectangleHash);
-
- // Do not assign, so that they do not share same d_ptr
- QGeoRectangle similarRectangle(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
- QCOMPARE(qHash(similarRectangle), rectangleHash);
-}
-
-QTEST_MAIN(tst_QGeoRectangle)
-#include "tst_qgeorectangle.moc"
-
diff --git a/tests/auto/qgeosatelliteinfo/CMakeLists.txt b/tests/auto/qgeosatelliteinfo/CMakeLists.txt
deleted file mode 100644
index b4400557..00000000
--- a/tests/auto/qgeosatelliteinfo/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeosatelliteinfo.pro.
-
-#####################################################################
-## tst_qgeosatelliteinfo Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeosatelliteinfo
- SOURCES
- tst_qgeosatelliteinfo.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeosatelliteinfo.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeosatelliteinfo/qgeosatelliteinfo.pro b/tests/auto/qgeosatelliteinfo/qgeosatelliteinfo.pro
deleted file mode 100644
index 447ebdc4..00000000
--- a/tests/auto/qgeosatelliteinfo/qgeosatelliteinfo.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-TARGET=tst_qgeosatelliteinfo
-
-SOURCES += tst_qgeosatelliteinfo.cpp
-
-QT += testlib positioning
diff --git a/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp b/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp
deleted file mode 100644
index c99e222f..00000000
--- a/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp
+++ /dev/null
@@ -1,438 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include <QtPositioning/qgeosatelliteinfo.h>
-
-#include <QMetaType>
-#include <QObject>
-#include <QDebug>
-#include <QTest>
-
-#include <float.h>
-#include <limits.h>
-
-QT_USE_NAMESPACE
-Q_DECLARE_METATYPE(QGeoSatelliteInfo::Attribute)
-
-QByteArray tst_qgeosatelliteinfo_debug;
-
-void tst_qgeosatelliteinfo_messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
-{
- switch (type) {
- case QtDebugMsg :
- tst_qgeosatelliteinfo_debug = msg.toLocal8Bit();
- break;
- default:
- break;
- }
-}
-
-
-QList<qreal> tst_qgeosatelliteinfo_qrealTestValues()
-{
- QList<qreal> values;
-
- if (qreal(DBL_MIN) == DBL_MIN)
- values << DBL_MIN;
-
- values << FLT_MIN;
- values << -1.0 << 0.0 << 1.0;
- values << FLT_MAX;
-
- if (qreal(DBL_MAX) == DBL_MAX)
- values << DBL_MAX;
-
- return values;
-}
-
-QList<int> tst_qgeosatelliteinfo_intTestValues()
-{
- QList<int> values;
- values << INT_MIN << -100 << 0 << 100 << INT_MAX;
- return values;
-}
-
-QList<QGeoSatelliteInfo::Attribute> tst_qgeosatelliteinfo_getAttributes()
-{
- QList<QGeoSatelliteInfo::Attribute> attributes;
- attributes << QGeoSatelliteInfo::Elevation
- << QGeoSatelliteInfo::Azimuth;
- return attributes;
-}
-
-
-class tst_QGeoSatelliteInfo : public QObject
-{
- Q_OBJECT
-
-private:
- QGeoSatelliteInfo updateWithAttribute(QGeoSatelliteInfo::Attribute attribute, qreal value)
- {
- QGeoSatelliteInfo info;
- info.setAttribute(attribute, value);
- return info;
- }
-
- void addTestData_update()
- {
- QTest::addColumn<QGeoSatelliteInfo>("info");
-
- QList<int> intValues = tst_qgeosatelliteinfo_intTestValues();
-
- for (int i=0; i<intValues.count(); i++) {
- QGeoSatelliteInfo info;
- info.setSignalStrength(intValues[i]);
- QTest::newRow("signal strength") << info;
- }
-
- for (int i=0; i<intValues.count(); i++) {
- QGeoSatelliteInfo info;
- info.setSatelliteIdentifier(intValues[i]);
- QTest::newRow("satellite identifier") << info;
- }
-
- QGeoSatelliteInfo info;
- info.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- QTest::newRow("satellite system") << info;
- info.setSatelliteSystem(QGeoSatelliteInfo::GLONASS);
- QTest::newRow("satellite system") << info;
-
- QList<QGeoSatelliteInfo::Attribute> attributes = tst_qgeosatelliteinfo_getAttributes();
- QList<qreal> qrealValues = tst_qgeosatelliteinfo_qrealTestValues();
- for (int i=0; i<attributes.count(); i++) {
- QTest::newRow(qPrintable(QString("Attribute %1 = %2").arg(attributes[i]).arg(qrealValues[i])))
- << updateWithAttribute(attributes[i], qrealValues[i]);
- }
- }
-
-private slots:
- void constructor()
- {
- QGeoSatelliteInfo info;
- QCOMPARE(info.signalStrength(), -1);
- QCOMPARE(info.satelliteIdentifier(), -1);
- QCOMPARE(info.satelliteSystem(), QGeoSatelliteInfo::Undefined);
- QList<QGeoSatelliteInfo::Attribute> attributes = tst_qgeosatelliteinfo_getAttributes();
- for (int i=0; i<attributes.count(); i++)
- QCOMPARE(info.attribute(attributes[i]), qreal(-1.0));
- }
- void constructor_copy()
- {
- QFETCH(QGeoSatelliteInfo, info);
-
- QCOMPARE(QGeoSatelliteInfo(info), info);
- }
-
- void constructor_copy_data()
- {
- addTestData_update();
- }
-
- void constructor_move()
- {
- QFETCH(QGeoSatelliteInfo, info);
- QGeoSatelliteInfo infoCopy = info;
- QCOMPARE(QGeoSatelliteInfo(std::move(info)), infoCopy);
- // The moved-from object will go out of scope and will be destroyed
- // here, so we also implicitly check that moved-from object's destructor
- // is called without any issues.
- }
-
- void constructor_move_data()
- {
- addTestData_update();
- }
-
- void operator_comparison()
- {
- QFETCH(QGeoSatelliteInfo, info);
-
- QVERIFY(info == info);
- QCOMPARE(info != info, false);
- QCOMPARE(info == QGeoSatelliteInfo(), false);
- QCOMPARE(info != QGeoSatelliteInfo(), true);
-
- QVERIFY(QGeoSatelliteInfo() == QGeoSatelliteInfo());
- }
-
- void operator_comparison_data()
- {
- addTestData_update();
- }
-
- void operator_assign()
- {
- QFETCH(QGeoSatelliteInfo, info);
-
- QGeoSatelliteInfo info2 = info;
- QCOMPARE(info2, info);
- }
-
- void operator_assign_data()
- {
- addTestData_update();
- }
-
- void operator_move_assign()
- {
- QFETCH(QGeoSatelliteInfo, info);
- QGeoSatelliteInfo infoCopy = info;
-
- QGeoSatelliteInfo obj;
- obj = std::move(info);
- QCOMPARE(obj, infoCopy);
-
- // check that (move)assigning to the moved-from object is ok
- info = std::move(infoCopy);
- QCOMPARE(info, obj);
- }
-
- void operator_move_assign_data()
- {
- addTestData_update();
- }
-
- void setSignalStrength()
- {
- QFETCH(int, signal);
-
- QGeoSatelliteInfo info;
- QCOMPARE(info.signalStrength(), -1);
-
- info.setSignalStrength(signal);
- QCOMPARE(info.signalStrength(), signal);
- }
-
- void setSignalStrength_data()
- {
- QTest::addColumn<int>("signal");
-
- QList<int> intValues = tst_qgeosatelliteinfo_intTestValues();
- for (int i=0; i<intValues.count(); i++)
- QTest::newRow(qPrintable(QString("%1").arg(intValues[i]))) << intValues[i];
- }
- void setSatelliteIdentifier()
- {
- QFETCH(int, satId);
-
- QGeoSatelliteInfo info;
- QCOMPARE(info.satelliteIdentifier(), -1);
-
- info.setSatelliteIdentifier(satId);
- QCOMPARE(info.satelliteIdentifier(), satId);
- }
-
- void setSatelliteIdentifier_data()
- {
- QTest::addColumn<int>("satId");
-
- QList<int> intValues = tst_qgeosatelliteinfo_intTestValues();
- for (int i=0; i<intValues.count(); i++)
- QTest::newRow(qPrintable(QString("%1").arg(intValues[i]))) << intValues[i];
- }
-
- void setSatelliteSystem()
- {
- QFETCH(int, system);
-
- QGeoSatelliteInfo info;
- QCOMPARE(info.satelliteSystem(), QGeoSatelliteInfo::Undefined);
-
- info.setSatelliteSystem(static_cast<QGeoSatelliteInfo::SatelliteSystem>(system));
- QCOMPARE(info.satelliteSystem(), static_cast<QGeoSatelliteInfo::SatelliteSystem>(system));
- }
-
- void setSatelliteSystem_data()
- {
- QTest::addColumn<int>("system");
-
- QTest::newRow("Sat system undefined")
- << int(QGeoSatelliteInfo::Undefined);
- QTest::newRow("Sat system GPS")
- << int(QGeoSatelliteInfo::GPS);
- QTest::newRow("Sat system GLONASS")
- << int(QGeoSatelliteInfo::GLONASS);
- }
-
- void attribute()
- {
- QFETCH(QGeoSatelliteInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoSatelliteInfo u;
- QCOMPARE(u.attribute(attribute), qreal(-1.0));
-
- u.setAttribute(attribute, value);
- QCOMPARE(u.attribute(attribute), value);
- u.removeAttribute(attribute);
- QCOMPARE(u.attribute(attribute), qreal(-1.0));
- }
-
- void attribute_data()
- {
- QTest::addColumn<QGeoSatelliteInfo::Attribute>("attribute");
- QTest::addColumn<qreal>("value");
-
- QList<QGeoSatelliteInfo::Attribute> props;
- props << QGeoSatelliteInfo::Elevation
- << QGeoSatelliteInfo::Azimuth;
- for (int i=0; i<props.count(); i++) {
- QTest::newRow(qPrintable(QString("Attribute %1 = -1.0").arg(props[i])))
- << props[i]
- << qreal(-1.0);
- QTest::newRow(qPrintable(QString("Attribute %1 = 0.0").arg(props[i])))
- << props[i]
- << qreal(0.0);
- QTest::newRow(qPrintable(QString("Attribute %1 = 1.0").arg(props[i])))
- << props[i]
- << qreal(1.0);
- }
- }
-
- void hasAttribute()
- {
- QFETCH(QGeoSatelliteInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoSatelliteInfo u;
- QVERIFY(!u.hasAttribute(attribute));
-
- u.setAttribute(attribute, value);
- QVERIFY(u.hasAttribute(attribute));
-
- u.removeAttribute(attribute);
- QVERIFY(!u.hasAttribute(attribute));
- }
-
- void hasAttribute_data()
- {
- attribute_data();
- }
-
- void removeAttribute()
- {
- QFETCH(QGeoSatelliteInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoSatelliteInfo u;
- QVERIFY(!u.hasAttribute(attribute));
-
- u.setAttribute(attribute, value);
- QVERIFY(u.hasAttribute(attribute));
-
- u.removeAttribute(attribute);
- QVERIFY(!u.hasAttribute(attribute));
-
- u.setAttribute(attribute, value);
- QVERIFY(u.hasAttribute(attribute));
- }
-
- void removeAttribute_data()
- {
- attribute_data();
- }
-
- void datastream()
- {
- QFETCH(QGeoSatelliteInfo, info);
-
- QByteArray ba;
- QDataStream out(&ba, QIODevice::WriteOnly);
- out << info;
-
- QDataStream in(&ba, QIODevice::ReadOnly);
- QGeoSatelliteInfo inInfo;
- in >> inInfo;
- QCOMPARE(inInfo, info);
- }
-
- void datastream_data()
- {
- addTestData_update();
- }
-
- void debug()
- {
- QFETCH(QGeoSatelliteInfo, info);
- QFETCH(int, nextValue);
- QFETCH(QByteArray, debugString);
-
- qInstallMessageHandler(tst_qgeosatelliteinfo_messageHandler);
- qDebug() << info << nextValue;
- qInstallMessageHandler(0);
- QCOMPARE(QString(tst_qgeosatelliteinfo_debug), QString(debugString));
- }
-
- void debug_data()
- {
- QTest::addColumn<QGeoSatelliteInfo>("info");
- QTest::addColumn<int>("nextValue");
- QTest::addColumn<QByteArray>("debugString");
-
- QGeoSatelliteInfo info;
-
- QTest::newRow("uninitialized") << info << 45
- << QByteArray("QGeoSatelliteInfo(system=0, satId=-1, signal-strength=-1) 45");
-
- info = QGeoSatelliteInfo();
- info.setSignalStrength(1);
- QTest::newRow("with SignalStrength") << info << 60
- << QByteArray("QGeoSatelliteInfo(system=0, satId=-1, signal-strength=1) 60");
-
- info = QGeoSatelliteInfo();
- info.setSatelliteIdentifier(1);
- QTest::newRow("with SatelliteIdentifier") << info << -1
- << QByteArray("QGeoSatelliteInfo(system=0, satId=1, signal-strength=-1) -1");
-
- info = QGeoSatelliteInfo();
- info.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- QTest::newRow("with System GPS") << info << 1
- << QByteArray("QGeoSatelliteInfo(system=1, satId=-1, signal-strength=-1) 1");
-
- info = QGeoSatelliteInfo();
- info.setSatelliteSystem(QGeoSatelliteInfo::GLONASS);
- QTest::newRow("with System GLONASS") << info << 56
- << QByteArray("QGeoSatelliteInfo(system=2, satId=-1, signal-strength=-1) 56");
-
- info = QGeoSatelliteInfo();
- info.setAttribute(QGeoSatelliteInfo::Elevation, 1.1);
- QTest::newRow("with Elevation") << info << 0
- << QByteArray("QGeoSatelliteInfo(system=0, satId=-1, signal-strength=-1, Elevation=1.1) 0");
-
- info = QGeoSatelliteInfo();
- info.setAttribute(QGeoSatelliteInfo::Azimuth, 1.1);
- QTest::newRow("with Azimuth") << info << 45
- << QByteArray("QGeoSatelliteInfo(system=0, satId=-1, signal-strength=-1, Azimuth=1.1) 45");
- }
-};
-
-
-QTEST_APPLESS_MAIN(tst_QGeoSatelliteInfo)
-#include "tst_qgeosatelliteinfo.moc"
diff --git a/tests/auto/qgeosatelliteinfosource/CMakeLists.txt b/tests/auto/qgeosatelliteinfosource/CMakeLists.txt
deleted file mode 100644
index 3e2c64fb..00000000
--- a/tests/auto/qgeosatelliteinfosource/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# Generated from qgeosatelliteinfosource.pro.
-
-#####################################################################
-## tst_qgeosatelliteinfosource Binary:
-#####################################################################
-
-qt_internal_add_test(tst_qgeosatelliteinfosource
- SOURCES
- ../utils/qlocationtestutils.cpp ../utils/qlocationtestutils_p.h
- testqgeosatelliteinfosource.cpp testqgeosatelliteinfosource_p.h
- tst_qgeosatelliteinfosource.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qgeosatelliteinfosource.pro:<TRUE>:
-# TEMPLATE = "app"
-
-## Scopes:
-#####################################################################
diff --git a/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro b/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro
deleted file mode 100644
index 4ca0f214..00000000
--- a/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = app
-!no_system_tests:CONFIG += testcase
-TARGET=tst_qgeosatelliteinfosource
-
-SOURCES += tst_qgeosatelliteinfosource.cpp \
- testqgeosatelliteinfosource.cpp \
- ../utils/qlocationtestutils.cpp
-
-HEADERS += testqgeosatelliteinfosource_p.h \
- ../utils/qlocationtestutils_p.h
-
-QT += positioning testlib
diff --git a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp b/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp
deleted file mode 100644
index f4a5c6ee..00000000
--- a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp
+++ /dev/null
@@ -1,766 +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 <QMetaType>
-#include <QSignalSpy>
-#include <QDebug>
-#include <QTimer>
-
-#include <QtPositioning/qgeosatelliteinfosource.h>
-#include <QtPositioning/qgeosatelliteinfo.h>
-
-#include "testqgeosatelliteinfosource_p.h"
-#include "../utils/qlocationtestutils_p.h"
-
-Q_DECLARE_METATYPE(QList<QGeoSatelliteInfo>)
-Q_DECLARE_METATYPE(QGeoSatelliteInfoSource::Error)
-
-#define MAX_WAITING_TIME 50000
-
-// Must provide a valid source, unless testing the source
-// returned by QGeoSatelliteInfoSource::createDefaultSource() on a system
-// that has no default source
-#define CHECK_SOURCE_VALID { \
- if (!m_source) { \
- if (m_testingDefaultSource && QGeoSatelliteInfoSource::createDefaultSource(0) == 0) \
- QSKIP("No default satellite source on this system"); \
- else \
- QFAIL("createTestSource() must return a valid source!"); \
- } \
- }
-
-class MySatelliteSource : public QGeoSatelliteInfoSource
-{
- Q_OBJECT
-public:
- MySatelliteSource(QObject *parent = 0)
- : QGeoSatelliteInfoSource(parent) {
- }
- virtual void startUpdates() override {}
- virtual void stopUpdates() override {}
- virtual void requestUpdate(int) override {}
- virtual int minimumUpdateInterval() const override {
- return 0;
- }
- Error error() const override { return QGeoSatelliteInfoSource::NoError; }
-};
-
-
-class DefaultSourceTest : public TestQGeoSatelliteInfoSource
-{
- Q_OBJECT
-protected:
- QGeoSatelliteInfoSource *createTestSource() override {
- return QGeoSatelliteInfoSource::createDefaultSource(0);
- }
-};
-
-TestQGeoSatelliteInfoSource::TestQGeoSatelliteInfoSource(QObject *parent)
- : QObject(parent)
-{
- qRegisterMetaType<QGeoSatelliteInfoSource::Error>();
-
- m_testingDefaultSource = false;
-}
-
-TestQGeoSatelliteInfoSource *TestQGeoSatelliteInfoSource::createDefaultSourceTest()
-{
- DefaultSourceTest *test = new DefaultSourceTest;
- test->m_testingDefaultSource = true;
- return test;
-}
-
-void TestQGeoSatelliteInfoSource::base_initTestCase()
-{
- qRegisterMetaType<QList<QGeoSatelliteInfo> >();
-}
-
-void TestQGeoSatelliteInfoSource::base_init()
-{
- m_source = createTestSource();
- m_testSlot2Called = false;
-}
-
-void TestQGeoSatelliteInfoSource::base_cleanup()
-{
- delete m_source;
- m_source = 0;
-}
-
-void TestQGeoSatelliteInfoSource::base_cleanupTestCase()
-{
-}
-
-void TestQGeoSatelliteInfoSource::initTestCase()
-{
- base_initTestCase();
-}
-
-void TestQGeoSatelliteInfoSource::init()
-{
- base_init();
-}
-
-void TestQGeoSatelliteInfoSource::cleanup()
-{
- base_cleanup();
-}
-
-void TestQGeoSatelliteInfoSource::cleanupTestCase()
-{
- base_cleanupTestCase();
-}
-
-void TestQGeoSatelliteInfoSource::test_slot1()
-{
-}
-
-void TestQGeoSatelliteInfoSource::test_slot2()
-{
- m_testSlot2Called = true;
-}
-
-void TestQGeoSatelliteInfoSource::constructor_withParent()
-{
- auto parent = std::make_unique<QObject>();
- new MySatelliteSource(parent.get());
-}
-
-void TestQGeoSatelliteInfoSource::constructor_noParent()
-{
- MySatelliteSource *obj = new MySatelliteSource();
- delete obj;
-}
-
-void TestQGeoSatelliteInfoSource::createDefaultSource()
-{
- auto parent = std::make_unique<QObject>();
- // source will be deleted by parent
- QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createDefaultSource(parent.get());
-
- // Check that default satellite source is successfully created.
- if (!QGeoSatelliteInfoSource::availableSources().isEmpty())
- QVERIFY(source);
- else
- QVERIFY(!source);
-}
-
-void TestQGeoSatelliteInfoSource::createDefaultSource_noParent()
-{
- std::unique_ptr<QGeoSatelliteInfoSource> source(
- QGeoSatelliteInfoSource::createDefaultSource(0));
-
- // Check that default satellite source is successfully created.
- if (!QGeoSatelliteInfoSource::availableSources().isEmpty())
- QVERIFY(source);
- else
- QVERIFY(!source);
-}
-
-void TestQGeoSatelliteInfoSource::updateInterval()
-{
- MySatelliteSource s;
- QCOMPARE(s.updateInterval(), 0);
-}
-
-void TestQGeoSatelliteInfoSource::setUpdateInterval()
-{
- CHECK_SOURCE_VALID;
-
- QFETCH(int, interval);
- QFETCH(int, expectedInterval);
-
- m_source->setUpdateInterval(interval);
- QCOMPARE(m_source->updateInterval(), expectedInterval);
-}
-
-void TestQGeoSatelliteInfoSource::setUpdateInterval_data()
-{
- QTest::addColumn<int>("interval");
- QTest::addColumn<int>("expectedInterval");
- QGeoSatelliteInfoSource *source = createTestSource();
- int minUpdateInterval = source ? source->minimumUpdateInterval() : -1;
- if (source)
- delete source;
-
- QTest::newRow("0") << 0 << 0;
-
- if (minUpdateInterval > -1) {
- QTest::newRow("INT_MIN") << INT_MIN << minUpdateInterval;
- QTest::newRow("-1") << -1 << minUpdateInterval;
- }
-
- if (minUpdateInterval > 0) {
- QTest::newRow("more than minInterval") << minUpdateInterval + 1 << minUpdateInterval + 1;
- QTest::newRow("equal to minInterval") << minUpdateInterval << minUpdateInterval;
- }
-
- if (minUpdateInterval > 1) {
- QTest::newRow("less then minInterval") << minUpdateInterval - 1 << minUpdateInterval;
- QTest::newRow("in btw zero and minInterval") << 1 << minUpdateInterval;
- }
-}
-
-void TestQGeoSatelliteInfoSource::minimumUpdateInterval()
-{
- CHECK_SOURCE_VALID;
-
- QVERIFY(m_source->minimumUpdateInterval() > 0);
-}
-
-void TestQGeoSatelliteInfoSource::startUpdates_testIntervals()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(1000);
- const int interval = 10000;
-
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), interval);
- for (int i = 0; i < 6; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1) && (errorSpy.count() == 0), interval);
- spyView.clear();
- spyUse.clear();
- }
- m_source->stopUpdates();
-}
-
-
-void TestQGeoSatelliteInfoSource::startUpdates_testIntervalChangesWhileRunning()
-{
- // There are two ways of dealing with an interval change, and we have left it system dependent.
- // The interval can be changed will running or after the next update.
- // WinCE uses the first method, S60 uses the second method.
-
- // The minimum interval on the symbian emulator is 5000 msecs, which is why the times in
- // this test are as high as they are.
-
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
- m_source->setUpdateInterval(0);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0), 7000);
- QCOMPARE(errorSpy.count(), 0);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 15000);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(2000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 30000);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 15000);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 15000);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(0);
-
- QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() > 0 ) && (spyUse.count() > 0) && (errorSpy.count() == 0), 7000);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(0);
-
- QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() > 0 ) && (spyUse.count() > 0) && (errorSpy.count() == 0), 7000);
- spyView.clear();
- spyUse.clear();
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::startUpdates_testDefaultInterval()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- for (int i = 0; i < 3; i++) {
- QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() > 0 ) && (spyUse.count() > 0) && (errorSpy.count() == 0), 7000);
- spyView.clear();
- spyUse.clear();
- }
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::startUpdates_testZeroInterval()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- for (int i = 0; i < 3; i++) {
- QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() > 0 ) && (spyUse.count() > 0) && (errorSpy.count() == 0), 7000);
- spyView.clear();
- spyUse.clear();
- }
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::startUpdates_moreThanOnce()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->startUpdates(); // check there is no crash
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0), MAX_WAITING_TIME);
-
- m_source->startUpdates(); // check there is no crash
-
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::stopUpdates()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(1000);
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- for (int i = 0; i < 2; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 12000);
- spyView.clear();
- spyUse.clear();
- }
-
- m_source->stopUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 0) && (spyUse.count() == 0), 12000);
-}
-
-void TestQGeoSatelliteInfoSource::stopUpdates_withoutStart()
-{
- CHECK_SOURCE_VALID;
-
- m_source->stopUpdates(); // check there is no crash
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate()
-{
- CHECK_SOURCE_VALID;
-
- QFETCH(int, timeout);
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(timeout);
-
- if (!errorSpy.isEmpty()) {
- // make sure that it's the UpdateTimeoutError
- const auto error = errorSpy[0][0].value<QGeoSatelliteInfoSource::Error>();
- QCOMPARE(error, QGeoSatelliteInfoSource::UpdateTimeoutError);
- // errorSpy.clear(); // no need to clear the error, as we are expecting it
- }
-
- // Geoclue may deliver update instantly if there is a satellite fix
- QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty() || !spyView.isEmpty(), 10);
- if (!errorSpy.isEmpty()) {
- // make sure that it's the UpdateTimeoutError
- const auto error = errorSpy[0][0].value<QGeoSatelliteInfoSource::Error>();
- QCOMPARE(error, QGeoSatelliteInfoSource::UpdateTimeoutError);
- }
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_data()
-{
- QTest::addColumn<int>("timeout");
- QTest::newRow("less than zero") << -1;
- QTest::newRow("very small timeout") << 1;
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_validTimeout()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT(
- (spyView.count() == 1) && (spyUse.count() == 1 && (errorSpy.count()) == 0), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_defaultTimeout()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(0);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT(
- (spyView.count() == 1) && (spyUse.count() == 1 && (errorSpy.count()) == 0),
- MAX_WAITING_TIME);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_timeoutLessThanMinimumInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1);
-
- QTRY_COMPARE_WITH_TIMEOUT(errorSpy.count(), 1, 1000);
- const auto error = errorSpy[0][0].value<QGeoSatelliteInfoSource::Error>();
- QCOMPARE(error, QGeoSatelliteInfoSource::UpdateTimeoutError);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_repeatedCalls()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
- spyView.clear();
- spyUse.clear();
-
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_overlappingCalls()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_overlappingCallsWithTimeout()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(0);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->requestUpdate(1);
-
- QTRY_COMPARE_WITH_TIMEOUT(errorSpy.count(), 0, 7000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdateAfterStartUpdates_ZeroInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() >= 1) && (spyUse.count() >= 1), MAX_WAITING_TIME);
- spyView.clear();
- spyUse.clear();
-
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() >= 1) && (spyUse.count() >= 1)
- && (errorSpy.count() == 0), 7000);
-
- spyView.clear();
- spyUse.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() >= 1) && (spyUse.count() >= 1), 12000);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdateAfterStartUpdates_SmallInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(3000);
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0)
- && (errorSpy.count() == 0), 7000);
-
- spyView.clear();
- spyUse.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 12000);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdateBeforeStartUpdates_ZeroInterval()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() >= 2) && (spyUse.count() >= 2) && (errorSpy.count() == 0), 14000);
- spyView.clear();
- spyUse.clear();
-
- QTest::qWait(1500);
-
- QCOMPARE(errorSpy.count(), 0);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdateBeforeStartUpdates_SmallInterval()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->setUpdateInterval(2000);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0) && (errorSpy.count() == 0), 7000);
- spyView.clear();
- spyUse.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0) && (errorSpy.count() == 0), 20000);
-
- m_source->stopUpdates();
-}
-
-
-
-void TestQGeoSatelliteInfoSource::removeSlotForRequestTimeout()
-{
- CHECK_SOURCE_VALID;
-
- bool i = connect(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)),
- this, SLOT(test_slot1()));
- QVERIFY(i==true);
- i = connect(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)), \
- this, SLOT(test_slot2()));
- QVERIFY(i==true);
- i = disconnect(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)),
- this, SLOT(test_slot1()));
- QVERIFY(i==true);
-
- m_source->requestUpdate(-1);
- QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 1000);
-}
-
-void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInUseUpdated()
-{
- CHECK_SOURCE_VALID;
-
- bool i = connect(m_source, SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
- i = connect(m_source, SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot2()));
- QVERIFY(i == true);
- i = disconnect(m_source, SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
-
- m_source->requestUpdate(1500);
-
- if (m_source->error() != QGeoSatelliteInfoSource::NoError)
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInViewUpdated()
-{
- CHECK_SOURCE_VALID;
-
- bool i = connect(m_source, SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
- i = connect(m_source, SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot2()));
- QVERIFY(i == true);
- i = disconnect(m_source, SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
-
- m_source->requestUpdate(1500);
-
- if (m_source->error() != QGeoSatelliteInfoSource::NoError)
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::bindings()
-{
- CHECK_SOURCE_VALID;
-
- QTestPrivate::testReadWritePropertyBasics<QGeoSatelliteInfoSource, int>(*m_source, 1000, 2000,
- "updateInterval");
-}
-
-#include "testqgeosatelliteinfosource.moc"
diff --git a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h b/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h
deleted file mode 100644
index 48b45536..00000000
--- a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h
+++ /dev/null
@@ -1,117 +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$
-**
-****************************************************************************/
-
-#ifndef TESTQGEOSATELLITEINFOSOURCE_H
-#define TESTQGEOSATELLITEINFOSOURCE_H
-
-#include <QObject>
-#include <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-
-QT_BEGIN_NAMESPACE
-class QGeoSatelliteInfoSource;
-QT_END_NAMESPACE
-
-
-class TestQGeoSatelliteInfoSource : public QObject
-{
- Q_OBJECT
-
-public:
- TestQGeoSatelliteInfoSource(QObject *parent = 0);
-
- static TestQGeoSatelliteInfoSource *createDefaultSourceTest();
-
-protected:
- virtual QGeoSatelliteInfoSource *createTestSource() = 0;
-
- // MUST be called by subclasses if they override respective test slots
- void base_initTestCase();
- void base_init();
- void base_cleanup();
- void base_cleanupTestCase();
-
-public slots:
- void test_slot1();
- void test_slot2();
-
-private slots:
- void initTestCase();
- void init();
- void cleanup();
- void cleanupTestCase();
-
- void constructor_withParent();
- void constructor_noParent();
-
- void updateInterval();
-
- void setUpdateInterval();
- void setUpdateInterval_data();
-
- void minimumUpdateInterval();
-
- void createDefaultSource();
- void createDefaultSource_noParent();
-
- void startUpdates_testIntervals();
- void startUpdates_testIntervalChangesWhileRunning();
- void startUpdates_testDefaultInterval();
- void startUpdates_testZeroInterval();
- void startUpdates_moreThanOnce();
- void stopUpdates();
- void stopUpdates_withoutStart();
-
- void requestUpdate();
- void requestUpdate_data();
-
- void requestUpdate_validTimeout();
- void requestUpdate_defaultTimeout();
- void requestUpdate_timeoutLessThanMinimumInterval();
- void requestUpdate_repeatedCalls();
- void requestUpdate_overlappingCalls();
- void requestUpdate_overlappingCallsWithTimeout();
-
- void requestUpdateAfterStartUpdates_ZeroInterval();
- void requestUpdateAfterStartUpdates_SmallInterval();
- void requestUpdateBeforeStartUpdates_ZeroInterval();
- void requestUpdateBeforeStartUpdates_SmallInterval();
-
- void removeSlotForRequestTimeout();
- void removeSlotForSatellitesInUseUpdated();
- void removeSlotForSatellitesInViewUpdated();
-
- void bindings();
-
-private:
- QGeoSatelliteInfoSource *m_source;
- bool m_testingDefaultSource;
- bool m_testSlot2Called;
-};
-
-#endif // #ifndef TESTQGEOSATELLITEINFOSOURCE_H
diff --git a/tests/auto/qgeosatelliteinfosource/tst_qgeosatelliteinfosource.cpp b/tests/auto/qgeosatelliteinfosource/tst_qgeosatelliteinfosource.cpp
deleted file mode 100644
index ae97d703..00000000
--- a/tests/auto/qgeosatelliteinfosource/tst_qgeosatelliteinfosource.cpp
+++ /dev/null
@@ -1,37 +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 "testqgeosatelliteinfosource_p.h"
-#include <QDebug>
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- std::unique_ptr<TestQGeoSatelliteInfoSource> test(TestQGeoSatelliteInfoSource::createDefaultSourceTest());
- return QTest::qExec(test.get(), argc, argv);
-}
diff --git a/tests/auto/qgeoshape/CMakeLists.txt b/tests/auto/qgeoshape/CMakeLists.txt
deleted file mode 100644
index a07a7e1d..00000000
--- a/tests/auto/qgeoshape/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Generated from qgeoshape.pro.
-
-#####################################################################
-## tst_qgeoshape Binary:
-#####################################################################
-
-qt_internal_add_test(tst_qgeoshape
- SOURCES
- tst_qgeoshape.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::Test
-)
diff --git a/tests/auto/qgeoshape/qgeoshape.pro b/tests/auto/qgeoshape/qgeoshape.pro
deleted file mode 100644
index dd551382..00000000
--- a/tests/auto/qgeoshape/qgeoshape.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-load(testcase)
-TARGET = tst_qgeoshape
-QT += testlib positioning
-SOURCES = \
- tst_qgeoshape.cpp
diff --git a/tests/auto/qgeoshape/tst_qgeoshape.cpp b/tests/auto/qgeoshape/tst_qgeoshape.cpp
deleted file mode 100644
index d7badb0f..00000000
--- a/tests/auto/qgeoshape/tst_qgeoshape.cpp
+++ /dev/null
@@ -1,243 +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 <QtTest/QtTest>
-#include <QtPositioning/QGeoShape>
-#include <QtCore/QDebug>
-#include <QtPositioning/QGeoRectangle>
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoPath>
-#include <QtPositioning/QGeoPolygon>
-
-QString tst_qgeoshape_debug;
-
-void tst_qgeoshape_messageHandler(QtMsgType type, const QMessageLogContext&,
- const QString &msg)
-{
- switch (type) {
- case QtDebugMsg :
- tst_qgeoshape_debug = msg;
- break;
- default:
- break;
- }
-}
-
-class tst_qgeoshape : public QObject
-{
- Q_OBJECT
-
-private slots:
- void testArea();
- void debug_data();
- void debug();
- void conversions();
- void serialization();
- void hashing();
-};
-
-void tst_qgeoshape::testArea()
-{
- QGeoShape area;
- QVERIFY(!area.isValid());
- QVERIFY(area.isEmpty());
- QCOMPARE(area.type(), QGeoShape::UnknownType);
- QVERIFY(!area.contains(QGeoCoordinate()));
-
- // QGeoShape never constructs a QGeoShapePrivate. Hence d_ptr is always 0.
-
- QGeoShape area2;
-
- QCOMPARE(area, area2);
-
- area = area2;
-
- QCOMPARE(area, area2);
-
- QGeoShape area3(area2);
-
- QCOMPARE(area2, area3);
-}
-
-void tst_qgeoshape::debug_data()
-{
- QTest::addColumn<QGeoShape>("shape");
- QTest::addColumn<int>("nextValue");
- QTest::addColumn<QString>("debugString");
-
- QTest::newRow("uninitialized") << QGeoShape() << 45
- << QString("QGeoShape(Unknown) 45");
- QTest::newRow("rectangle") << QGeoShape(QGeoRectangle()) << 45
- << QString("QGeoShape(Rectangle) 45");
- QTest::newRow("circle") << QGeoShape(QGeoCircle()) << 45
- << QString("QGeoShape(Circle) 45");
- QTest::newRow("polygon") << QGeoShape(QGeoPolygon()) << 45
- << QString("QGeoShape(Polygon) 45");
- QTest::newRow("path") << QGeoShape(QGeoPath()) << 45
- << QString("QGeoShape(Path) 45");
-}
-
-
-void tst_qgeoshape::debug()
-{
- QFETCH(QGeoShape, shape);
- QFETCH(int, nextValue);
- QFETCH(QString, debugString);
-
- qInstallMessageHandler(tst_qgeoshape_messageHandler);
- qDebug() << shape << nextValue;
- qInstallMessageHandler(0);
- QCOMPARE(tst_qgeoshape_debug, debugString);
-}
-
-void tst_qgeoshape::conversions()
-{
- QVariant varShape = QVariant::fromValue(QGeoShape());
- QVariant varRect = QVariant::fromValue(QGeoRectangle(
- QGeoCoordinate(1, 1),
- QGeoCoordinate(2, 2)));
- QVariant varCircle = QVariant::fromValue(QGeoCircle(QGeoCoordinate(3, 3), 1000));
-
- QVERIFY(varShape.canConvert<QGeoShape>());
- QVERIFY(varShape.canConvert<QGeoCircle>());
- QVERIFY(varShape.canConvert<QGeoRectangle>());
- QVERIFY(!varRect.canConvert<QGeoCircle>());
- QVERIFY(varRect.canConvert<QGeoRectangle>());
- QVERIFY(varRect.canConvert<QGeoShape>());
- QVERIFY(varCircle.canConvert<QGeoCircle>());
- QVERIFY(!varCircle.canConvert<QGeoRectangle>());
- QVERIFY(varCircle.canConvert<QGeoShape>());
-}
-
-void tst_qgeoshape::serialization()
-{
- QByteArray data;
- // empty shape
- {
- QGeoShape shape;
- QDataStream writeStream(&data, QDataStream::WriteOnly);
- writeStream << shape;
-
- QGeoShape otherShape;
- QDataStream readStream(&data, QDataStream::ReadOnly);
- readStream >> otherShape;
-
- QCOMPARE(otherShape, shape);
- }
- // circle
- {
- QGeoCircle circle(QGeoCoordinate(1.1, 2.2), 10.5);
- QDataStream writeStream(&data, QDataStream::WriteOnly);
- writeStream << circle;
-
- QGeoShape otherCircle;
- QDataStream readStream(&data, QDataStream::ReadOnly);
- readStream >> otherCircle;
-
- QCOMPARE(otherCircle, circle);
- }
- // rectangle
- {
- QGeoRectangle rectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, 170));
- QDataStream writeStream(&data, QDataStream::WriteOnly);
- writeStream << rectangle;
-
- QGeoShape otherRectangle;
- QDataStream readStream(&data, QDataStream::ReadOnly);
- readStream >> otherRectangle;
-
- QCOMPARE(otherRectangle, rectangle);
- }
- // polygon
- {
- QGeoPolygon polygon({ QGeoCoordinate(30, 160),
- QGeoCoordinate(0, 170),
- QGeoCoordinate(-30, 160) });
- QDataStream writeStream(&data, QDataStream::WriteOnly);
- writeStream << polygon;
-
- QGeoShape otherPolygon;
- QDataStream readStream(&data, QDataStream::ReadOnly);
- readStream >> otherPolygon;
-
- QCOMPARE(otherPolygon, polygon);
- }
- // path
- {
- QGeoPath path({ QGeoCoordinate(30, 160), QGeoCoordinate(0, 170),
- QGeoCoordinate(-30, 180) }, 0.5);
- QDataStream writeStream(&data, QDataStream::WriteOnly);
- writeStream << path;
-
- QGeoShape otherPath;
- QDataStream readStream(&data, QDataStream::ReadOnly);
- readStream >> otherPath;
-
- QCOMPARE(otherPath, path);
- }
-}
-
-void tst_qgeoshape::hashing()
-{
- const size_t defaultShapeHash = qHash(QGeoShape());
-
- const QGeoCircle circle(QGeoCoordinate(1, 2), 10);
- const QGeoShape circleShape = circle;
- const size_t circleShapeHash = qHash(circleShape);
- QVERIFY(defaultShapeHash != circleShapeHash);
- QCOMPARE(qHash(circle), circleShapeHash);
-
- const QGeoRectangle rectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, 170));
- const QGeoShape rectangleShape = rectangle;
- const size_t rectangleShapeHash = qHash(rectangleShape);
- QVERIFY(defaultShapeHash != rectangleShapeHash);
- QVERIFY(circleShapeHash != rectangleShapeHash);
- QCOMPARE(qHash(rectangle), rectangleShapeHash);
-
- const QGeoPolygon polygon({ QGeoCoordinate(30, 160), QGeoCoordinate(0, 170),
- QGeoCoordinate(-30, 160) });
- const QGeoShape polygonShape = polygon;
- const size_t polygonShapeHash = qHash(polygonShape);
- QVERIFY(defaultShapeHash != polygonShapeHash);
- QVERIFY(circleShapeHash != polygonShapeHash);
- QVERIFY(rectangleShapeHash != polygonShapeHash);
- QCOMPARE(qHash(polygon), polygonShapeHash);
-
- const QGeoPath path({ QGeoCoordinate(30, 160), QGeoCoordinate(0, 170),
- QGeoCoordinate(-30, 180) }, 0.5);
- const QGeoShape pathShape = path;
- const size_t pathShapeHash = qHash(pathShape);
- QVERIFY(defaultShapeHash != pathShapeHash);
- QVERIFY(circleShapeHash != pathShapeHash);
- QVERIFY(rectangleShapeHash != pathShapeHash);
- QVERIFY(polygonShapeHash != pathShapeHash);
- QCOMPARE(qHash(path), pathShapeHash);
-}
-
-QTEST_MAIN(tst_qgeoshape)
-#include "tst_qgeoshape.moc"
diff --git a/tests/auto/qnmeapositioninfosource/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/CMakeLists.txt
deleted file mode 100644
index 6ac0e05c..00000000
--- a/tests/auto/qnmeapositioninfosource/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# Generated from qnmeapositioninfosource.pro.
-
-add_subdirectory(dummynmeapositioninfosource)
-add_subdirectory(qnmeapositioninfosource_realtime)
-add_subdirectory(qnmeapositioninfosource_simulation)
-add_subdirectory(qnmeapositioninfosource_realtime_generic)
-add_subdirectory(qnmeapositioninfosource_simulation_generic)
diff --git a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/CMakeLists.txt
deleted file mode 100644
index d152dc72..00000000
--- a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# Generated from dummynmeapositioninfosource.pro.
-
-#####################################################################
-## tst_dummynmeapositioninfosource Test:
-#####################################################################
-
-qt_internal_add_test(tst_dummynmeapositioninfosource
- SOURCES
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- tst_dummynmeapositioninfosource.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:dummynmeapositioninfosource.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/dummynmeapositioninfosource.pro b/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/dummynmeapositioninfosource.pro
deleted file mode 100644
index d32e2e31..00000000
--- a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/dummynmeapositioninfosource.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-QT += network positioning testlib
-TARGET = tst_dummynmeapositioninfosource
-
-INCLUDEPATH += ..
-
-HEADERS += ../../utils/qlocationtestutils_p.h \
- ../../qgeopositioninfosource/testqgeopositioninfosource_p.h \
- ../../utils/qnmeaproxyfactory.h
-
-SOURCES += ../../utils/qlocationtestutils.cpp \
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp \
- ../../utils/qnmeaproxyfactory.cpp \
- tst_dummynmeapositioninfosource.cpp
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/tst_dummynmeapositioninfosource.cpp b/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/tst_dummynmeapositioninfosource.cpp
deleted file mode 100644
index 70059550..00000000
--- a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/tst_dummynmeapositioninfosource.cpp
+++ /dev/null
@@ -1,149 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "../utils/qnmeaproxyfactory.h"
-#include "../utils/qlocationtestutils_p.h"
-
-#include <QtPositioning/qnmeapositioninfosource.h>
-#include <QSignalSpy>
-#include <QTest>
-
-Q_DECLARE_METATYPE(QNmeaPositionInfoSource::UpdateMode)
-
-class DummyNmeaPositionInfoSource : public QNmeaPositionInfoSource
-{
- Q_OBJECT
-
-public:
- DummyNmeaPositionInfoSource(QNmeaPositionInfoSource::UpdateMode mode, QObject *parent = 0);
-
-protected:
- bool parsePosInfoFromNmeaData(const char *data,
- int size,
- QGeoPositionInfo *posInfo,
- bool *hasFix) override;
-
-private:
- int callCount;
-};
-
-DummyNmeaPositionInfoSource::DummyNmeaPositionInfoSource(QNmeaPositionInfoSource::UpdateMode mode, QObject *parent) :
- QNmeaPositionInfoSource(mode, parent),
- callCount(0)
-{
-}
-
-bool DummyNmeaPositionInfoSource::parsePosInfoFromNmeaData(const char* data,
- int size,
- QGeoPositionInfo *posInfo,
- bool *hasFix)
-{
- Q_UNUSED(data);
- Q_UNUSED(size);
-
- posInfo->setCoordinate(QGeoCoordinate(callCount * 1.0, callCount * 1.0, callCount * 1.0));
- posInfo->setTimestamp(QDateTime::currentDateTimeUtc());
- *hasFix = true;
- ++callCount;
-
- return true;
-}
-
-class tst_DummyNmeaPositionInfoSource : public QObject
-{
- Q_OBJECT
-
-public:
- tst_DummyNmeaPositionInfoSource();
-
-private slots:
- void initTestCase();
- void testOverloadedParseFunction();
-};
-
-
-tst_DummyNmeaPositionInfoSource::tst_DummyNmeaPositionInfoSource() {}
-
-void tst_DummyNmeaPositionInfoSource::initTestCase()
-{
-
-}
-
-void tst_DummyNmeaPositionInfoSource::testOverloadedParseFunction()
-{
- DummyNmeaPositionInfoSource source(QNmeaPositionInfoSource::RealTimeMode);
- QNmeaProxyFactory factory;
- // proxy is deleted by the source
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spy(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
-
- QGeoPositionInfo pos;
-
- proxy->source()->startUpdates();
-
- proxy->feedBytes(QString("The parser converts\n").toLatin1());
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 1), 10000);
- pos = spy.at(0).at(0).value<QGeoPositionInfo>();
-
- QVERIFY((pos.coordinate().latitude() == 0.0)
- && (pos.coordinate().longitude() == 0.0)
- && (pos.coordinate().altitude() == 0.0));
-
- spy.clear();
-
- proxy->feedBytes(QString("any data it receives\n").toLatin1());
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 1), 10000);
- pos = spy.at(0).at(0).value<QGeoPositionInfo>();
-
- QVERIFY((pos.coordinate().latitude() == 1.0)
- && (pos.coordinate().longitude() == 1.0)
- && (pos.coordinate().altitude() == 1.0));
-
- spy.clear();
-
- proxy->feedBytes(QString("into positions\n").toLatin1());
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 1), 10000);
- pos = spy.at(0).at(0).value<QGeoPositionInfo>();
-
- QVERIFY((pos.coordinate().latitude() == 2.0)
- && (pos.coordinate().longitude() == 2.0)
- && (pos.coordinate().altitude() == 2.0));
-
- spy.clear();
-}
-
-#include "tst_dummynmeapositioninfosource.moc"
-
-QTEST_GUILESS_MAIN(tst_DummyNmeaPositionInfoSource);
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource.pro
deleted file mode 100644
index 8c168d52..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += \
- dummynmeapositioninfosource \
- qnmeapositioninfosource_realtime \
- qnmeapositioninfosource_simulation \
- qnmeapositioninfosource_realtime_generic \
- qnmeapositioninfosource_simulation_generic
-
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/CMakeLists.txt
deleted file mode 100644
index 4ca5f9a2..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Generated from qnmeapositioninfosource_realtime.pro.
-
-#####################################################################
-## tst_qnmeapositioninfosource_realtime Test:
-#####################################################################
-
-qt_internal_add_test(tst_qnmeapositioninfosource_realtime
- SOURCES
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp ../../qgeopositioninfosource/testqgeopositioninfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- ../tst_qnmeapositioninfosource.cpp ../tst_qnmeapositioninfosource.h
- tst_qnmeapositioninfosource_realtime.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qnmeapositioninfosource_realtime.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/qnmeapositioninfosource_realtime.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/qnmeapositioninfosource_realtime.pro
deleted file mode 100644
index fcff3d7a..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/qnmeapositioninfosource_realtime.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-QT += network positioning testlib
-TARGET = tst_qnmeapositioninfosource_realtime
-
-INCLUDEPATH += ..
-
-HEADERS += ../../utils/qlocationtestutils_p.h \
- ../../qgeopositioninfosource/testqgeopositioninfosource_p.h \
- ../../utils/qnmeaproxyfactory.h \
- ../tst_qnmeapositioninfosource.h
-
-SOURCES += ../../utils/qlocationtestutils.cpp \
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp \
- ../../utils/qnmeaproxyfactory.cpp \
- ../tst_qnmeapositioninfosource.cpp \
- tst_qnmeapositioninfosource_realtime.cpp
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/tst_qnmeapositioninfosource_realtime.cpp b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/tst_qnmeapositioninfosource_realtime.cpp
deleted file mode 100644
index 423f6573..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/tst_qnmeapositioninfosource_realtime.cpp
+++ /dev/null
@@ -1,44 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "tst_qnmeapositioninfosource.h"
-
-class tst_QNmeaPositionInfoSource_RealTime : public tst_QNmeaPositionInfoSource
-{
- Q_OBJECT
-
-public:
- tst_QNmeaPositionInfoSource_RealTime()
- : tst_QNmeaPositionInfoSource(QNmeaPositionInfoSource::RealTimeMode) {}
-};
-
-#include "tst_qnmeapositioninfosource_realtime.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaPositionInfoSource_RealTime);
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/CMakeLists.txt
deleted file mode 100644
index d7f2bfdd..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Generated from qnmeapositioninfosource_realtime_generic.pro.
-
-#####################################################################
-## tst_qnmeapositioninfosource_realtime_generic Test:
-#####################################################################
-
-qt_internal_add_test(tst_qnmeapositioninfosource_realtime_generic
- SOURCES
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp ../../qgeopositioninfosource/testqgeopositioninfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- ../tst_qnmeapositioninfosource.cpp ../tst_qnmeapositioninfosource.h
- tst_qnmeapositioninfosource_realtime_generic.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qnmeapositioninfosource_realtime_generic.pro:<TRUE>:
-# TEMPLATE = "app"
-# testcase.timeout = "400"
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro
deleted file mode 100644
index 0fbbd76e..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-testcase.timeout = 400 # this test is slow
-QT += network positioning testlib
-TARGET = tst_qnmeapositioninfosource_realtime_generic
-
-INCLUDEPATH += ..
-
-HEADERS += ../../utils/qlocationtestutils_p.h \
- ../../qgeopositioninfosource/testqgeopositioninfosource_p.h \
- ../../utils/qnmeaproxyfactory.h \
- ../tst_qnmeapositioninfosource.h
-
-SOURCES += ../../utils/qlocationtestutils.cpp \
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp \
- ../../utils/qnmeaproxyfactory.cpp \
- ../tst_qnmeapositioninfosource.cpp \
- tst_qnmeapositioninfosource_realtime_generic.cpp
-
-CONFIG -= app_bundle
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp
deleted file mode 100644
index abb5e9ae..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp
+++ /dev/null
@@ -1,77 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "tst_qnmeapositioninfosource.h"
-
-class tst_QNmeaPositionInfoSource_RealTime_Generic : public TestQGeoPositionInfoSource
-{
- Q_OBJECT
-
-public:
- tst_QNmeaPositionInfoSource_RealTime_Generic()
- {
- m_factory = new QNmeaProxyFactory;
-#if QT_CONFIG(library)
- /*
- * Set custom path since CI doesn't install test plugins
- */
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
- + QStringLiteral("/../../../../plugins"));
-#endif
-#endif
- }
-
- ~tst_QNmeaPositionInfoSource_RealTime_Generic()
- {
- delete m_factory;
- }
-
-protected:
- QGeoPositionInfoSource *createTestSource() override
- {
- QNmeaPositionInfoSource *source = new QNmeaPositionInfoSource(QNmeaPositionInfoSource::RealTimeMode);
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- m_factory->createPositionInfoSourceProxy(source));
- Feeder *feeder = new Feeder(source);
- feeder->start(proxy);
- return source;
- }
-
-private:
- QNmeaProxyFactory *m_factory;
-};
-
-#include "tst_qnmeapositioninfosource_realtime_generic.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaPositionInfoSource_RealTime_Generic);
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/CMakeLists.txt
deleted file mode 100644
index f0ea5cec..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Generated from qnmeapositioninfosource_simulation.pro.
-
-#####################################################################
-## tst_qnmeapositioninfosource_simulation Test:
-#####################################################################
-
-qt_internal_add_test(tst_qnmeapositioninfosource_simulation
- SOURCES
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp ../../qgeopositioninfosource/testqgeopositioninfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- ../tst_qnmeapositioninfosource.cpp ../tst_qnmeapositioninfosource.h
- tst_qnmeapositioninfosource_simulation.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qnmeapositioninfosource_simulation.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/qnmeapositioninfosource_simulation.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/qnmeapositioninfosource_simulation.pro
deleted file mode 100644
index 88bb18f9..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/qnmeapositioninfosource_simulation.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-QT += network positioning testlib
-TARGET = tst_qnmeapositioninfosource_simulation
-
-INCLUDEPATH += ..
-
-HEADERS += ../../utils/qlocationtestutils_p.h \
- ../../qgeopositioninfosource/testqgeopositioninfosource_p.h \
- ../../utils/qnmeaproxyfactory.h \
- ../tst_qnmeapositioninfosource.h
-
-SOURCES += ../../utils/qlocationtestutils.cpp \
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp \
- ../../utils/qnmeaproxyfactory.cpp \
- ../tst_qnmeapositioninfosource.cpp \
- tst_qnmeapositioninfosource_simulation.cpp
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/tst_qnmeapositioninfosource_simulation.cpp b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/tst_qnmeapositioninfosource_simulation.cpp
deleted file mode 100644
index ffe5e1d0..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/tst_qnmeapositioninfosource_simulation.cpp
+++ /dev/null
@@ -1,43 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "tst_qnmeapositioninfosource.h"
-
-class tst_QNmeaPositionInfoSource_Simulation : public tst_QNmeaPositionInfoSource
-{
- Q_OBJECT
-public:
- tst_QNmeaPositionInfoSource_Simulation()
- : tst_QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode) {}
-};
-
-#include "tst_qnmeapositioninfosource_simulation.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaPositionInfoSource_Simulation);
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/CMakeLists.txt
deleted file mode 100644
index 9232f9a8..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Generated from qnmeapositioninfosource_simulation_generic.pro.
-
-#####################################################################
-## tst_qnmeapositioninfosource_simulation_generic Test:
-#####################################################################
-
-# special case begin
-
-# Renamed the target due to problems with the maximum full path on
-# Windows systems (which is 250 characters only)
-qt_internal_add_test(tst_qnmeaposinfosource_sim_generic
-# special case end
- SOURCES
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp ../../qgeopositioninfosource/testqgeopositioninfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- ../tst_qnmeapositioninfosource.cpp ../tst_qnmeapositioninfosource.h
- tst_qnmeapositioninfosource_simulation_generic.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qnmeapositioninfosource_simulation_generic.pro:<TRUE>:
-# TEMPLATE = "app"
-# testcase.timeout = "400"
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro
deleted file mode 100644
index b198bf7c..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-testcase.timeout = 400 # this test is slow
-QT += network positioning testlib
-TARGET = tst_qnmeapositioninfosource_simulation_generic
-
-INCLUDEPATH += ..
-
-HEADERS += ../../utils/qlocationtestutils_p.h \
- ../../qgeopositioninfosource/testqgeopositioninfosource_p.h \
- ../../utils/qnmeaproxyfactory.h \
- ../tst_qnmeapositioninfosource.h
-
-SOURCES += ../../utils/qlocationtestutils.cpp \
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp \
- ../../utils/qnmeaproxyfactory.cpp \
- ../tst_qnmeapositioninfosource.cpp \
- tst_qnmeapositioninfosource_simulation_generic.cpp
-
-CONFIG -= app_bundle
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp
deleted file mode 100644
index 2f2827de..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp
+++ /dev/null
@@ -1,64 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "tst_qnmeapositioninfosource.h"
-
-class tst_QNmeaPositionInfoSource_Simulation_Generic : public TestQGeoPositionInfoSource
-{
- Q_OBJECT
-public:
- tst_QNmeaPositionInfoSource_Simulation_Generic()
- {
-#if QT_CONFIG(library)
- /*
- * Set custom path since CI doesn't install test plugins
- */
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
- + QStringLiteral("/../../../../plugins"));
-#endif
-#endif
- }
-
-protected:
- QGeoPositionInfoSource *createTestSource() override
- {
- QNmeaPositionInfoSource *source = new QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode);
- source->setDevice(new UnlimitedNmeaStream(source));
- return source;
- }
-};
-
-#include "tst_qnmeapositioninfosource_simulation_generic.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaPositionInfoSource_Simulation_Generic);
diff --git a/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.cpp b/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.cpp
deleted file mode 100644
index e99faa6d..00000000
--- a/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.cpp
+++ /dev/null
@@ -1,605 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd.
-** Contact: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
-** 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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "tst_qnmeapositioninfosource.h"
-
-#include <QtCore/QDateTime>
-#include <QtCore/QElapsedTimer>
-#include <QtCore/QtNumeric>
-
-#ifdef Q_OS_WIN
-
-// Windows seems to require longer timeouts and step length
-// We override the standard QTestCase related macros
-
-#ifdef QTRY_COMPARE_WITH_TIMEOUT
-#undef QTRY_COMPARE_WITH_TIMEOUT
-#endif
-#define QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \
-do { \
- const int __step = 100; \
- const int __timeoutValue = __timeout; \
- if ((__expr) != (__expected)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeoutValue && ((__expr) != (__expected)); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QCOMPARE(__expr, __expected); \
-} while (0)
-
-#ifdef QTRY_COMPARE
-#undef QTRY_COMPARE
-#endif
-#define QTRY_COMPARE(__expr, __expected) QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, 10000)
-
-#endif
-
-tst_QNmeaPositionInfoSource::tst_QNmeaPositionInfoSource(QNmeaPositionInfoSource::UpdateMode mode, QObject *parent)
- : QObject(parent),
- m_mode(mode)
-{
-}
-
-void tst_QNmeaPositionInfoSource::initTestCase()
-{
- qRegisterMetaType<QNmeaPositionInfoSource::UpdateMode>();
-}
-
-void tst_QNmeaPositionInfoSource::constructor()
-{
- QObject o;
- QNmeaPositionInfoSource source(m_mode, &o);
- QCOMPARE(source.updateMode(), m_mode);
- QCOMPARE(source.parent(), &o);
-}
-
-void tst_QNmeaPositionInfoSource::supportedPositioningMethods()
-{
- QNmeaPositionInfoSource source(m_mode);
- QCOMPARE(source.supportedPositioningMethods(), QNmeaPositionInfoSource::SatellitePositioningMethods);
-}
-
-void tst_QNmeaPositionInfoSource::minimumUpdateInterval()
-{
- QNmeaPositionInfoSource source(m_mode);
- QCOMPARE(source.minimumUpdateInterval(), 2);
-}
-
-void tst_QNmeaPositionInfoSource::userEquivalentRangeError()
-{
- QNmeaPositionInfoSource source(m_mode);
- QVERIFY(qIsNaN(source.userEquivalentRangeError()));
- source.setUserEquivalentRangeError(5.1);
- QVERIFY(qFuzzyCompare(source.userEquivalentRangeError(), 5.1));
-}
-
-void tst_QNmeaPositionInfoSource::setUpdateInterval_delayedUpdate()
-{
- // If an update interval is set, and an update is not available at a
- // particular interval, the source should emit the next update as soon
- // as it becomes available
-
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- proxy->source()->setUpdateInterval(500);
- proxy->source()->startUpdates();
-
- QTest::qWait(600);
- QDateTime now = QDateTime::currentDateTime();
- proxy->feedUpdate(now);
- QTRY_COMPARE(spyUpdate.count(), 1);
-
- // should have gotten the update immediately, and not have needed to
- // wait until the next interval
- QVERIFY(now.time().msecsTo(QDateTime::currentDateTime().time()) < 400);
-}
-
-void tst_QNmeaPositionInfoSource::lastKnownPosition()
-{
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QCOMPARE(proxy->source()->lastKnownPosition(), QGeoPositionInfo());
-
- // source may need requestUpdate() or startUpdates() to be called to
- // trigger reading of data channel
- QSignalSpy spyTimeout(proxy->source(), SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- proxy->source()->requestUpdate(proxy->source()->minimumUpdateInterval());
- QTRY_COMPARE(spyTimeout.count(), 1);
- const QList<QVariant> arguments = spyTimeout.takeFirst();
- const auto error = arguments.at(0).value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
-
- // If an update is received and startUpdates() or requestUpdate() hasn't
- // been called, it should still be available through lastKnownPosition()
- QDateTime dt = QDateTime::currentDateTimeUtc();
- proxy->feedUpdate(dt);
- QTRY_COMPARE(proxy->source()->lastKnownPosition().timestamp(), dt);
-
- QList<QDateTime> dateTimes = createDateTimes(5);
- for (int i=0; i<dateTimes.count(); i++) {
- proxy->source()->requestUpdate(); // Irrelevant for this test
- proxy->feedUpdate(dateTimes[i]);
- QTRY_COMPARE(proxy->source()->lastKnownPosition().timestamp(), dateTimes[i]);
- }
-
- proxy->source()->startUpdates();
- // if dateTimes are older than before, they will be ignored.
- dateTimes = createDateTimes(dateTimes.last().addMSecs(100), 5);
- for (int i=0; i<dateTimes.count(); i++) {
- proxy->feedUpdate(dateTimes[i]);
- QTRY_COMPARE(proxy->source()->lastKnownPosition().timestamp(), dateTimes[i]);
- }
-}
-
-void tst_QNmeaPositionInfoSource::beginWithBufferedData()
-{
- // In SimulationMode, data stored in the QIODevice is read when
- // startUpdates() or requestUpdate() is called.
- // In RealTimeMode, all existing data in the QIODevice is ignored -
- // only new data will be read.
-
- QFETCH(QList<QDateTime>, dateTimes);
- QFETCH(UpdateTriggerMethod, trigger);
-
- QByteArray bytes;
- for (int i=0; i<dateTimes.count(); i++)
- bytes += QLocationTestUtils::createRmcSentence(dateTimes[i]).toLatin1();
- QBuffer buffer;
- buffer.setData(bytes);
-
- QNmeaPositionInfoSource source(m_mode);
- QSignalSpy spy(&source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- source.setDevice(&buffer);
-
- if (trigger == StartUpdatesMethod)
- source.startUpdates();
- else if (trigger == RequestUpdatesMethod)
- source.requestUpdate();
-
- if (m_mode == QNmeaPositionInfoSource::RealTimeMode) {
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 0, 300);
- } else {
- if (trigger == StartUpdatesMethod) {
- QTRY_COMPARE(spy.count(), dateTimes.count());
- for (int i=0; i<dateTimes.count(); i++)
- QCOMPARE(spy.at(i).at(0).value<QGeoPositionInfo>().timestamp(), dateTimes[i]);
- } else if (trigger == RequestUpdatesMethod) {
- QTRY_COMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).value<QGeoPositionInfo>().timestamp(), dateTimes.first());
- }
- }
-}
-
-void tst_QNmeaPositionInfoSource::beginWithBufferedData_data()
-{
- QTest::addColumn<QList<QDateTime> >("dateTimes");
- QTest::addColumn<UpdateTriggerMethod>("trigger");
-
- QList<QDateTime> dateTimes;
- dateTimes << QDateTime::currentDateTime().toUTC();
-
- QTest::newRow("startUpdates(), 1 update in buffer") << dateTimes << StartUpdatesMethod;
- QTest::newRow("requestUpdate(), 1 update in buffer") << dateTimes << RequestUpdatesMethod;
-
- for (int i=1; i<3; i++)
- dateTimes << dateTimes[0].addMSecs(i * 100);
- QTest::newRow("startUpdates(), multiple updates in buffer") << dateTimes << StartUpdatesMethod;
- QTest::newRow("requestUpdate(), multiple updates in buffer") << dateTimes << RequestUpdatesMethod;
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates()
-{
- QFETCH(QList<QDateTime>, dateTimes);
-
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- proxy->source()->startUpdates();
-
- for (int i=0; i<dateTimes.count(); i++)
- proxy->feedUpdate(dateTimes[i]);
- QTRY_COMPARE(spyUpdate.count(), dateTimes.count());
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates_data()
-{
- QTest::addColumn<QList<QDateTime> >("dateTimes");
-
- QTest::newRow("1 update") << createDateTimes(1);
- QTest::newRow("2 updates") << createDateTimes(2);
- QTest::newRow("10 updates") << createDateTimes(10);
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates_withTimeout()
-{
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(proxy->source(), SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- proxy->source()->setUpdateInterval(1000);
- proxy->source()->startUpdates();
-
- QDateTime dt = QDateTime::currentDateTimeUtc();
-
- if (m_mode == QNmeaPositionInfoSource::SimulationMode) {
- // the first sentence primes the simulation
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt).toLatin1());
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addMSecs(10)).toLatin1());
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addMSecs(1100)).toLatin1());
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addMSecs(2200)).toLatin1());
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addSecs(9)).toLatin1());
-
- QElapsedTimer t;
- t.start();
-
- for (int j = 1; j < 4; ++j) {
- QTRY_COMPARE(spyUpdate.count(), j);
- QCOMPARE(spyTimeout.count(), 0);
- int time = t.elapsed();
- QVERIFY((time > j*1000 - 300) && (time < j*1000 + 300));
- }
-
- spyUpdate.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 0) && (spyTimeout.count() == 1), 7500);
- const QList<QVariant> arguments = spyTimeout.takeFirst();
- const auto error = arguments.at(0).value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
- spyTimeout.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 1) && (spyTimeout.count() == 0), 7500);
-
- } else {
- // dt + 900
- QTRY_VERIFY(spyUpdate.count() == 0 && spyTimeout.count() == 0);
-
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addSecs(1)).toLatin1());
- // dt + 1200
- QTRY_VERIFY(spyUpdate.count() == 1 && spyTimeout.count() == 0);
- spyUpdate.clear();
-
- // dt + 1900
- QTRY_VERIFY(spyUpdate.count() == 0 && spyTimeout.count() == 0);
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addSecs(2)).toLatin1());
-
- // dt + 2200
- QTRY_VERIFY(spyUpdate.count() == 1 && spyTimeout.count() == 0);
- spyUpdate.clear();
-
- // dt + 2900
- QTRY_VERIFY(spyUpdate.count() == 0 && spyTimeout.count() == 0);
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addSecs(3)).toLatin1());
-
- // dt + 3200
- QTRY_VERIFY(spyUpdate.count() == 1 && spyTimeout.count() == 0);
- spyUpdate.clear();
-
- // dt + 6900
- QTRY_VERIFY(spyUpdate.count() == 0 && spyTimeout.count() == 1);
- const QList<QVariant> arguments = spyTimeout.takeFirst();
- const auto error = arguments.at(0).value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
- spyTimeout.clear();
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addSecs(7)).toLatin1());
-
- // dt + 7200
- QTRY_VERIFY(spyUpdate.count() == 1 && spyTimeout.count() == 0);
- spyUpdate.clear();
- }
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates_expectLatestUpdateOnly()
-{
- // If startUpdates() is called and an interval has been set, if multiple'
- // updates are in the buffer, only the latest update should be emitted
-
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- proxy->source()->setUpdateInterval(500);
- proxy->source()->startUpdates();
-
- QList<QDateTime> dateTimes = createDateTimes(3);
- for (int i=0; i<dateTimes.count(); i++)
- proxy->feedUpdate(dateTimes[i]);
-
- QTRY_COMPARE(spyUpdate.count(), 1);
- QCOMPARE(spyUpdate[0][0].value<QGeoPositionInfo>().timestamp(), dateTimes.last());
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates_waitForValidDateTime()
-{
- // Tests that the class does not emit an update until it receives a
- // sentences with a valid date *and* time. All sentences before this
- // should be ignored, and any sentences received after this that do
- // not have a date should use the known date.
-
- QFETCH(QByteArray, bytes);
- QFETCH(QList<QDateTime>, dateTimes);
- QFETCH(QList<bool>, expectHorizontalAccuracy);
- QFETCH(QList<bool>, expectVerticalAccuracy);
-
- QNmeaPositionInfoSource source(m_mode);
- source.setUserEquivalentRangeError(5.1);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spy(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- QObject::connect(proxy->source(), &QNmeaPositionInfoSource::positionUpdated, [](const QGeoPositionInfo &info) {
- qDebug() << info.timestamp();
- });
-
- proxy->source()->startUpdates();
- proxy->feedBytes(bytes);
- QTest::qWait(1000); // default push delay is 20ms
- QTRY_COMPARE(spy.count(), dateTimes.count());
-
- for (int i=0; i<spy.count(); i++) {
- QGeoPositionInfo pInfo = spy[i][0].value<QGeoPositionInfo>();
-
- QCOMPARE(pInfo.timestamp(), dateTimes[i]);
-
- // Generated GGA/GSA sentences have hard coded HDOP of 3.5, which corrisponds to a
- // horizontal accuracy of 35.7, for the user equivalent range error of 5.1 set above.
- QCOMPARE(pInfo.hasAttribute(QGeoPositionInfo::HorizontalAccuracy),
- expectHorizontalAccuracy[i]);
- if (pInfo.hasAttribute(QGeoPositionInfo::HorizontalAccuracy))
- QVERIFY(qFuzzyCompare(pInfo.attribute(QGeoPositionInfo::HorizontalAccuracy), 35.7));
-
- // Generated GSA sentences have hard coded VDOP of 4.0, which corrisponds to a vertical
- // accuracy of 40.8, for the user equivalent range error of 5.1 set above.
- QCOMPARE(pInfo.hasAttribute(QGeoPositionInfo::VerticalAccuracy),
- expectVerticalAccuracy[i]);
- if (pInfo.hasAttribute(QGeoPositionInfo::VerticalAccuracy))
- QVERIFY(qFuzzyCompare(pInfo.attribute(QGeoPositionInfo::VerticalAccuracy), 40.8));
- }
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates_waitForValidDateTime_data()
-{
- QTest::addColumn<QByteArray>("bytes");
- QTest::addColumn<QList<QDateTime> >("dateTimes");
- QTest::addColumn<QList<bool> >("expectHorizontalAccuracy");
- QTest::addColumn<QList<bool> >("expectVerticalAccuracy");
-
- QDateTime dt = QDateTime::currentDateTime().toUTC();
- QByteArray bytes;
-
- // should only receive RMC sentence and the GGA sentence *after* it
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(100).time()).toLatin1();
- bytes += QLocationTestUtils::createRmcSentence(dt.addMSecs(200)).toLatin1();
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(300).time()).toLatin1();
- // The first GGA does not have date, and there's no cached date to inject, so that update will be invalid
- QTest::newRow("Feed GGA,RMC,GGA; expect RMC, second GGA only")
- << bytes << (QList<QDateTime>() << dt.addMSecs(200) << dt.addMSecs(300))
- << (QList<bool>() << true << true) // accuracies are currently cached and injected in QGeoPositionInfos that do not have it
- << (QList<bool>() << false << false);
-
- // should not receive ZDA (has no coordinates) but should get the GGA
- // sentence after it since it got the date/time from ZDA
- bytes.clear();
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(100).time()).toLatin1();
- bytes += QLocationTestUtils::createZdaSentence(dt.addMSecs(200)).toLatin1();
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(300).time()).toLatin1();
- QTest::newRow("Feed GGA,ZDA,GGA; expect second GGA only")
- << bytes << (QList<QDateTime>() << dt.addMSecs(300))
- << (QList<bool>() << true)
- << (QList<bool>() << false);
-
- // Feed ZDA,GGA,GSA,GGA; expect vertical accuracy from second GGA.
- bytes.clear();
- bytes += QLocationTestUtils::createZdaSentence(dt.addMSecs(100)).toLatin1();
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(200).time()).toLatin1();
- bytes += QLocationTestUtils::createGsaSentence().toLatin1();
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(300).time()).toLatin1();
- if (m_mode == QNmeaPositionInfoSource::SimulationMode) {
- QTest::newRow("Feed ZDA,GGA,GSA,GGA; expect vertical accuracy from second GGA")
- << bytes << (QList<QDateTime>() << dt.addMSecs(200) << dt.addMSecs(300))
- << (QList<bool>() << true << true)
- << (QList<bool>() << true << true); // First GGA gets VDOP from GSA bundled into previous, as it has no timestamp, second GGA gets the cached value.
- }
-
- if (m_mode == QNmeaPositionInfoSource::SimulationMode) {
- // In sim m_mode, should ignore sentence with a date/time before the known date/time
- // (in real time m_mode, everything is passed on regardless)
- bytes.clear();
- bytes += QLocationTestUtils::createRmcSentence(dt.addMSecs(100)).toLatin1();
- bytes += QLocationTestUtils::createRmcSentence(dt.addMSecs(-200)).toLatin1();
- bytes += QLocationTestUtils::createRmcSentence(dt.addMSecs(200)).toLatin1();
- QTest::newRow("Feed good RMC, RMC with bad date/time, good RMC; expect first and third RMC only")
- << bytes << (QList<QDateTime>() << dt.addMSecs(100) << dt.addMSecs(200))
- << (QList<bool>() << false << false)
- << (QList<bool>() << false << false);
- }
-}
-
-void tst_QNmeaPositionInfoSource::requestUpdate_waitForValidDateTime()
-{
- QFETCH(QByteArray, bytes);
- QFETCH(QList<QDateTime>, dateTimes);
-
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spy(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- proxy->source()->requestUpdate();
-
- proxy->feedBytes(bytes);
- QTRY_COMPARE(spy.count(), 1);
- QCOMPARE(spy[0][0].value<QGeoPositionInfo>().timestamp(), dateTimes[0]);
-}
-
-void tst_QNmeaPositionInfoSource::requestUpdate_waitForValidDateTime_data()
-{
- startUpdates_waitForValidDateTime_data();
-}
-
-void tst_QNmeaPositionInfoSource::requestUpdate()
-{
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(proxy->source(), SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- QDateTime dt;
-
- proxy->source()->requestUpdate(100);
- QTRY_COMPARE(spyTimeout.count(), 1);
- auto error = spyTimeout[0][0].value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
- spyTimeout.clear();
-
- dt = QDateTime::currentDateTimeUtc();
- proxy->feedUpdate(dt);
- proxy->source()->requestUpdate();
- QTRY_COMPARE(spyUpdate.count(), 1);
- QCOMPARE(spyUpdate[0][0].value<QGeoPositionInfo>().timestamp(), dt);
- QCOMPARE(spyTimeout.count(), 0);
- spyUpdate.clear();
-
- // delay the update and expect it to be emitted after 300ms
- dt = QDateTime::currentDateTimeUtc();
- proxy->source()->requestUpdate(1000);
- QTest::qWait(300);
- proxy->feedUpdate(dt);
- QTRY_COMPARE(spyUpdate.count(), 1);
- QCOMPARE(spyUpdate[0][0].value<QGeoPositionInfo>().timestamp(), dt);
- QCOMPARE(spyTimeout.count(), 0);
- spyUpdate.clear();
-
- // delay the update and expect errorOccurred() to be emitted
- dt = QDateTime::currentDateTimeUtc();
- proxy->source()->requestUpdate(500);
- QTest::qWait(1000);
- proxy->feedUpdate(dt);
- QCOMPARE(spyTimeout.count(), 1);
- error = spyTimeout[0][0].value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
- QCOMPARE(spyUpdate.count(), 0);
- spyUpdate.clear();
-}
-
-void tst_QNmeaPositionInfoSource::requestUpdate_after_start()
-{
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(proxy->source(), SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- // Start updates with 500ms interval and requestUpdate() with 100ms
- // timeout. Feed an update, and it should be emitted immediately due to
- // the requestUpdate(). The update should not be emitted again after that
- // (i.e. the startUpdates() interval should not cause it to be re-emitted).
-
- QDateTime dt = QDateTime::currentDateTimeUtc();
- proxy->source()->setUpdateInterval(500);
- proxy->source()->startUpdates();
- proxy->source()->requestUpdate(100);
- proxy->feedUpdate(dt);
- QTRY_COMPARE(spyUpdate.count(), 1);
- QCOMPARE(spyUpdate[0][0].value<QGeoPositionInfo>().timestamp(), dt);
- QCOMPARE(spyTimeout.count(), 0);
- spyUpdate.clear();
-
- // Update has been emitted for requestUpdate(), shouldn't be emitted for startUpdates()
- QTRY_COMPARE_WITH_TIMEOUT(spyUpdate.count(), 0, 1000);
-}
-
-void tst_QNmeaPositionInfoSource::testWithBadNmea()
-{
- QFETCH(QByteArray, bytes);
- QFETCH(QList<QDateTime>, dateTimes);
- QFETCH(UpdateTriggerMethod, trigger);
-
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spy(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- if (trigger == StartUpdatesMethod)
- proxy->source()->startUpdates();
- else
- proxy->source()->requestUpdate();
-
- proxy->feedBytes(bytes);
- QTRY_COMPARE(spy.count(), dateTimes.count());
- for (int i=0; i<dateTimes.count(); i++)
- QCOMPARE(spy[i][0].value<QGeoPositionInfo>().timestamp(), dateTimes[i]);
-}
-
-void tst_QNmeaPositionInfoSource::testWithBadNmea_data()
-{
- QTest::addColumn<QByteArray>("bytes");
- QTest::addColumn<QList<QDateTime> >("dateTimes");
- QTest::addColumn<UpdateTriggerMethod>("trigger");
-
- QDateTime firstDateTime = QDateTime::currentDateTimeUtc();
- QByteArray bad = QLocationTestUtils::createRmcSentence(firstDateTime.addSecs(1)).toLatin1();
- bad = bad.mid(bad.length()/2);
- QDateTime lastDateTime = firstDateTime.addSecs(2);
-
- QByteArray bytes;
- bytes += QLocationTestUtils::createRmcSentence(firstDateTime).toLatin1();
- bytes += bad;
- bytes += QLocationTestUtils::createRmcSentence(lastDateTime).toLatin1();
- QTest::newRow("requestUpdate(), bad second sentence") << bytes
- << (QList<QDateTime>() << firstDateTime) << RequestUpdatesMethod;
- QTest::newRow("startUpdates(), bad second sentence") << bytes
- << (QList<QDateTime>() << firstDateTime << lastDateTime) << StartUpdatesMethod;
-}
diff --git a/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.h b/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.h
deleted file mode 100644
index 83cd284d..00000000
--- a/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.h
+++ /dev/null
@@ -1,182 +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 "../qgeopositioninfosource/testqgeopositioninfosource_p.h"
-#include "../utils/qnmeaproxyfactory.h"
-#include "../utils/qlocationtestutils_p.h"
-
-#include <QtPositioning/qnmeapositioninfosource.h>
-
-#include <QTest>
-#include <QDir>
-#include <QDebug>
-#include <QBuffer>
-#include <QSignalSpy>
-#include <QMetaType>
-#include <QFile>
-#include <QTemporaryFile>
-#include <QHash>
-#include <QTimer>
-
-QT_USE_NAMESPACE
-Q_DECLARE_METATYPE(QNmeaPositionInfoSource::UpdateMode)
-Q_DECLARE_METATYPE(QList<QDateTime>)
-
-class tst_QNmeaPositionInfoSource : public QObject
-{
- Q_OBJECT
-
-public:
- enum UpdateTriggerMethod
- {
- StartUpdatesMethod,
- RequestUpdatesMethod
- };
-
- tst_QNmeaPositionInfoSource(QNmeaPositionInfoSource::UpdateMode mode, QObject *parent = 0);
-
-private:
- QList<QDateTime> createDateTimes(const QDateTime &dt, int count) const
- {
- QList<QDateTime> dateTimes;
- int interval = 100;
- for (int i=0; i<count; i++) {
- dateTimes << dt.addMSecs(interval);
- interval += 100;
- }
- return dateTimes;
- }
-
- QList<QDateTime> createDateTimes(int count) const
- {
- return createDateTimes(QDateTime::currentDateTime().toUTC(), count);
- }
-
-private slots:
- void initTestCase();
-
- void constructor();
-
- void supportedPositioningMethods();
-
- void minimumUpdateInterval();
-
- void userEquivalentRangeError();
-
- void setUpdateInterval_delayedUpdate();
-
- void lastKnownPosition();
-
- void beginWithBufferedData();
- void beginWithBufferedData_data();
-
- void startUpdates();
- void startUpdates_data();
-
- void startUpdates_withTimeout();
-
- void startUpdates_expectLatestUpdateOnly();
-
- void startUpdates_waitForValidDateTime();
- void startUpdates_waitForValidDateTime_data();
-
- void requestUpdate_waitForValidDateTime();
- void requestUpdate_waitForValidDateTime_data();
-
- void requestUpdate();
- void requestUpdate_after_start();
-
- void testWithBadNmea();
- void testWithBadNmea_data();
-
-private:
- QNmeaPositionInfoSource::UpdateMode m_mode;
-};
-
-Q_DECLARE_METATYPE(tst_QNmeaPositionInfoSource::UpdateTriggerMethod)
-
-//---------------------------------------------------
-
-class Feeder : public QObject
-{
- Q_OBJECT
-
-public:
- Feeder(QObject *parent)
- : QObject(parent)
- {
- }
-
- void start(QNmeaPositionInfoSourceProxy *proxy)
- {
- m_proxy = proxy;
- QTimer *timer = new QTimer(this);
- QObject::connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
- timer->setInterval(proxy->source()->minimumUpdateInterval()*2);
- timer->start();
- }
-
-public slots:
- void timeout()
- {
- m_proxy->feedBytes(QLocationTestUtils::createRmcSentence(QDateTime::currentDateTime()).toLatin1());
- }
-
-private:
- QNmeaPositionInfoSourceProxy *m_proxy;
-};
-
-//---------------------------------------------------
-
-
-class UnlimitedNmeaStream : public QIODevice
-{
- Q_OBJECT
-
-public:
- UnlimitedNmeaStream(QObject *parent) : QIODevice(parent) {}
-
-protected:
- qint64 readData(char *data, qint64 maxSize) override
- {
- QByteArray bytes = QLocationTestUtils::createRmcSentence(QDateTime::currentDateTime()).toLatin1();
- qint64 sz = qMin(qint64(bytes.size()), maxSize);
- memcpy(data, bytes.constData(), sz);
- return sz;
- }
-
- qint64 writeData(const char *, qint64) override
- {
- return -1;
- }
-
- qint64 bytesAvailable() const override
- {
- return 1024 + QIODevice::bytesAvailable();
- }
-};
diff --git a/tests/auto/qnmeasatelliteinfosource/CMakeLists.txt b/tests/auto/qnmeasatelliteinfosource/CMakeLists.txt
deleted file mode 100644
index 865b782e..00000000
--- a/tests/auto/qnmeasatelliteinfosource/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-add_subdirectory(dummy)
-add_subdirectory(generic_realtime)
-add_subdirectory(generic_simulation)
-add_subdirectory(nmea)
diff --git a/tests/auto/qnmeasatelliteinfosource/dummy/CMakeLists.txt b/tests/auto/qnmeasatelliteinfosource/dummy/CMakeLists.txt
deleted file mode 100644
index f4a323e0..00000000
--- a/tests/auto/qnmeasatelliteinfosource/dummy/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# special case begin
-qt_internal_add_test(tst_dummynmeasatelliteinfosource
- SOURCES
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- tst_dummynmeasatelliteinfosource.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
-)
-# special case end
diff --git a/tests/auto/qnmeasatelliteinfosource/dummy/tst_dummynmeasatelliteinfosource.cpp b/tests/auto/qnmeasatelliteinfosource/dummy/tst_dummynmeasatelliteinfosource.cpp
deleted file mode 100644
index 432f60fe..00000000
--- a/tests/auto/qnmeasatelliteinfosource/dummy/tst_dummynmeasatelliteinfosource.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QTest>
-#include <QSignalSpy>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-#include "../../utils/qnmeaproxyfactory.h"
-
-class DummyNmeaSatelliteInfoSource : public QNmeaSatelliteInfoSource
-{
- Q_OBJECT
-
-public:
- DummyNmeaSatelliteInfoSource(QObject *parent = 0);
-
-protected:
- QGeoSatelliteInfo::SatelliteSystem parseSatellitesInUseFromNmea(const char *data, int size,
- QList<int> &pnrsInUse) override;
- SatelliteInfoParseStatus parseSatelliteInfoFromNmea(const char *data, int size,
- QList<QGeoSatelliteInfo> &infos,
- QGeoSatelliteInfo::SatelliteSystem &system) override;
-};
-
-DummyNmeaSatelliteInfoSource::DummyNmeaSatelliteInfoSource(QObject *parent)
- : QNmeaSatelliteInfoSource(QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode, parent)
-{
-}
-
-QGeoSatelliteInfo::SatelliteSystem
-DummyNmeaSatelliteInfoSource::parseSatellitesInUseFromNmea(const char *data, int size,
- QList<int> &pnrsInUse)
-{
- // expected format: "USE:num1;num2;num3\n"
- // example: "USE:1;3;4;7\n"
- if (!data || !size)
- return QGeoSatelliteInfo::Undefined;
-
- QString str = QLatin1String(data, size).toString();
- if (!str.startsWith("USE:"))
- return QGeoSatelliteInfo::Undefined;
-
- const QStringList sl = str.mid(4).split(";", Qt::SkipEmptyParts);
-
- if (sl.empty())
- return QGeoSatelliteInfo::Undefined;
-
- for (const auto &str : sl) {
- bool ok = false;
- int value = str.toInt(&ok);
- if (ok) {
- pnrsInUse.push_back(value);
- }
- }
- return QGeoSatelliteInfo::GPS;
-}
-
-QNmeaSatelliteInfoSource::SatelliteInfoParseStatus
-DummyNmeaSatelliteInfoSource::parseSatelliteInfoFromNmea(const char *data, int size,
- QList<QGeoSatelliteInfo> &infos,
- QGeoSatelliteInfo::SatelliteSystem &system)
-{
- // expected format: "INFO:system,identifier;system,identifier;system,identifier\n"
- // example: "INFO:1,5;1,7;1,15\n"
- if (!data || !size)
- return NotParsed;
-
- QString str = QLatin1String(data, size).toString();
- if (!str.startsWith("INFO:"))
- return NotParsed;
-
- QStringList sat_infos = str.mid(5).split(";", Qt::SkipEmptyParts);
-
- if (sat_infos.empty())
- return NotParsed;
-
- for (const auto &sat_info : sat_infos) {
- QStringList parameters = sat_info.split(",", Qt::SkipEmptyParts);
- if (parameters.size() == 2) {
- QGeoSatelliteInfo info;
- info.setSatelliteSystem(
- static_cast<QGeoSatelliteInfo::SatelliteSystem>(parameters[0].toInt()));
- info.setSatelliteIdentifier(parameters[1].toInt());
- infos.push_back(info);
- }
- }
-
- system = infos.isEmpty() ? QGeoSatelliteInfo::Undefined : infos.front().satelliteSystem();
-
- return FullyParsed;
-}
-
-class tst_DummyNmeaSatelliteInfoSource : public QObject
-{
- Q_OBJECT
-
-private slots:
- void testOverloadedParseFunction();
-};
-
-void tst_DummyNmeaSatelliteInfoSource::testOverloadedParseFunction()
-{
- DummyNmeaSatelliteInfoSource source;
- QNmeaProxyFactory factory;
- QScopedPointer<QNmeaSatelliteInfoSourceProxy> proxy(
- factory.createSatelliteInfoSourceProxy(&source));
-
- QSignalSpy inUseSpy(proxy->source(), &QNmeaSatelliteInfoSource::satellitesInUseUpdated);
- QSignalSpy inViewSpy(proxy->source(), &QNmeaSatelliteInfoSource::satellitesInViewUpdated);
-
- proxy->source()->startUpdates();
-
- // first we need to send all satellites
- proxy->feedBytes("INFO:1,5;1,7;1,15\n");
- // then - used ones
- proxy->feedBytes("USE:5;15\n");
-
- QTRY_VERIFY_WITH_TIMEOUT(inUseSpy.count() == 1, 10000);
- QTRY_VERIFY_WITH_TIMEOUT(inViewSpy.count() == 1, 10000);
-
- QGeoSatelliteInfo info_1_5;
- info_1_5.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- info_1_5.setSatelliteIdentifier(5);
-
- QGeoSatelliteInfo info_1_7;
- info_1_7.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- info_1_7.setSatelliteIdentifier(7);
-
- QGeoSatelliteInfo info_1_15;
- info_1_15.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- info_1_15.setSatelliteIdentifier(15);
-
- const QList<QGeoSatelliteInfo> desiredInView = { info_1_5, info_1_7, info_1_15 };
- const QList<QGeoSatelliteInfo> desiredInUse = { info_1_5, info_1_15 };
-
- const QList<QGeoSatelliteInfo> inViewList =
- inViewSpy.at(0).at(0).value<QList<QGeoSatelliteInfo>>();
- const QList<QGeoSatelliteInfo> inUseList =
- inUseSpy.at(0).at(0).value<QList<QGeoSatelliteInfo>>();
-
- QCOMPARE(inViewList, desiredInView);
- QCOMPARE(inUseList, desiredInUse);
-}
-
-#include "tst_dummynmeasatelliteinfosource.moc"
-
-QTEST_GUILESS_MAIN(tst_DummyNmeaSatelliteInfoSource);
diff --git a/tests/auto/qnmeasatelliteinfosource/generic_realtime/CMakeLists.txt b/tests/auto/qnmeasatelliteinfosource/generic_realtime/CMakeLists.txt
deleted file mode 100644
index f465bc17..00000000
--- a/tests/auto/qnmeasatelliteinfosource/generic_realtime/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-# special case begin
-qt_internal_add_test(tst_nmeasatelliteinfosource_generic_rt
- SOURCES
- ../../qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp ../../qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- tst_nmeasatelliteinfosource_generic_rt.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-# special case end
diff --git a/tests/auto/qnmeasatelliteinfosource/generic_realtime/tst_nmeasatelliteinfosource_generic_rt.cpp b/tests/auto/qnmeasatelliteinfosource/generic_realtime/tst_nmeasatelliteinfosource_generic_rt.cpp
deleted file mode 100644
index 807187fe..00000000
--- a/tests/auto/qnmeasatelliteinfosource/generic_realtime/tst_nmeasatelliteinfosource_generic_rt.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QTest>
-#include <QTimer>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-#include "../../qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h"
-#include "../../utils/qnmeaproxyfactory.h"
-#include "../../utils/qlocationtestutils_p.h"
-
-class Feeder : public QObject
-{
- Q_OBJECT
-public:
- Feeder(QObject *parent) : QObject(parent)
- {
- }
-
- void start(QNmeaSatelliteInfoSourceProxy *proxy)
- {
- m_proxy = proxy;
- QTimer *timer = new QTimer(this);
- QObject::connect(timer, &QTimer::timeout, this, &Feeder::timeout);
- timer->setInterval(proxy->source()->minimumUpdateInterval() * 2);
- timer->start();
- }
-
-public slots:
- void timeout()
- {
- // Here we need to provide different chunks of data, because the signals
- // are emitted only when data changes.
- if (has_data) {
- m_proxy->feedBytes(QLocationTestUtils::createGsvLongSentence().toLatin1());
- m_proxy->feedBytes(QLocationTestUtils::createGsaLongSentence().toLatin1());
- } else {
- m_proxy->feedBytes(QLocationTestUtils::createGsvSentence().toLatin1());
- m_proxy->feedBytes(QLocationTestUtils::createGsaSentence().toLatin1());
- }
- has_data = !has_data;
- }
-
-private:
- QNmeaSatelliteInfoSourceProxy *m_proxy;
- bool has_data = true;
-};
-
-class tst_QNmeaSatelliteInfoSource_Generic_Realtime : public TestQGeoSatelliteInfoSource
-{
- Q_OBJECT
-protected:
- QGeoSatelliteInfoSource *createTestSource() override
- {
- QNmeaSatelliteInfoSource *source =
- new QNmeaSatelliteInfoSource(QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode);
- QNmeaSatelliteInfoSourceProxy *proxy = m_factory.createSatelliteInfoSourceProxy(source);
- Feeder *feeder = new Feeder(source);
- feeder->start(proxy);
- return source;
- }
-
-private:
- QNmeaProxyFactory m_factory;
-};
-
-#include "tst_nmeasatelliteinfosource_generic_rt.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaSatelliteInfoSource_Generic_Realtime)
diff --git a/tests/auto/qnmeasatelliteinfosource/generic_simulation/CMakeLists.txt b/tests/auto/qnmeasatelliteinfosource/generic_simulation/CMakeLists.txt
deleted file mode 100644
index d86d5066..00000000
--- a/tests/auto/qnmeasatelliteinfosource/generic_simulation/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-# special case begin
-qt_internal_add_test(tst_nmeasatelliteinfosource_generic_sim
- SOURCES
- ../../qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp ../../qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- tst_nmeasatelliteinfosource_generic_sim.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-# special case end
diff --git a/tests/auto/qnmeasatelliteinfosource/generic_simulation/tst_nmeasatelliteinfosource_generic_sim.cpp b/tests/auto/qnmeasatelliteinfosource/generic_simulation/tst_nmeasatelliteinfosource_generic_sim.cpp
deleted file mode 100644
index 3b80bf05..00000000
--- a/tests/auto/qnmeasatelliteinfosource/generic_simulation/tst_nmeasatelliteinfosource_generic_sim.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QTest>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-#include "../../qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h"
-#include "../../utils/qlocationtestutils_p.h"
-
-class UnlimitedNmeaStream : public QIODevice
-{
- Q_OBJECT
-
-public:
- UnlimitedNmeaStream(QObject *parent) : QIODevice(parent) {}
-
-protected:
- qint64 readData(char *data, qint64 maxSize) override
- {
- if (maxSize == 0)
- return 0;
- QByteArray bytes;
- if (genSatInView) {
- increaseSatId();
- bytes = QLocationTestUtils::createGsvVariableSentence(satId).toLatin1();
- } else {
- bytes = QLocationTestUtils::createGsaVariableSentence(satId).toLatin1();
- }
- genSatInView = !genSatInView;
- qint64 sz = qMin(qint64(bytes.size()), maxSize);
- memcpy(data, bytes.constData(), sz);
- return sz;
- }
-
- qint64 writeData(const char *, qint64) override
- {
- return -1;
- }
-
- qint64 bytesAvailable() const override
- {
- return 1024 + QIODevice::bytesAvailable();
- }
-
-private:
- void increaseSatId()
- {
- if (++satId == 0)
- satId = 1;
- }
-
- quint8 satId = 0;
- bool genSatInView = true;
-};
-
-class tst_QNmeaSatelliteInfoSource_Generic_Simulation : public TestQGeoSatelliteInfoSource
-{
- Q_OBJECT
-protected:
- QGeoSatelliteInfoSource *createTestSource() override
- {
- QNmeaSatelliteInfoSource *source =
- new QNmeaSatelliteInfoSource(QNmeaSatelliteInfoSource::UpdateMode::SimulationMode);
- source->setDevice(new UnlimitedNmeaStream(source));
- return source;
- }
-};
-
-#include "tst_nmeasatelliteinfosource_generic_sim.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaSatelliteInfoSource_Generic_Simulation)
diff --git a/tests/auto/qnmeasatelliteinfosource/nmea/CMakeLists.txt b/tests/auto/qnmeasatelliteinfosource/nmea/CMakeLists.txt
deleted file mode 100644
index 28eafc91..00000000
--- a/tests/auto/qnmeasatelliteinfosource/nmea/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# special case begin
-qt_internal_add_test(tst_nmeasatelliteinfosource
- SOURCES
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- tst_nmeasatelliteinfosource.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-# special case end
diff --git a/tests/auto/qnmeasatelliteinfosource/nmea/tst_nmeasatelliteinfosource.cpp b/tests/auto/qnmeasatelliteinfosource/nmea/tst_nmeasatelliteinfosource.cpp
deleted file mode 100644
index a19b3f6f..00000000
--- a/tests/auto/qnmeasatelliteinfosource/nmea/tst_nmeasatelliteinfosource.cpp
+++ /dev/null
@@ -1,556 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QTest>
-#include <QTimer>
-#include <QSignalSpy>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-#include "../../utils/qlocationtestutils_p.h"
-
-class DataFeeder : public QIODevice
-{
- Q_OBJECT
-public:
- DataFeeder(QNmeaSatelliteInfoSource *parent)
- : QIODevice(parent), m_parentMode(parent->updateMode())
- {
- }
-
- void setMessages(const QList<QByteArray> &messages)
- {
- m_messages = messages;
- m_canReadLine = true;
- m_messageIndex = 0;
- if (m_parentMode == QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode)
- emit readyRead();
- }
-
-signals:
- void messageSent();
-
-protected:
- qint64 readData(char *data, qint64 maxSize) override
- {
- if (maxSize == 0 || m_messageIndex < 0 || m_messageIndex >= m_messages.size())
- return 0;
-
- m_canReadLine = false;
-
- QByteArray bytes = m_messages.at(m_messageIndex);
- qint64 sz = qMin(qint64(bytes.size()), maxSize);
- memcpy(data, bytes.constData(), sz);
-
- m_messageIndex++;
-
- emit messageSent();
- QTimer::singleShot(10, this, &DataFeeder::onTimer);
-
- return sz;
- }
-
- qint64 writeData(const char *, qint64) override { return -1; }
-
- qint64 bytesAvailable() const override { return 1024 + QIODevice::bytesAvailable(); }
-
- bool canReadLine() const override
- {
- return m_canReadLine && (m_messageIndex >= 0) && (m_messageIndex < m_messages.size());
- }
-
-private slots:
- void onTimer()
- {
- m_canReadLine = true;
- if (m_parentMode == QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode)
- emit readyRead();
- }
-
-private:
- QNmeaSatelliteInfoSource::UpdateMode m_parentMode;
- QList<QByteArray> m_messages;
- qsizetype m_messageIndex = 0;
- bool m_canReadLine = true; // To read each line separately
-};
-
-class tst_QNmeaSatelliteInfoSource : public QObject
-{
- Q_OBJECT
-private slots:
- void backendProperty();
- void backendProperty_data();
-
- void parseDataStream();
- void parseDataStream_data();
-
-private:
- QGeoSatelliteInfo createSatelliteInfo(QGeoSatelliteInfo::SatelliteSystem system, int id,
- int snr);
-};
-
-void tst_QNmeaSatelliteInfoSource::backendProperty()
-{
- QFETCH(int, simulationRate);
- QFETCH(int, updateInterval);
- QFETCH(QList<QByteArray>, messages);
- QFETCH(int, timeout);
- QFETCH(int, desiredMessagesSent);
-
- QNmeaSatelliteInfoSource source(QNmeaSatelliteInfoSource::UpdateMode::SimulationMode);
- auto feeder = new DataFeeder(&source);
- source.setDevice(feeder);
-
- QSignalSpy messageSentSpy(feeder, &DataFeeder::messageSent);
- QSignalSpy inViewSpy(&source, &QNmeaSatelliteInfoSource::satellitesInViewUpdated);
-
- source.setBackendProperty(QNmeaSatelliteInfoSource::SimulationUpdateInterval, simulationRate);
- source.setUpdateInterval(updateInterval);
-
- source.startUpdates();
- feeder->setMessages(messages);
-
- QTRY_VERIFY_WITH_TIMEOUT(inViewSpy.count() == 1, timeout);
-
- QCOMPARE(source.backendProperty(QNmeaSatelliteInfoSource::SimulationUpdateInterval).toInt(),
- simulationRate);
- QCOMPARE(source.updateInterval(), updateInterval);
-
- QCOMPARE(messageSentSpy.count(), desiredMessagesSent);
-}
-
-void tst_QNmeaSatelliteInfoSource::backendProperty_data()
-{
- QTest::addColumn<int>("simulationRate");
- QTest::addColumn<int>("updateInterval");
- QTest::addColumn<QList<QByteArray>>("messages");
- QTest::addColumn<int>("timeout");
- QTest::addColumn<int>("desiredMessagesSent");
-
- const auto simpleGpsGsvMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GPGSV,1,1,4,05,,,25,07,,,,08,,,,13,,,36*")
- .toLatin1();
-
- const QList<QByteArray> msgs(10, simpleGpsGsvMessage);
-
- // here updateInterval should not be a multiple of simulationRate because
- // this will make the test flacky due to timer precision.
- QTest::addRow("Simulation rate smaller than updateInterval") << 200 << 500 << msgs << 550 << 2;
-
- QTest::addRow("Simulation rate larger than updateInterval") << 200 << 100 << msgs << 300 << 1;
-
- // Here we do not really have problems with timer precision, because even if
- // the updateInterval() timer expires earlier, we will not get any update
- // until the real data comes.
- QTest::addRow("Simulation rate equals updateInterval") << 200 << 200 << msgs << 300 << 1;
-}
-
-void tst_QNmeaSatelliteInfoSource::parseDataStream()
-{
- QFETCH(QNmeaSatelliteInfoSource::UpdateMode, mode);
- QFETCH(QList<QByteArray>, messages);
- QFETCH(QList<QGeoSatelliteInfo>, desiredInView);
- QFETCH(QList<QGeoSatelliteInfo>, desiredInUse);
-
- QNmeaSatelliteInfoSource source(mode);
- auto feeder = new DataFeeder(&source);
- source.setDevice(feeder);
-
- QSignalSpy messageSentSpy(feeder, &DataFeeder::messageSent);
- QSignalSpy inViewSpy(&source, &QNmeaSatelliteInfoSource::satellitesInViewUpdated);
- QSignalSpy inUseSpy(&source, &QNmeaSatelliteInfoSource::satellitesInUseUpdated);
-
- source.startUpdates();
- feeder->setMessages(messages);
-
- QTRY_VERIFY_WITH_TIMEOUT(messageSentSpy.count() == messages.count(), 2000);
- QVERIFY(!inViewSpy.isEmpty());
- QVERIFY(!inUseSpy.isEmpty());
-
- const auto inView = inViewSpy.back().at(0).value<QList<QGeoSatelliteInfo>>();
- QCOMPARE(inView, desiredInView);
-
- const auto inUse = inUseSpy.back().at(0).value<QList<QGeoSatelliteInfo>>();
- QCOMPARE(inUse, desiredInUse);
-}
-
-void tst_QNmeaSatelliteInfoSource::parseDataStream_data()
-{
- QTest::addColumn<QNmeaSatelliteInfoSource::UpdateMode>("mode");
- QTest::addColumn<QList<QByteArray>>("messages");
- QTest::addColumn<QList<QGeoSatelliteInfo>>("desiredInView");
- QTest::addColumn<QList<QGeoSatelliteInfo>>("desiredInUse");
-
- // We will use only satId and SNR, to simplify objects for comparison
-
- // one line GPS
- const auto simpleGpsGsvMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GPGSV,1,1,4,05,,,25,07,,,,08,,,,13,,,36*")
- .toLatin1();
- const auto simpleGpsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GPGSA,A,3,05,13,,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
-
- const auto simpleGpsInView =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GPS, 5, 25),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 7, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 8, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 13, 36) };
- const auto simpleGpsInUse =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GPS, 5, 25),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 13, 36) };
-
- QTest::newRow("realtime GPS") << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGpsGsaMessage }
- << simpleGpsInView << simpleGpsInUse;
-
- QTest::newRow("simulation GPS")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGpsGsaMessage } << simpleGpsInView
- << simpleGpsInUse;
-
- // multi line GPS
- const auto complexGpsGsvMessage1 = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GPGSV,2,1,8,05,,,22,07,,,,08,,,,13,,,18*")
- .toLatin1();
- const auto complexGpsGsvMessage2 =
- QLocationTestUtils::addNmeaChecksumAndBreaks("$GPGSV,2,2,8,14,,,,15,,,18,18,,,,20,,,*")
- .toLatin1();
- const auto complexGpsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GPGSA,A,3,05,13,15,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
-
- const auto complexGpsInView =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GPS, 5, 22),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 7, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 8, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 13, 18),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 14, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 15, 18),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 18, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 20, -1) };
- const auto complexGpsInUse =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GPS, 5, 22),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 13, 18),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 15, 18) };
-
- QTest::newRow("realtime multi-line GPS")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGpsGsaMessage }
- << complexGpsInView << complexGpsInUse;
-
- QTest::newRow("simulation multi-line GPS")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGpsGsaMessage }
- << complexGpsInView << complexGpsInUse;
-
- // one line GPS & GLONASS
- const auto simpleGlnsGsvMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GLGSV,1,1,4,65,,,,66,,,,71,,,20,72,,,28*")
- .toLatin1();
- const auto gnSimpleGlnsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,3,71,72,,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
- const auto gnSimpleGpsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,3,05,13,,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
-
- const auto simpleGlnsInView =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 65, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 66, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 71, 20),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 72, 28) };
- const auto simpleGlnsInUse =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 71, 20),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 72, 28) };
-
- const auto simpleGpsGlnsInView = simpleGpsInView + simpleGlnsInView;
- const auto simpleGpsGlnsInUse = simpleGpsInUse + simpleGlnsInUse;
-
- QTest::newRow("realtime GPS & GLONASS")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage, gnSimpleGpsGsaMessage,
- gnSimpleGlnsGsaMessage }
- << simpleGpsGlnsInView << simpleGpsGlnsInUse;
-
- QTest::newRow("simulation GPS & GLONASS")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage, gnSimpleGpsGsaMessage,
- gnSimpleGlnsGsaMessage }
- << simpleGpsGlnsInView << simpleGpsGlnsInUse;
-
- // multi line GPS & GLONASS
- const auto complexGlnsGsvMessage1 = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GLGSV,3,1,10,65,,,,66,,,,71,,,20,72,,,28*")
- .toLatin1();
- const auto complexGlnsGsvMessage2 =
- QLocationTestUtils::addNmeaChecksumAndBreaks("$GLGSV,3,2,10,73,,,,74,,,,75,,,33,81,,,*")
- .toLatin1();
- const auto complexGlnsGsvMessage3 =
- QLocationTestUtils::addNmeaChecksumAndBreaks("$GLGSV,3,3,10,82,,,,83,,,*").toLatin1();
- const auto gnComplexGlnsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,3,71,72,75,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
- const auto gnComplexGpsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,3,05,13,15,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
-
- const auto complexGlnsInView =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 65, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 66, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 71, 20),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 72, 28),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 73, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 74, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 75, 33),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 81, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 82, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 83, -1) };
- const auto complexGlnsInUse =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 71, 20),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 72, 28),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 75, 33) };
-
- const auto complexGpsGlnsInView = complexGpsInView + complexGlnsInView;
- const auto complexGpsGlnsInUse = complexGpsInUse + complexGlnsInUse;
-
- QTest::newRow("realtime multi-line GPS & GLONASS")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, gnComplexGpsGsaMessage,
- gnComplexGlnsGsaMessage }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- QTest::newRow("simulation multi-line GPS & GLONASS")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, gnComplexGpsGsaMessage,
- gnComplexGlnsGsaMessage }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- // multi-line GPS & GLONASS: GSA before GSV
- QTest::newRow("realtime multi-line GPS & GLONASS reverse")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { gnComplexGlnsGsaMessage, gnComplexGpsGsaMessage,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, complexGpsGsvMessage1,
- complexGpsGsvMessage2 }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- QTest::newRow("simulation multi-line GPS & GLONASS reverse")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { gnComplexGlnsGsaMessage, gnComplexGpsGsaMessage,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, complexGpsGsvMessage1,
- complexGpsGsvMessage2 }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- // multi-line GSP & GLONASS: mixed order
- QTest::newRow("realtime multi-line GPS & GLONASS mixed")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { gnComplexGlnsGsaMessage, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexGpsGsvMessage1, complexGpsGsvMessage2,
- gnComplexGpsGsaMessage }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- QTest::newRow("realtime multi-line GPS & GLONASS mixed")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { gnComplexGlnsGsaMessage, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexGpsGsvMessage1, complexGpsGsvMessage2,
- gnComplexGpsGsaMessage }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- // one line GPS & GLONASS: empty GNGSA for GPS
- const auto gnEmptyGpsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*")
- .toLatin1();
-
- QTest::newRow("realtime GSP & GLONASS: empty GSA for GPS")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage,
- gnSimpleGlnsGsaMessage, gnEmptyGpsGsaMessage }
- << simpleGpsGlnsInView << simpleGlnsInUse;
-
- QTest::newRow("simulation GSP & GLONASS: empty GSA for GPS")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage,
- gnSimpleGlnsGsaMessage, gnEmptyGpsGsaMessage }
- << simpleGpsGlnsInView << simpleGlnsInUse;
-
- // one line GPS & GLONASS: empty $GPGSV
- const auto emptyGpsGsvMessage =
- QLocationTestUtils::addNmeaChecksumAndBreaks("$GPGSV,1,1,0,,,,,,,,,,,,,,,,*")
- .toLatin1();
-
- QTest::newRow("realtime GPS & GLONASS: empty $GPGSV")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { emptyGpsGsvMessage, simpleGlnsGsvMessage, gnSimpleGlnsGsaMessage,
- gnSimpleGpsGsaMessage }
- << simpleGlnsInView << simpleGlnsInUse;
-
- QTest::newRow("simulation GPS & GLONASS: empty $GPGSV")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { emptyGpsGsvMessage, simpleGlnsGsvMessage, gnSimpleGlnsGsaMessage,
- gnSimpleGpsGsaMessage }
- << simpleGlnsInView << simpleGlnsInUse;
-
- // one line GPS & GLONASS: empty GNGSA in the middle
- // In this test we send the following sequence:
- // 1. $GPGSV - valid GPS in view
- // 2. $GLGSV - valid GLONASS in view
- // 3. $GNGSA - valid GPS in use
- // 4. $GNGSA - valid GLONASS in use
- // 5. $GPGSV - valid GPS in view
- // 6. $GNGSA - empty GNGSA (meaning empty GPS)
- // 7. $GPGSV - valid GPS in view: at this point GPS in use will be cleared
- // As a result, we will see valid GPS & GLONASS in view, but only GLONASS
- // in use.
-
- QTest::newRow("realtime GPS & GLONASS: empty $GNGSA in the middle")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage,
- gnSimpleGpsGsaMessage, gnSimpleGlnsGsaMessage,
- simpleGpsGsvMessage, gnEmptyGpsGsaMessage,
- simpleGpsGsvMessage }
- << simpleGpsGlnsInView << simpleGlnsInUse;
-
- QTest::newRow("simulation GPS & GLONASS: empty $GNGSA in the middle")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage,
- gnSimpleGpsGsaMessage, gnSimpleGlnsGsaMessage,
- simpleGpsGsvMessage, gnEmptyGpsGsaMessage,
- simpleGpsGsvMessage }
- << simpleGpsGlnsInView << simpleGlnsInUse;
-
- // BEIDOU signals for below test cases are just synthesized based on the
- // NMEA protocol description. They were NEVER checked on real hardware,
- // as we do not have one.
-
- // multi-line GPS, GLONASS & BEIDOU
- const auto complexBduGsvMessage1 = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GBGSV,2,1,7,201,,,,202,,,,203,,,20,204,,,28*")
- .toLatin1();
- const auto complexBduGsvMessage2 =
- QLocationTestUtils::addNmeaChecksumAndBreaks("$GBGSV,2,2,7,205,,,,206,,,,207,,,33,,,,*")
- .toLatin1();
- const auto gnComplexBduGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,3,203,204,207,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
- const auto complexBduInView =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 201, -1),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 202, -1),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 203, 20),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 204, 28),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 205, -1),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 206, -1),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 207, 33) };
- const auto complexBduInUse =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 203, 20),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 204, 28),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 207, 33) };
-
- const auto complexGpsGlnsBduInView = complexGpsInView + complexGlnsInView + complexBduInView;
- const auto complexGpsGlnsBduInUse = complexGpsInUse + complexGlnsInUse + complexBduInUse;
-
- QTest::newRow("realtime GPS, GLONASS & BEIDOU")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, complexBduGsvMessage1,
- complexBduGsvMessage2, gnComplexGpsGsaMessage,
- gnComplexGlnsGsaMessage, gnComplexBduGsaMessage }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-
- QTest::newRow("simulation GPS, GLONASS & BEIDOU")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, complexBduGsvMessage1,
- complexBduGsvMessage2, gnComplexGpsGsaMessage,
- gnComplexGlnsGsaMessage, gnComplexBduGsaMessage }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-
- // multi-line GPS, GLONASS & BEIDOU: GSA before GSV
- QTest::newRow("realtime GPS, GLONASS & BEIDOU reverse")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { gnComplexGpsGsaMessage, gnComplexGlnsGsaMessage,
- gnComplexBduGsaMessage, complexGpsGsvMessage1,
- complexGpsGsvMessage2, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexBduGsvMessage1, complexBduGsvMessage2 }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-
- QTest::newRow("simulation GPS, GLONASS & BEIDOU reverse")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { gnComplexGpsGsaMessage, gnComplexGlnsGsaMessage,
- gnComplexBduGsaMessage, complexGpsGsvMessage1,
- complexGpsGsvMessage2, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexBduGsvMessage1, complexBduGsvMessage2 }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-
- // multi-line GPS, GLONASS & BEIDOU: mixed order
- QTest::newRow("realtime GPS, GLONASS & BEIDOU mixed")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { gnComplexGpsGsaMessage, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexBduGsvMessage1, complexBduGsvMessage2,
- gnComplexGlnsGsaMessage, gnComplexBduGsaMessage,
- complexGpsGsvMessage1, complexGpsGsvMessage2 }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-
- QTest::newRow("simulation GPS, GLONASS & BEIDOU mixed")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { gnComplexGpsGsaMessage, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexBduGsvMessage1, complexBduGsvMessage2,
- gnComplexGlnsGsaMessage, gnComplexBduGsaMessage,
- complexGpsGsvMessage1, complexGpsGsvMessage2 }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-}
-
-QGeoSatelliteInfo
-tst_QNmeaSatelliteInfoSource::createSatelliteInfo(QGeoSatelliteInfo::SatelliteSystem system, int id,
- int snr)
-{
- QGeoSatelliteInfo info;
- info.setSatelliteSystem(system);
- info.setSatelliteIdentifier(id);
- info.setSignalStrength(snr);
- info.setAttribute(QGeoSatelliteInfo::Azimuth, 0.0);
- info.setAttribute(QGeoSatelliteInfo::Elevation, 0.0);
- return info;
-}
-
-#include "tst_nmeasatelliteinfosource.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaSatelliteInfoSource)
diff --git a/tests/auto/qquickgeocoordinateanimation/CMakeLists.txt b/tests/auto/qquickgeocoordinateanimation/CMakeLists.txt
deleted file mode 100644
index 81342b61..00000000
--- a/tests/auto/qquickgeocoordinateanimation/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-qt_internal_add_test(tst_qquickgeocoordinateanimation
- SOURCES
- tst_qquickgeocoordinateanimation.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::PositioningQuickPrivate
- Qt::TestPrivate
-)
diff --git a/tests/auto/qquickgeocoordinateanimation/tst_qquickgeocoordinateanimation.cpp b/tests/auto/qquickgeocoordinateanimation/tst_qquickgeocoordinateanimation.cpp
deleted file mode 100644
index 6c6abbcc..00000000
--- a/tests/auto/qquickgeocoordinateanimation/tst_qquickgeocoordinateanimation.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QtPositioningQuick/private/qquickgeocoordinateanimation_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_QuickGeoCoordinateAnimation : public QObject
-{
- Q_OBJECT
-
-private slots:
- void bindings();
-};
-
-void tst_QuickGeoCoordinateAnimation::bindings()
-{
- QQuickGeoCoordinateAnimation animation;
- QTestPrivate::testReadWritePropertyBasics<QQuickGeoCoordinateAnimation,
- QQuickGeoCoordinateAnimation::Direction>(
- animation, QQuickGeoCoordinateAnimation::East, QQuickGeoCoordinateAnimation::West,
- "direction");
-}
-
-QTEST_APPLESS_MAIN(tst_QuickGeoCoordinateAnimation)
-
-#include "tst_qquickgeocoordinateanimation.moc"
diff --git a/tests/auto/utils/qlocationtestutils.cpp b/tests/auto/utils/qlocationtestutils.cpp
deleted file mode 100644
index c587a8bc..00000000
--- a/tests/auto/utils/qlocationtestutils.cpp
+++ /dev/null
@@ -1,114 +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 "qlocationtestutils_p.h"
-
-bool QLocationTestUtils::hasDefaultSource()
-{
- return false;
-}
-
-bool QLocationTestUtils::hasDefaultMonitor()
-{
- return false;
-}
-
-QString QLocationTestUtils::addNmeaChecksumAndBreaks(const QString &sentence)
-{
- Q_ASSERT(sentence[0] == '$' && sentence[sentence.length()-1] == '*');
-
- // XOR byte value of all characters between '$' and '*'
- int result = 0;
- for (int i=1; i<sentence.length()-1; i++)
- result ^= sentence[i].toLatin1();
- const QString sum = QString::asprintf("%02x", result);
- return sentence + sum + "\r\n";
-}
-
-QString QLocationTestUtils::createRmcSentence(const QDateTime &dt)
-{
- QString time = dt.toString("hhmmss.zzz");
- QString date = dt.toString("ddMMyy");
- QString nmea = QString("$GPRMC,%1,A,2730.83609,S,15301.87844,E,0.7,9.0,%2,11.2,W,A*")
- .arg(time).arg(date);
- return addNmeaChecksumAndBreaks(nmea);
-}
-
-QString QLocationTestUtils::createGgaSentence(const QTime &time)
-{
- QString nmea = QString("$GPGGA,%1,2734.76859,S,15305.99361,E,1,04,3.5,49.4,M,39.2,M,,*")
- .arg(time.toString("hhmmss.zzz"));
- return addNmeaChecksumAndBreaks(nmea);
-}
-
-QString QLocationTestUtils::createGgaSentence(int lat, int lng, const QTime &time) {
- QString nmea = QString("$GPGGA,%1,%200.00000,S,%300.,E,1,04,3.5,49.4,M,39.2,M,,*")
- .arg(time.toString("hhmmss.zzz")).arg(lat).arg(lng);
- return addNmeaChecksumAndBreaks(nmea);
-}
-
-QString QLocationTestUtils::createZdaSentence(const QDateTime &dt)
-{
- QString time = dt.toString("hhmmss.zzz");
- QString nmea = QString("$GPZDA,%1,%2,%3,%4,,*")
- .arg(time).arg(dt.toString("dd")).arg(dt.toString("MM")).arg(dt.toString("yyyy"));
- return addNmeaChecksumAndBreaks(nmea);
-}
-
-QString QLocationTestUtils::createGsaSentence()
-{
- return addNmeaChecksumAndBreaks(QStringLiteral("$GPGSA,A,3,,,,,,,,,,,,,3.0,3.5,4.0*"));
-}
-
-QString QLocationTestUtils::createGsvSentence()
-{
- return addNmeaChecksumAndBreaks(QStringLiteral("$GPGSV,1,1,0,,,,,,,,,,,,,,,,*"));
-}
-
-QString QLocationTestUtils::createGsaLongSentence()
-{
- return addNmeaChecksumAndBreaks(QStringLiteral("$GPGSA,A,3,16,25,,,,,,,,,,,2.3,1.3,1.9*"));
-}
-
-QString QLocationTestUtils::createGsvLongSentence()
-{
- return addNmeaChecksumAndBreaks(
- QStringLiteral("$GPGSV,1,1,4,16,49,115,42,25,39,269,36,23,58,176,29,20,72,335,35*"));
-}
-
-QString QLocationTestUtils::createGsaVariableSentence(quint8 satId)
-{
- const QString nmea = QString("$GPGSA,A,3,%1,,,,,,,,,,,,2.3,1.3,1.9*").arg(static_cast<int>(satId));
- return addNmeaChecksumAndBreaks(nmea);
-}
-
-QString QLocationTestUtils::createGsvVariableSentence(quint8 satId)
-{
- const QString nmea = QString("$GPGSV,1,1,1,%1,49,115,42,,,,,,,,,,,,*").arg(static_cast<int>(satId));
- return addNmeaChecksumAndBreaks(nmea);
-}
diff --git a/tests/auto/utils/qlocationtestutils_p.h b/tests/auto/utils/qlocationtestutils_p.h
deleted file mode 100644
index 77c3a394..00000000
--- a/tests/auto/utils/qlocationtestutils_p.h
+++ /dev/null
@@ -1,175 +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$
-**
-****************************************************************************/
-
-#ifndef QLOCATIONTESTUTILS_P_H
-#define QLOCATIONTESTUTILS_P_H
-
-#include <QDebug>
-#include <QString>
-#include <QTest>
-
-namespace QLocationTestUtils
-{
- bool hasDefaultSource();
- bool hasDefaultMonitor();
-
- QString addNmeaChecksumAndBreaks(const QString &sentence);
-
- QString createRmcSentence(const QDateTime &dt);
- QString createGgaSentence(const QTime &time);
- QString createGgaSentence(int lat, int lng, const QTime &time);
- QString createZdaSentence(const QDateTime &dt);
- QString createGsaSentence();
- QString createGsvSentence();
- QString createGsaLongSentence();
- QString createGsvLongSentence();
- QString createGsaVariableSentence(quint8 satId);
- QString createGsvVariableSentence(quint8 satId);
-
- //The purpose of compareEquality() is to test equality
- //operators where it is expected that A == B.
- template<typename A, typename B>
- bool compareEquality(const A &first, const B &second) {
- if (first != second) {
- qWarning() << "compareEquality() failed: first != second";
- return false;
- }
-
- if (second != first) {
- qWarning() << "compareEquality() failed: second != first";
- return false;
- }
-
- if (!(first == second)) {
- qWarning() << "compareEquality() failed: !(first == second)";
- return false;
- }
-
- if (!(second == first)) {
- qWarning() << "compareEquality() failed: !(second == first)";
- return false;
- }
-
- return true;
- }
-
- //The purpose of compareInequality() is to test equality
- //operators where it is expected that A != B.
- //Using !compareEquality(...) is not sufficient because
- //only the first operator checked would end up being tested.
- template<typename A, typename B>
- bool compareInequality(const A &first, const B &second) {
- if (!(first != second)){
- qWarning() << "compareInequality() failed: !(first != second)";
- return false;
- }
-
- if (!(second != first)) {
- qWarning() << "compareInequality() failed: !(second != first)";
- return false;
- }
-
- if (first == second) {
- qWarning() << "compareInequality() failed: first == second)";
- return false;
- }
-
- if (second == first) {
- qWarning() << "compareInequality() failed: second == first";
- return false;
- }
- return true;
- }
-
- // Tests conversions between sub and base classes
- // TC (test case) must implement:
- // SubClass initialSubObject();
- // bool checkType(const BaseClass &)
- // void detach(BaseClass *) - calls a mutator method, but doesn't actually modify the
- // property to something different.
- // void setSubClassProperty(SubClass *) - sets a property in the subclass instance
- template<typename TC, typename BaseClass, typename SubClass>
- void testConversion(TC *tc) {
- SubClass sub = tc->initialSubObject();
- //check conversion from SubClass -> BaseClass
- //using assignment operator
- BaseClass base;
- base = sub;
- QVERIFY(QLocationTestUtils::compareEquality(base, sub));
- QVERIFY(tc->checkType(base));
-
- //check comparing base classes
- BaseClass base2;
- base2 = sub;
- QVERIFY(QLocationTestUtils::compareEquality(base, base2));
-
- //check conversion from BaseClass -> SubClass
- //using assignment operator
- SubClass sub2;
- sub2 = base;
- QVERIFY(QLocationTestUtils::compareEquality(sub, sub2));
- QVERIFY(tc->checkType(sub2));
-
- //check that equality still holds with detachment of underlying data pointer
- tc->detach(&base);
- sub2 = base;
- QVERIFY(QLocationTestUtils::compareEquality(sub, sub2));
- QVERIFY(QLocationTestUtils::compareEquality(sub, base));
- QVERIFY(QLocationTestUtils::compareEquality(base, base2));
-
- //check that comparing objects are not the same
- //when an underlying subclass field has been modified
- tc->setSubClassProperty(&sub2);
- base2 = sub2;
- QVERIFY(QLocationTestUtils::compareInequality(sub, sub2));
- QVERIFY(QLocationTestUtils::compareInequality(sub, base2));
- QVERIFY(QLocationTestUtils::compareInequality(base, base2));
-
- //check conversion from SubClass -> BaseClass
- //using copy constructor
- BaseClass base3(sub);
- QVERIFY(QLocationTestUtils::compareEquality(sub, base3));
- QVERIFY(QLocationTestUtils::compareEquality(base, base3));
-
- //check conversion from BaseClass -> SubClass
- //using copy constructor
- SubClass sub3(base3);
- QVERIFY(QLocationTestUtils::compareEquality(sub, sub3));
-
- //check conversion to subclass using a default base class instance
- BaseClass baseDefault;
- SubClass subDefault;
- SubClass sub4(baseDefault);
- QVERIFY(QLocationTestUtils::compareEquality(sub4, subDefault));
-
- SubClass sub5 = baseDefault;
- QVERIFY(QLocationTestUtils::compareEquality(sub5, subDefault));
- }
-};
-
-#endif
diff --git a/tests/auto/utils/qnmeaproxyfactory.cpp b/tests/auto/utils/qnmeaproxyfactory.cpp
deleted file mode 100644
index 8ad07adf..00000000
--- a/tests/auto/utils/qnmeaproxyfactory.cpp
+++ /dev/null
@@ -1,130 +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 "qnmeaproxyfactory.h"
-#include "qlocationtestutils_p.h"
-#include <QtPositioning/QNmeaPositionInfoSource>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-
-#include <QIODevice>
-#include <QTcpServer>
-#include <QTcpSocket>
-
-QNmeaPositionInfoSourceProxy::QNmeaPositionInfoSourceProxy(QNmeaPositionInfoSource *source,
- QIODevice *outDevice)
- : m_source(source), m_outDevice(outDevice)
-{
-}
-
-QNmeaPositionInfoSourceProxy::~QNmeaPositionInfoSourceProxy()
-{
- m_outDevice->close();
- delete m_outDevice;
-}
-
-QGeoPositionInfoSource *QNmeaPositionInfoSourceProxy::source() const
-{
- return m_source;
-}
-
-void QNmeaPositionInfoSourceProxy::feedUpdate(const QDateTime &dt)
-{
- m_outDevice->write(QLocationTestUtils::createRmcSentence(dt).toLatin1());
-}
-
-void QNmeaPositionInfoSourceProxy::feedBytes(const QByteArray &bytes)
-{
- m_outDevice->write(bytes);
-}
-
-QNmeaProxyFactory::QNmeaProxyFactory() : m_server(new QTcpServer(this))
-{
- bool b = m_server->listen(QHostAddress::LocalHost);
- Q_ASSERT(b);
-}
-
-QNmeaPositionInfoSourceProxy *
-QNmeaProxyFactory::createPositionInfoSourceProxy(QNmeaPositionInfoSource *source)
-{
- QTcpSocket *client = new QTcpSocket;
- QIODevice *device = createServerConnection(client);
- source->setDevice(device);
- Q_ASSERT(source->device() != 0);
- QNmeaPositionInfoSourceProxy *proxy = new QNmeaPositionInfoSourceProxy(source, client);
- proxy->setParent(source);
- return proxy;
-}
-
-QNmeaSatelliteInfoSourceProxy *
-QNmeaProxyFactory::createSatelliteInfoSourceProxy(QNmeaSatelliteInfoSource *source)
-{
- QTcpSocket *client = new QTcpSocket;
- QIODevice *device = createServerConnection(client);
- source->setDevice(device);
- Q_ASSERT(source->device() != 0);
- QNmeaSatelliteInfoSourceProxy *proxy = new QNmeaSatelliteInfoSourceProxy(source, client);
- proxy->setParent(source);
- return proxy;
-}
-
-QIODevice *QNmeaProxyFactory::createServerConnection(QTcpSocket *client)
-{
- client->connectToHost(m_server->serverAddress(), m_server->serverPort());
- qDebug() << "listening on" << m_server->serverAddress() << m_server->serverPort();
- bool b = m_server->waitForNewConnection(15000);
- if (!b)
- qWarning() << "Server didin't receive new connection";
- b = client->waitForConnected();
- if (!b)
- qWarning() << "Client could not connect to server";
-
- QIODevice *device = m_server->nextPendingConnection();
- return device;
-}
-
-QNmeaSatelliteInfoSourceProxy::QNmeaSatelliteInfoSourceProxy(QNmeaSatelliteInfoSource *source,
- QIODevice *outDevice)
- : m_source(source), m_outDevice(outDevice)
-{
-}
-
-QNmeaSatelliteInfoSourceProxy::~QNmeaSatelliteInfoSourceProxy()
-{
- m_outDevice->close();
- delete m_outDevice;
-}
-
-QGeoSatelliteInfoSource *QNmeaSatelliteInfoSourceProxy::source() const
-{
- return m_source;
-}
-
-void QNmeaSatelliteInfoSourceProxy::feedBytes(const QByteArray &bytes)
-{
- m_outDevice->write(bytes);
-}
diff --git a/tests/auto/utils/qnmeaproxyfactory.h b/tests/auto/utils/qnmeaproxyfactory.h
deleted file mode 100644
index 2cd2e262..00000000
--- a/tests/auto/utils/qnmeaproxyfactory.h
+++ /dev/null
@@ -1,96 +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$
-**
-****************************************************************************/
-
-#ifndef QNMEAPROXYFACTORY_H
-#define QNMEAPROXYFACTORY_H
-
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-class QTcpServer;
-class QTcpSocket;
-class QIODevice;
-class QNmeaPositionInfoSource;
-class QNmeaSatelliteInfoSource;
-class QGeoPositionInfoSource;
-class QGeoSatelliteInfoSource;
-QT_END_NAMESPACE
-
-class QNmeaPositionInfoSourceProxy : public QObject
-{
- Q_OBJECT
-public:
- QNmeaPositionInfoSourceProxy(QNmeaPositionInfoSource *source, QIODevice *outDevice);
- ~QNmeaPositionInfoSourceProxy();
-
- QGeoPositionInfoSource *source() const;
-
- void feedUpdate(const QDateTime &dt);
-
- void feedBytes(const QByteArray &bytes);
-
- int updateIntervalErrorMargin() const { return 50; }
-
-private:
- QNmeaPositionInfoSource *m_source;
- QIODevice *m_outDevice;
-};
-
-class QNmeaSatelliteInfoSourceProxy : public QObject
-{
- Q_OBJECT
-public:
- QNmeaSatelliteInfoSourceProxy(QNmeaSatelliteInfoSource *source, QIODevice *outDevice);
- ~QNmeaSatelliteInfoSourceProxy();
-
- QGeoSatelliteInfoSource *source() const;
-
- void feedBytes(const QByteArray &bytes);
-
-private:
- QNmeaSatelliteInfoSource *m_source;
- QIODevice *m_outDevice;
-};
-
-class QNmeaProxyFactory : public QObject
-{
- Q_OBJECT
-public:
- QNmeaProxyFactory();
-
- // proxy is created as child of source
- QNmeaPositionInfoSourceProxy *createPositionInfoSourceProxy(QNmeaPositionInfoSource *source);
- QNmeaSatelliteInfoSourceProxy *createSatelliteInfoSourceProxy(QNmeaSatelliteInfoSource *source);
-
-private:
- QIODevice *createServerConnection(QTcpSocket *client);
-
- QTcpServer *m_server;
-};
-
-#endif
diff --git a/tests/benchmarks/CMakeLists.txt b/tests/benchmarks/CMakeLists.txt
deleted file mode 100644
index 941ba9da..00000000
--- a/tests/benchmarks/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# special case begin
-
-add_subdirectory(qgeoareamonitorinfo)
-add_subdirectory(qgeopositioninfo)
-add_subdirectory(qgeosatelliteinfo)
-
-# special case end
diff --git a/tests/benchmarks/README b/tests/benchmarks/README
deleted file mode 100644
index 8d017cd9..00000000
--- a/tests/benchmarks/README
+++ /dev/null
@@ -1,81 +0,0 @@
-The most reliable way of running benchmarks is to do it in an otherwise idle
-system. On a busy system, the results will vary according to the other tasks
-demanding attention in the system.
-
-We have managed to obtain quite reliable results by doing the following on
-Linux (and you need root):
-
- - switching the scheduler to a Real-Time mode
- - setting the processor affinity to one single processor
- - disabling the other thread of the same core
-
-This should work rather well for CPU-intensive tasks. A task that is in Real-
-Time mode will simply not be preempted by the OS. But if you make OS syscalls,
-especially I/O ones, your task will be de-scheduled. Note that this includes
-page faults, so if you can, make sure your benchmark's warmup code paths touch
-most of the data.
-
-To do this you need a tool called schedtool (package schedtool), from
-http://freequaos.host.sk/schedtool/
-
-From this point on, we are using CPU0 for all tasks:
-
-If you have a Hyperthreaded multi-core processor (Core-i5 and Core-i7), you
-have to disable the other thread of the same core as CPU0. To discover which
-one it is:
-
-$ cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list
-
-This will print something like 0,4, meaning that CPUs 0 and 4 are sibling
-threads on the same core. So we'll turn CPU 4 off:
-
-(as root)
-# echo 0 > /sys/devices/system/cpu/cpu4/online
-
-To turn it back on, echo 1 into the same file.
-
-To run a task on CPU 0 exclusively, using FIFO RT priority 10, you run the
-following:
-
-(as root)
-# schedtool -F -p 10 -a 1 -e ./taskname
-
-For example:
-# schedtool -F -p 10 -a 1 -e ./tst_bench_qstring -tickcounter
-
-Warning: if your task livelocks or takes far too long to complete, your system
-may be unusable for a long time, especially if you don't have other cores to
-run stuff on. To prevent that, run it before schedtool and time it.
-
-You can also limit the CPU time that the task is allowed to take. Run in the
-same shell as you'll run schedtool:
-
-$ ulimit -s 300
-To limit to 300 seconds (5 minutes)
-
-If your task runs away, it will get a SIGXCPU after consuming 5 minutes of CPU
-time (5 minutes running at 100%).
-
-If your app is multithreaded, you may want to give it more CPUs, like CPU0 and
-CPU1 with -a 3 (it's a bitmask).
-
-For best results, you should disable ALL other cores and threads of the same
-processor. The new Core-i7 have one processor with 4 cores,
-each core can run 2 threads; the older Mac Pros have two processors with 4
-cores each. So on those Mac Pros, you'd disable cores 1, 2 and 3, while on the
-Core-i7, you'll need to disable all other CPUs.
-
-However, disabling just the sibling thread seems to produce very reliable
-results for me already, with variance often below 0.5% (even though there are
-some measurable spikes).
-
-Other things to try:
-
-Running the benchmark with highest priority, i.e. "sudo nice -19"
-usually produces stable results on some machines. If the benchmark also
-involves displaying something on the screen (on X11), running it with
-"-sync" is a must. Though, in that case the "real" cost is not correct,
-but it is useful to discover regressions.
-
-Also; not many people know about ionice (1)
- ionice - get/set program io scheduling class and priority
diff --git a/tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt b/tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt
deleted file mode 100644
index f384baaf..00000000
--- a/tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# special case begin
-
-qt_internal_add_benchmark(tst_bench_qgeoareamonitorinfo
- SOURCES
- tst_bench_qgeoareamonitorinfo.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::Test
-)
-
-# special case end
diff --git a/tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp b/tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp
deleted file mode 100644
index 0e332ea7..00000000
--- a/tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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/QGeoAreaMonitorInfo>
-#include <QtPositioning/QGeoCircle>
-#include <QTest>
-
-static const QDateTime expirationTime = QDateTime::currentDateTimeUtc().addSecs(60);
-static const QGeoCircle area = QGeoCircle(QGeoCoordinate(1.0, 1.0), 100);
-
-class tst_QGeoAreaMonitorInfoBenchmark : public QObject
-{
- Q_OBJECT
-private slots:
- void construct();
- void constructCopy();
- void constructMove();
-
- void assign();
- void assignMove();
-
- void checkEquality();
-
- void setName();
- void queryName();
-
- void queryIdentifier();
- void isValid();
-
- void setArea();
- void queryArea();
-
- void setExpiration();
- void queryExpiration();
-
- void setPersistent();
- void queryPersistent();
-
- void setNotificationParameters();
- void queryNotificationParameters();
-};
-
-
-
-void tst_QGeoAreaMonitorInfoBenchmark::construct()
-{
- QBENCHMARK {
- QGeoAreaMonitorInfo info("test");
- Q_UNUSED(info)
- }
-}
-
-static QGeoAreaMonitorInfo createAreaMonitorInfo()
-{
- QGeoAreaMonitorInfo info("test");
- info.setExpiration(expirationTime);
- info.setArea(area);
- QVariantMap parameters;
- parameters["key"] = "value";
- parameters["another_key"] = true;
- info.setNotificationParameters(parameters);
- return info;
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::constructCopy()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- QGeoAreaMonitorInfo newInfo(info);
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::constructMove()
-{
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of construct()
- // benchmark.
- QGeoAreaMonitorInfo info("test");
- QGeoAreaMonitorInfo newInfo(std::move(info));
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::assign()
-{
- const auto info = createAreaMonitorInfo();
- QGeoAreaMonitorInfo newInfo;
- QBENCHMARK {
- newInfo = info;
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::assignMove()
-{
- QGeoAreaMonitorInfo newInfo;
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of construct()
- // benchmark.
- QGeoAreaMonitorInfo info("test");
- newInfo = std::move(info);
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::checkEquality()
-{
- const auto info1 = createAreaMonitorInfo();
- const auto info2 = createAreaMonitorInfo();
- QBENCHMARK {
- const bool equal = info1 == info2;
- Q_UNUSED(equal)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::setName()
-{
- auto info = createAreaMonitorInfo();
- // Setting the name twice, as there is a check for same name.
- // Ideally need to divide the result of the benchmark by 2.
- QBENCHMARK {
- info.setName("name1");
- info.setName("name2");
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryName()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.name();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryIdentifier()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.identifier();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::isValid()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.isValid();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::setArea()
-{
- auto info = createAreaMonitorInfo();
- QBENCHMARK {
- info.setArea(area);
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryArea()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.area();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::setExpiration()
-{
- auto info = createAreaMonitorInfo();
- QBENCHMARK {
- info.setExpiration(expirationTime);
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryExpiration()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.expiration();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::setPersistent()
-{
- auto info = createAreaMonitorInfo();
- QBENCHMARK {
- info.setPersistent(true);
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryPersistent()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.isPersistent();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::setNotificationParameters()
-{
- auto info = createAreaMonitorInfo();
- QVariantMap newParameters;
- newParameters["key"] = "value1";
- newParameters["another_key"] = false;
- QBENCHMARK {
- info.setNotificationParameters(newParameters);
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryNotificationParameters()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.notificationParameters();
- Q_UNUSED(val)
- }
-}
-
-QTEST_MAIN(tst_QGeoAreaMonitorInfoBenchmark)
-
-#include "tst_bench_qgeoareamonitorinfo.moc"
diff --git a/tests/benchmarks/qgeopositioninfo/CMakeLists.txt b/tests/benchmarks/qgeopositioninfo/CMakeLists.txt
deleted file mode 100644
index 40ba0246..00000000
--- a/tests/benchmarks/qgeopositioninfo/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# special case begin
-
-qt_internal_add_benchmark(tst_bench_qgeopositioninfo
- SOURCES
- tst_bench_qgeopositioninfo.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::Test
-)
-
-# special case end
diff --git a/tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp b/tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp
deleted file mode 100644
index eabc6b62..00000000
--- a/tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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/QGeoPositionInfo>
-#include <QTest>
-
-static const QGeoCoordinate coordinate(1.0, 2.0);
-static const QDateTime dateTime = QDateTime::currentDateTimeUtc();
-
-class tst_QGeoPositionInfoBenchmark : public QObject
-{
- Q_OBJECT
-private slots:
- void constructDefault();
- void constructWithParameters();
- void constructCopy();
- void constructMove();
-
- void assign();
- void assignMove();
-
- void checkEquality();
-
- void isValid();
-
- void setTimestamp();
- void queryTimestamp();
-
- void setCoordinate();
- void queryCoordinate();
-
- void setAttribute();
- void queryAttributeExisting();
- void queryAttributeNonExisting();
- void removeAttributeExisting();
- void removeAttributeNonExisting();
- void hasAttributeExisting();
- void hasAttributeNonExisting();
-};
-
-void tst_QGeoPositionInfoBenchmark::constructDefault()
-{
- QBENCHMARK {
- QGeoPositionInfo info;
- Q_UNUSED(info)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::constructWithParameters()
-{
- QBENCHMARK {
- QGeoPositionInfo info(coordinate, dateTime);
- Q_UNUSED(info)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::constructCopy()
-{
- const QGeoPositionInfo info(coordinate, dateTime);
- QBENCHMARK {
- QGeoPositionInfo newInfo(info);
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::constructMove()
-{
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of constructDefault()
- // benchmark.
- QGeoPositionInfo info;
- QGeoPositionInfo newInfo(std::move(info));
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::assign()
-{
- const QGeoPositionInfo info(coordinate, dateTime);
- QGeoPositionInfo newInfo;
- QBENCHMARK {
- newInfo = info;
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::assignMove()
-{
- QGeoPositionInfo newInfo;
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of constructDefault()
- // benchmark.
- QGeoPositionInfo info;
- newInfo = std::move(info);
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::checkEquality()
-{
- // We will benchmark equal objects, because unequal objects will normally
- // take less time to compare (as the comparison will fail at some stage).
- const QGeoPositionInfo info1(coordinate, dateTime);
- const QGeoPositionInfo info2(coordinate, dateTime);
- QBENCHMARK {
- const bool equal = info1 == info2;
- Q_UNUSED(equal)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::isValid()
-{
- const QGeoPositionInfo info(coordinate, dateTime);
- QBENCHMARK {
- const bool valid = info.isValid();
- Q_UNUSED(valid)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::setTimestamp()
-{
- QGeoPositionInfo info;
- QBENCHMARK {
- info.setTimestamp(dateTime);
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::queryTimestamp()
-{
- const QGeoPositionInfo info(coordinate, dateTime);
- QBENCHMARK {
- const auto dt = info.timestamp();
- Q_UNUSED(dt)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::setCoordinate()
-{
- QGeoPositionInfo info;
- QBENCHMARK {
- info.setCoordinate(coordinate);
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::queryCoordinate()
-{
- const QGeoPositionInfo info(coordinate, dateTime);
- QBENCHMARK {
- const auto coord = info.coordinate();
- Q_UNUSED(coord)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::setAttribute()
-{
- QGeoPositionInfo info;
- QBENCHMARK {
- info.setAttribute(QGeoPositionInfo::Direction, 1.0);
- }
-}
-
-static QGeoPositionInfo generateInfoWithAttributes()
-{
- QGeoPositionInfo info;
- info.setAttribute(QGeoPositionInfo::Direction, 1.0);
- info.setAttribute(QGeoPositionInfo::GroundSpeed, 2.0);
- info.setAttribute(QGeoPositionInfo::VerticalSpeed, 3.0);
- info.setAttribute(QGeoPositionInfo::MagneticVariation, 4.0);
- return info;
-}
-
-void tst_QGeoPositionInfoBenchmark::queryAttributeExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- const auto value = info.attribute(QGeoPositionInfo::GroundSpeed);
- Q_UNUSED(value)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::queryAttributeNonExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- const auto value = info.attribute(QGeoPositionInfo::HorizontalAccuracy);
- Q_UNUSED(value)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::removeAttributeExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- info.removeAttribute(QGeoPositionInfo::GroundSpeed);
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::removeAttributeNonExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- info.removeAttribute(QGeoPositionInfo::HorizontalAccuracy);
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::hasAttributeExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- const auto value = info.hasAttribute(QGeoPositionInfo::GroundSpeed);
- Q_UNUSED(value)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::hasAttributeNonExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- const auto value = info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy);
- Q_UNUSED(value)
- }
-}
-
-QTEST_MAIN(tst_QGeoPositionInfoBenchmark)
-
-#include "tst_bench_qgeopositioninfo.moc"
diff --git a/tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt b/tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt
deleted file mode 100644
index 461bcf66..00000000
--- a/tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# special case begin
-
-qt_internal_add_benchmark(tst_bench_qgeosatelliteinfo
- SOURCES
- tst_bench_qgeosatelliteinfo.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::Test
-)
-
-# special case end
diff --git a/tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp b/tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp
deleted file mode 100644
index acff7a7b..00000000
--- a/tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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/QGeoSatelliteInfo>
-#include <QTest>
-
-class tst_QGeoSatelliteInfoBenchmark : public QObject
-{
- Q_OBJECT
-private slots:
- void constructDefault();
- void constructCopy();
- void constructMove();
-
- void assign();
- void assignMove();
-
- void checkEquality();
-
- void setSatelliteSystem();
- void querySatelliteSystem();
-
- void setSatelliteIdentifier();
- void querySatelliteIdentifier();
-
- void setSignalStrength();
- void querySignalStrength();
-
- void setAttribute();
- void queryAttributeExisting();
- void queryAttributeNonExisting();
- void removeAttributeExisting();
- void removeAttributeNonExisting();
- void hasAttributeExisting();
- void hasAttributeNonExisting();
-};
-
-void tst_QGeoSatelliteInfoBenchmark::constructDefault()
-{
- QBENCHMARK {
- QGeoSatelliteInfo info;
- Q_UNUSED(info)
- }
-}
-
-static QGeoSatelliteInfo createSatelliteInfo()
-{
- QGeoSatelliteInfo info;
- info.setSatelliteSystem(QGeoSatelliteInfo::GLONASS);
- info.setSatelliteIdentifier(1);
- info.setSignalStrength(-30);
- info.setAttribute(QGeoSatelliteInfo::Elevation, 10.0);
- return info;
-}
-
-void tst_QGeoSatelliteInfoBenchmark::constructCopy()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- QGeoSatelliteInfo newInfo(info);
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::constructMove()
-{
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of constructDefault()
- // benchmark.
- QGeoSatelliteInfo info;
- QGeoSatelliteInfo newInfo(std::move(info));
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::assign()
-{
- const auto info = createSatelliteInfo();
- QGeoSatelliteInfo newInfo;
- QBENCHMARK {
- newInfo = info;
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::assignMove()
-{
- QGeoSatelliteInfo newInfo;
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of constructDefault()
- // benchmark.
- QGeoSatelliteInfo info;
- newInfo = std::move(info);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::checkEquality()
-{
- const auto info1 = createSatelliteInfo();
- const auto info2 = createSatelliteInfo();
- QBENCHMARK {
- const bool equal = info1 == info2;
- Q_UNUSED(equal)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::setSatelliteSystem()
-{
- QGeoSatelliteInfo info;
- QBENCHMARK {
- info.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::querySatelliteSystem()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.satelliteSystem();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::setSatelliteIdentifier()
-{
- QGeoSatelliteInfo info;
- QBENCHMARK {
- info.setSatelliteIdentifier(10);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::querySatelliteIdentifier()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.satelliteIdentifier();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::setSignalStrength()
-{
- QGeoSatelliteInfo info;
- QBENCHMARK {
- info.setSignalStrength(-50);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::querySignalStrength()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.signalStrength();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::setAttribute()
-{
- QGeoSatelliteInfo info;
- QBENCHMARK {
- info.setAttribute(QGeoSatelliteInfo::Elevation, 10.0);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::queryAttributeExisting()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.attribute(QGeoSatelliteInfo::Elevation);
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::queryAttributeNonExisting()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.attribute(QGeoSatelliteInfo::Azimuth);
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::removeAttributeExisting()
-{
- auto info = createSatelliteInfo();
- QBENCHMARK {
- info.removeAttribute(QGeoSatelliteInfo::Elevation);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::removeAttributeNonExisting()
-{
- auto info = createSatelliteInfo();
- QBENCHMARK {
- info.removeAttribute(QGeoSatelliteInfo::Azimuth);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::hasAttributeExisting()
-{
- auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.hasAttribute(QGeoSatelliteInfo::Elevation);
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::hasAttributeNonExisting()
-{
- auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.hasAttribute(QGeoSatelliteInfo::Azimuth);
- Q_UNUSED(val)
- }
-}
-
-QTEST_MAIN(tst_QGeoSatelliteInfoBenchmark)
-
-#include "tst_bench_qgeosatelliteinfo.moc"