diff options
author | jan Iversen <jani@apache.org> | 2018-08-28 12:33:47 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-09-11 17:25:00 -0700 |
commit | c01d9f60c14ec9ee58892504e9f5c346dbb24e7e (patch) | |
tree | 10edfbe1f86c3d9097ca8206b44b42f6ed60e060 /tests/testqPrefUpdateManager.cpp | |
parent | 93ba8c583a4b38d34811f5592160ece31ddd7ea8 (diff) | |
download | subsurface-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/testqPrefUpdateManager.cpp')
-rw-r--r-- | tests/testqPrefUpdateManager.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/testqPrefUpdateManager.cpp b/tests/testqPrefUpdateManager.cpp index 4d274d553..f11505654 100644 --- a/tests/testqPrefUpdateManager.cpp +++ b/tests/testqPrefUpdateManager.cpp @@ -6,6 +6,7 @@ #include "core/settings/qPrefUpdateManager.h" #include <QTest> +#include <QSignalSpy> void TestQPrefUpdateManager::initTestCase() { @@ -163,4 +164,34 @@ void TestQPrefUpdateManager::test_oldPreferences() TEST(update->next_check(), date); } +void TestQPrefUpdateManager::test_signals() +{ + QSignalSpy spy1(qPrefUpdateManager::instance(), SIGNAL(dont_check_for_updatesChanged(bool))); + QSignalSpy spy2(qPrefUpdateManager::instance(), SIGNAL(dont_check_existsChanged(bool))); + QSignalSpy spy3(qPrefUpdateManager::instance(), SIGNAL(last_version_usedChanged(QString))); + QSignalSpy spy4(qPrefUpdateManager::instance(), SIGNAL(next_checkChanged(QDate))); + QSignalSpy spy5(qPrefUpdateManager::instance(), SIGNAL(uuidStringChanged(QString))); + + prefs.update_manager.dont_check_for_updates = true; + qPrefUpdateManager::set_dont_check_for_updates(false); + prefs.update_manager.dont_check_exists = true; + qPrefUpdateManager::set_dont_check_exists(false); + qPrefUpdateManager::set_last_version_used("signal last_version2"); + qPrefUpdateManager::set_next_check(QDate::fromString("11/09/1967", "dd/MM/yyyy")); + qPrefUpdateManager::set_uuidString("signal uuid"); + + QCOMPARE(spy1.count(), 1); + QCOMPARE(spy2.count(), 1); + QCOMPARE(spy3.count(), 1); + QCOMPARE(spy4.count(), 1); + QCOMPARE(spy5.count(), 1); + + QVERIFY(spy1.takeFirst().at(0).toBool() == false); + QVERIFY(spy2.takeFirst().at(0).toBool() == false); + QVERIFY(spy3.takeFirst().at(0).toString() == "signal last_version2"); + QVERIFY(spy4.takeFirst().at(0).toDate() == QDate::fromString("11/09/1967", "dd/MM/yyyy")); + QVERIFY(spy5.takeFirst().at(0).toString() == "signal uuid"); +} + + QTEST_MAIN(TestQPrefUpdateManager) |