aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-04 11:25:57 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-09 08:45:02 -0700
commit9341ea6eef9cf8573e6b513370424b514753f8ac (patch)
tree17b1342be7bc5d433aa0c9e85798c7e6715f872d
parent4ce7a2e30c971f24c9ed8a3eda19195cbf143ac8 (diff)
downloadsubsurface-9341ea6eef9cf8573e6b513370424b514753f8ac.tar.gz
tests: move UpdateManager test from testpreferences
Remove UpdateManager test in testpreferences add the same UpdateManager tests to testqPrefUpdateManager Signed-off-by: Jan Iversen <jani@apache.org>
-rw-r--r--tests/testpreferences.cpp20
-rw-r--r--tests/testqPrefUpdateManager.cpp29
-rw-r--r--tests/testqPrefUpdateManager.h1
3 files changed, 30 insertions, 20 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index 59f7d064c..aef4c9991 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -262,26 +262,6 @@ void TestPreferences::testPreferences()
TEST(location->timeThreshold(), 30);
TEST(location->distanceThreshold(), 40);
-
- auto update = qPrefUpdateManager::instance();
- QDate date = QDate::currentDate();
-
- update->set_dont_check_for_updates(true);
- update->set_last_version_used("tomaz-1");
- update->set_next_check(date);
-
- TEST(update->dont_check_for_updates(), true);
- TEST(update->last_version_used(), QStringLiteral("tomaz-1"));
- TEST(update->next_check(), date);
-
- date = date.addDays(3);
- update->set_dont_check_for_updates(false);
- update->set_last_version_used("tomaz-2");
- update->set_next_check(date);
-
- TEST(update->dont_check_for_updates(), false);
- TEST(update->last_version_used(), QStringLiteral("tomaz-2"));
- TEST(update->next_check(), date);
}
QTEST_MAIN(TestPreferences)
diff --git a/tests/testqPrefUpdateManager.cpp b/tests/testqPrefUpdateManager.cpp
index 63757eaab..166fea032 100644
--- a/tests/testqPrefUpdateManager.cpp
+++ b/tests/testqPrefUpdateManager.cpp
@@ -120,4 +120,33 @@ void TestQPrefUpdateManager::test_multiple()
QCOMPARE(tst_direct->dont_check_exists(), false);
}
+#define TEST(METHOD, VALUE) \
+ QCOMPARE(METHOD, VALUE); \
+ update->sync(); \
+ update->load(); \
+ QCOMPARE(METHOD, VALUE);
+
+void TestQPrefUpdateManager::test_oldPreferences()
+{
+ auto update = qPrefUpdateManager::instance();
+ QDate date = QDate::currentDate();
+
+ update->set_dont_check_for_updates(true);
+ update->set_last_version_used("tomaz-1");
+ update->set_next_check(date);
+
+ TEST(update->dont_check_for_updates(), true);
+ TEST(update->last_version_used(), QStringLiteral("tomaz-1"));
+ TEST(update->next_check(), date);
+
+ date = date.addDays(3);
+ update->set_dont_check_for_updates(false);
+ update->set_last_version_used("tomaz-2");
+ update->set_next_check(date);
+
+ TEST(update->dont_check_for_updates(), false);
+ TEST(update->last_version_used(), QStringLiteral("tomaz-2"));
+ TEST(update->next_check(), date);
+}
+
QTEST_MAIN(TestQPrefUpdateManager)
diff --git a/tests/testqPrefUpdateManager.h b/tests/testqPrefUpdateManager.h
index 6c8f04dbf..5dc58e0d2 100644
--- a/tests/testqPrefUpdateManager.h
+++ b/tests/testqPrefUpdateManager.h
@@ -14,6 +14,7 @@ private slots:
void test_set_load_struct();
void test_struct_disk();
void test_multiple();
+ void test_oldPreferences();
};
#endif // TESTQPREFUPDATEMANAGER_H