mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
4ce7a2e30c
commit
9341ea6eef
3 changed files with 30 additions and 20 deletions
|
@ -262,26 +262,6 @@ void TestPreferences::testPreferences()
|
||||||
|
|
||||||
TEST(location->timeThreshold(), 30);
|
TEST(location->timeThreshold(), 30);
|
||||||
TEST(location->distanceThreshold(), 40);
|
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)
|
QTEST_MAIN(TestPreferences)
|
||||||
|
|
|
@ -120,4 +120,33 @@ void TestQPrefUpdateManager::test_multiple()
|
||||||
QCOMPARE(tst_direct->dont_check_exists(), false);
|
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)
|
QTEST_MAIN(TestQPrefUpdateManager)
|
||||||
|
|
|
@ -14,6 +14,7 @@ private slots:
|
||||||
void test_set_load_struct();
|
void test_set_load_struct();
|
||||||
void test_struct_disk();
|
void test_struct_disk();
|
||||||
void test_multiple();
|
void test_multiple();
|
||||||
|
void test_oldPreferences();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TESTQPREFUPDATEMANAGER_H
|
#endif // TESTQPREFUPDATEMANAGER_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue