mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
93ba8c583a
commit
c01d9f60c1
28 changed files with 672 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue