summaryrefslogtreecommitdiffstats
path: root/tests/testqPrefLocationService.cpp
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-28 12:33:47 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-11 17:25:00 -0700
commitc01d9f60c14ec9ee58892504e9f5c346dbb24e7e (patch)
tree10edfbe1f86c3d9097ca8206b44b42f6ed60e060 /tests/testqPrefLocationService.cpp
parent93ba8c583a4b38d34811f5592160ece31ddd7ea8 (diff)
downloadsubsurface-c01d9f60c14ec9ee58892504e9f5c346dbb24e7e.tar.gz
tests: add signal test to call testqPref*cpp
Add signal testing of all variables this commit contains all qPref* that work directly followup commit will do changes to qPref* to make signals work Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'tests/testqPrefLocationService.cpp')
-rw-r--r--tests/testqPrefLocationService.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/testqPrefLocationService.cpp b/tests/testqPrefLocationService.cpp
index fbd374a4b..0f383212c 100644
--- a/tests/testqPrefLocationService.cpp
+++ b/tests/testqPrefLocationService.cpp
@@ -6,6 +6,7 @@
#include "core/settings/qPrefLocationService.h"
#include <QTest>
+#include <QSignalSpy>
void TestQPrefLocationService::initTestCase()
{
@@ -114,4 +115,20 @@ void TestQPrefLocationService::test_oldPreferences()
TEST(location->distance_threshold(), 40);
}
+void TestQPrefLocationService::test_signals()
+{
+ QSignalSpy spy1(qPrefLocationService::instance(), SIGNAL(distance_thresholdChanged(int)));
+ QSignalSpy spy2(qPrefLocationService::instance(), SIGNAL(time_thresholdChanged(int)));
+
+ 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)