summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@gmail.com>2016-09-09 11:06:01 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-09-21 09:48:45 -0700
commit41db8ea21909b5bd54cd82b4c738bf73a6a67002 (patch)
tree990744dcb33f9dbb1721cb4105ac404a097ad0b1 /tests
parentb972bdb97dea32bb7d67f54786f06fa687d15b99 (diff)
downloadsubsurface-41db8ea21909b5bd54cd82b4c738bf73a6a67002.tar.gz
Finished unittest for cloud storage.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/testpreferences.cpp71
1 files changed, 52 insertions, 19 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index 3148bffea..e71df5788 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -21,25 +21,58 @@ void TestPreferences::testPreferences()
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"));
-
- pref->cloud_storage->setEmail("tomaz@subsurface.com");
- TEST(pref->cloud_storage->email(), QStringLiteral("tomaz@subsurface.com"));
- pref->cloud_storage->setEmail("tomaz@gmail.com");
- TEST(pref->cloud_storage->email(), QStringLiteral("tomaz@gmail.com"));
-
- pref->cloud_storage->setGitLocalOnly(true);
- TEST(pref->cloud_storage->gitLocalOnly(), true);
- pref->cloud_storage->setGitLocalOnly(false);
- TEST(pref->cloud_storage->gitLocalOnly(), false);
+ auto cloud = pref->cloud_storage;
+ cloud->setBackgroundSync(true);
+ TEST(cloud->backgroundSync(), true);
+ cloud->setBackgroundSync(false);
+ TEST(cloud->backgroundSync(), false);
+
+ cloud->setBaseUrl("test_one");
+ TEST(cloud->baseUrl(), QStringLiteral("test_one"));
+ cloud->setBaseUrl("test_two");
+ TEST(cloud->baseUrl(), QStringLiteral("test_two"));
+
+ cloud->setEmail("tomaz@subsurface.com");
+ TEST(cloud->email(), QStringLiteral("tomaz@subsurface.com"));
+ cloud->setEmail("tomaz@gmail.com");
+ TEST(cloud->email(), QStringLiteral("tomaz@gmail.com"));
+
+ cloud->setGitLocalOnly(true);
+ TEST(cloud->gitLocalOnly(), true);
+ cloud->setGitLocalOnly(false);
+ TEST(cloud->gitLocalOnly(), false);
+
+ // Why there's new password and password on the prefs?
+ cloud->setNewPassword("ABCD");
+ TEST(cloud->newPassword(), QStringLiteral("ABCD"));
+ cloud->setNewPassword("ABCDE");
+ TEST(cloud->newPassword(), QStringLiteral("ABCDE"));
+
+ cloud->setPassword("ABCDE");
+ TEST(cloud->password(), QStringLiteral("ABCDE"));
+ cloud->setPassword("ABCABC");
+ TEST(cloud->password(), QStringLiteral("ABCABC"));
+
+ cloud->setSavePasswordLocal(true);
+ TEST(cloud->savePasswordLocal(), true);
+ cloud->setSavePasswordLocal(false);
+ TEST(cloud->savePasswordLocal(), false);
+
+ // Why this is short and not bool?
+ cloud->setSaveUserIdLocal(1);
+ TEST(cloud->saveUserIdLocal(), (short)1);
+ cloud->setSaveUserIdLocal(0);
+ TEST(cloud->saveUserIdLocal(), (short)0);
+
+ cloud->setUserId("Tomaz");
+ TEST(cloud->userId(), QStringLiteral("Tomaz"));
+ cloud->setUserId("Zamot");
+ TEST(cloud->userId(), QStringLiteral("Zamot"));
+
+ cloud->setVerificationStatus(0);
+ TEST(cloud->verificationStatus(), (short)0);
+ cloud->setVerificationStatus(1);
+ TEST(cloud->verificationStatus(), (short)1);
}
QTEST_MAIN(TestPreferences)