aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2021-09-11 17:01:16 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-09-13 11:21:34 -0700
commit2a0d14b10065540d7d709950c0005bed459f5e82 (patch)
tree0aed144e712bc68126d9f3eb471f3c449414683b /tests
parent6f813b9f8e58a7b6529e3be728e0ae37e8401400 (diff)
downloadsubsurface-2a0d14b10065540d7d709950c0005bed459f5e82.tar.gz
core: remove location service preferences
Including the related tests. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt2
-rw-r--r--tests/testqPrefLocationService.cpp132
-rw-r--r--tests/testqPrefLocationService.h21
-rw-r--r--tests/tst_qPrefLocationService.qml38
4 files changed, 0 insertions, 193 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 7f93c3c6a..d86c976dc 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -137,7 +137,6 @@ TEST(TestQPrefEquipment testqPrefEquipment.cpp)
TEST(TestQPrefMedia testqPrefMedia.cpp)
TEST(TestQPrefGeocoding testqPrefGeocoding.cpp)
TEST(TestQPrefLanguage testqPrefLanguage.cpp)
-TEST(TestQPrefLocationService testqPrefLocationService.cpp)
TEST(TestQPrefPartialPressureGas testqPrefPartialPressureGas.cpp)
TEST(TestQPrefProxy testqPrefProxy.cpp)
TEST(TestQPrefTechnicalDetails testqPrefTechnicalDetails.cpp)
@@ -174,7 +173,6 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
TestQPrefMedia
TestQPrefGeocoding
TestQPrefLanguage
- TestQPrefLocationService
TestQPrefPartialPressureGas
TestQPrefProxy
TestQPrefTechnicalDetails
diff --git a/tests/testqPrefLocationService.cpp b/tests/testqPrefLocationService.cpp
deleted file mode 100644
index 43c438003..000000000
--- a/tests/testqPrefLocationService.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include "testqPrefLocationService.h"
-
-#include "core/pref.h"
-#include "core/qthelper.h"
-#include "core/settings/qPrefLocationService.h"
-
-#include <QTest>
-#include <QSignalSpy>
-
-void TestQPrefLocationService::initTestCase()
-{
- QCoreApplication::setOrganizationName("Subsurface");
- QCoreApplication::setOrganizationDomain("subsurface.hohndel.org");
- QCoreApplication::setApplicationName("SubsurfaceTestQPrefLocationService");
-}
-
-void TestQPrefLocationService::test_struct_get()
-{
- // Test struct pref -> get func.
-
- auto tst = qPrefLocationService::instance();
-
- prefs.distance_threshold = 1000;
- prefs.time_threshold = 60;
-
- QCOMPARE(tst->distance_threshold(), prefs.distance_threshold);
- QCOMPARE(tst->time_threshold(), prefs.time_threshold);
-}
-
-void TestQPrefLocationService::test_set_struct()
-{
- // Test set func -> struct pref
-
- auto tst = qPrefLocationService::instance();
-
- tst->set_distance_threshold(2000);
- tst->set_time_threshold(90);
-
- QCOMPARE(prefs.distance_threshold, 2000);
- QCOMPARE(prefs.time_threshold, 90);
-}
-
-void TestQPrefLocationService::test_set_load_struct()
-{
- // test set func -> load -> struct pref
-
- auto tst = qPrefLocationService::instance();
-
- tst->set_distance_threshold(2001);
- tst->set_time_threshold(91);
-
- prefs.distance_threshold = 1000;
- prefs.time_threshold = 60;
-
- tst->load();
- QCOMPARE(tst->distance_threshold(), 2001);
- QCOMPARE(tst->time_threshold(), 91);
-}
-
-void TestQPrefLocationService::test_struct_disk()
-{
- // test struct prefs -> disk
-
- auto tst = qPrefLocationService::instance();
-
- prefs.distance_threshold = 1002;
- prefs.time_threshold = 62;
-
- tst->sync();
- prefs.distance_threshold = 12;
- prefs.time_threshold = 2;
-
- tst->load();
- QCOMPARE(tst->distance_threshold(), 1002);
- QCOMPARE(tst->time_threshold(), 62);
-}
-
-void TestQPrefLocationService::test_multiple()
-{
- // test multiple instances have the same information
-
- prefs.distance_threshold = 52;
- prefs.time_threshold = 62;
- auto tst = qPrefLocationService::instance();
-
- QCOMPARE(tst->distance_threshold(), qPrefLocationService::distance_threshold());
- QCOMPARE(tst->time_threshold(), qPrefLocationService::time_threshold());
- QCOMPARE(qPrefLocationService::distance_threshold(), 52);
- QCOMPARE(qPrefLocationService::time_threshold(), 62);
-}
-
-#define TEST(METHOD, VALUE) \
- QCOMPARE(METHOD, VALUE); \
- location->sync(); \
- location->load(); \
- QCOMPARE(METHOD, VALUE);
-
-void TestQPrefLocationService::test_oldPreferences()
-{
- auto location = qPrefLocationService::instance();
-
- location->set_time_threshold(10);
- location->set_distance_threshold(20);
-
- TEST(location->time_threshold(), 10);
- TEST(location->distance_threshold(), 20);
-
- location->set_time_threshold(30);
- location->set_distance_threshold(40);
-
- TEST(location->time_threshold(), 30);
- TEST(location->distance_threshold(), 40);
-}
-
-void TestQPrefLocationService::test_signals()
-{
- QSignalSpy spy1(qPrefLocationService::instance(), &qPrefLocationService::distance_thresholdChanged);
- QSignalSpy spy2(qPrefLocationService::instance(), &qPrefLocationService::time_thresholdChanged);
-
- qPrefLocationService::set_distance_threshold(-2000);
- qPrefLocationService::set_time_threshold(-90);
-
- QCOMPARE(spy1.count(), 1);
- QCOMPARE(spy2.count(), 1);
-
- QVERIFY(spy1.takeFirst().at(0).toInt() == -2000);
- QVERIFY(spy2.takeFirst().at(0).toInt() == -90);
-}
-
-
-QTEST_MAIN(TestQPrefLocationService)
diff --git a/tests/testqPrefLocationService.h b/tests/testqPrefLocationService.h
deleted file mode 100644
index 9579cec27..000000000
--- a/tests/testqPrefLocationService.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#ifndef TESTQPREFLOCATIONSERVICE_H
-#define TESTQPREFLOCATIONSERVICE_H
-
-#include <QObject>
-
-class TestQPrefLocationService : public QObject {
- Q_OBJECT
-
-private slots:
- void initTestCase();
- void test_struct_get();
- void test_set_struct();
- void test_set_load_struct();
- void test_struct_disk();
- void test_multiple();
- void test_oldPreferences();
- void test_signals();
-};
-
-#endif // TESTQPREFLOCATIONSERVICE_H
diff --git a/tests/tst_qPrefLocationService.qml b/tests/tst_qPrefLocationService.qml
deleted file mode 100644
index 9da5fcfb3..000000000
--- a/tests/tst_qPrefLocationService.qml
+++ /dev/null
@@ -1,38 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-import QtQuick 2.6
-import QtTest 1.2
-
-TestCase {
- name: "qPrefLocationService"
-
- function test_variables() {
- var x1 = PrefLocationService.distance_threshold
- PrefLocationService.distance_threshold = 123
- compare(PrefLocationService.distance_threshold , 123)
-
- var x2 = PrefLocationService.time_threshold
- PrefLocationService.time_threshold = 12
- compare(PrefLocationService.time_threshold , 12)
- }
-
- Item {
- id: spyCatcher
-
- property bool spy1 : false
- property bool spy2 : false
-
- Connections {
- target: PrefLocationService
- onDistance_thresholdChanged: {spyCatcher.spy1 = true }
- onTime_thresholdChanged: {spyCatcher.spy2 = true }
- }
- }
-
- function test_signals() {
- PrefLocationService.distance_threshold = -123
- PrefLocationService.time_threshold = -12
-
- compare(spyCatcher.spy1, true)
- compare(spyCatcher.spy2, true)
- }
-}