summaryrefslogtreecommitdiffstats
path: root/tests/testpreferences.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@gmail.com>2016-08-28 20:11:29 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-08-28 20:01:23 -0700
commit3dce5de12ddbf310ed047227f3470d478b505540 (patch)
tree920080e9d856d3ea3f0d0c511b97f123c76fca1b /tests/testpreferences.cpp
parente54f81855dc49e302e42e17538256fe738dba73f (diff)
downloadsubsurface-3dce5de12ddbf310ed047227f3470d478b505540.tar.gz
Add the beginning of the Preferences test
And it actually helped me to find a bug. yey. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests/testpreferences.cpp')
-rw-r--r--tests/testpreferences.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
new file mode 100644
index 000000000..652cf6f1d
--- /dev/null
+++ b/tests/testpreferences.cpp
@@ -0,0 +1,35 @@
+#include "testpreferences.h"
+
+#include "core/subsurface-qt/SettingsObjectWrapper.h"
+
+#include <QtTest>
+
+#define TEST(METHOD, VALUE) \
+QCOMPARE(METHOD, VALUE); \
+pref->sync(); \
+pref->load(); \
+QCOMPARE(METHOD, VALUE);
+
+
+void TestPreferences::testPreferences()
+{
+ auto pref = SettingsObjectWrapper::instance();
+ pref->load();
+
+ pref->animation_settings->setAnimationSpeed(20);
+ TEST(pref->animation_settings->animationSpeed(), 20);
+ pref->animation_settings->setAnimationSpeed(30);
+ TEST(pref->animation_settings->animationSpeed(), 30);
+
+ pref->cloud_storage->setBackgroundSync(true);
+ TEST(pref->cloud_storage->backgroundSync(), true);
+ pref->cloud_storage->setBackgroundSync(false);
+ TEST(pref->cloud_storage->backgroundSync(), false);
+
+ pref->cloud_storage->setBaseUrl("test_one");
+ TEST(pref->cloud_storage->baseUrl(), QStringLiteral("test_one"));
+ pref->cloud_storage->setBaseUrl("test_two");
+ TEST(pref->cloud_storage->baseUrl(), QStringLiteral("test_two"));
+}
+
+QTEST_MAIN(TestPreferences)