From c97bb239b2e13f48b50a68a022aa448cfe3252cb Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Mon, 6 Aug 2018 18:18:05 +0200 Subject: tests: move LocationService test from testpreferences Remove LocationService test in testpreferences add the same LocationService tests to testqPrefLocationService Signed-off-by: Jan Iversen --- tests/testpreferences.cpp | 13 ------------- tests/testqPrefLocationService.cpp | 23 +++++++++++++++++++++++ tests/testqPrefLocationService.h | 1 + 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index 47de21219..0a4492c00 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -146,19 +146,6 @@ void TestPreferences::testPreferences() TEST(language->timeFormatOverride(), true); TEST(language->dateFormatOverride(), true); TEST(language->useSystemLanguage(), true); - - 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->timeThreshold(), 30); - TEST(location->distanceThreshold(), 40); } QTEST_MAIN(TestPreferences) diff --git a/tests/testqPrefLocationService.cpp b/tests/testqPrefLocationService.cpp index 0bd02e560..3c0d33fc3 100644 --- a/tests/testqPrefLocationService.cpp +++ b/tests/testqPrefLocationService.cpp @@ -91,4 +91,27 @@ void TestQPrefLocationService::test_multiple() QCOMPARE(tst_direct->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); +} + QTEST_MAIN(TestQPrefLocationService) diff --git a/tests/testqPrefLocationService.h b/tests/testqPrefLocationService.h index a3a134003..e9d1b5dac 100644 --- a/tests/testqPrefLocationService.h +++ b/tests/testqPrefLocationService.h @@ -14,6 +14,7 @@ private slots: void test_set_load_struct(); void test_struct_disk(); void test_multiple(); + void test_oldPreferences(); }; #endif // TESTQPREFLOCATIONSERVICE_H -- cgit v1.2.3-70-g09d2