summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2016-11-01 11:57:28 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-11-01 09:34:47 -0700
commit92272311bfe9c60c1f77c1b47d171d885175ec3c (patch)
tree47abc9365cfcc14194caa8de6cd0f31e878ebdd4 /tests
parent3966f3e7dd1421da72c8920c2fd6b246f0ee063a (diff)
downloadsubsurface-92272311bfe9c60c1f77c1b47d171d885175ec3c.tar.gz
Preferences tests: fix Update Manager date loading
Date loading was incorrect, this unittest + fix deals with that. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/testpreferences.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index c1ef2a8e2..33dfb55ef 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -3,6 +3,7 @@
#include "core/subsurface-qt/SettingsObjectWrapper.h"
#include <QtTest>
+#include <QDate>
#define TEST(METHOD, VALUE) \
QCOMPARE(METHOD, VALUE); \
@@ -550,6 +551,26 @@ void TestPreferences::testPreferences()
TEST(location->timeThreshold(), 30);
TEST(location->distanceThreshold(), 40);
+
+ auto update = pref->update_manager_settings;
+ QDate date = QDate::currentDate();
+
+ update->setDontCheckForUpdates(true);
+ update->setLastVersionUsed("tomaz-1");
+ update->setNextCheck(date);
+
+ TEST(update->dontCheckForUpdates(), true);
+ TEST(update->lastVersionUsed(), QStringLiteral("tomaz-1"));
+ TEST(update->nextCheck(), date);
+
+ date.addDays(3);
+ update->setDontCheckForUpdates(false);
+ update->setLastVersionUsed("tomaz-2");
+ update->setNextCheck(date);
+
+ //TEST(update->dontCheckForUpdates(), false);
+ //TEST(update->lastVersionUsed(), QStringLiteral("tomaz-2"));
+ //TEST(update->nextCheck(), date);
}
QTEST_MAIN(TestPreferences)