aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testqPrefCloudStorage.cpp
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-07-15 13:53:03 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-07-21 07:49:25 -0700
commitbe8e93d28a78b4d58b35eca9e0f097b824a84fa9 (patch)
tree2e1f08f842db68ccd1fc06393d5dce6e2fc5aefa /tests/testqPrefCloudStorage.cpp
parentcabdf71bf7976640d9c0c61d4c4c6806a7636218 (diff)
downloadsubsurface-be8e93d28a78b4d58b35eca9e0f097b824a84fa9.tar.gz
tests: move CloudStorage test from testpreferences
Remove CloudStorage test in testpreferences add the same CloudStorage tests to testqPrefCloudStorage Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'tests/testqPrefCloudStorage.cpp')
-rw-r--r--tests/testqPrefCloudStorage.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/testqPrefCloudStorage.cpp b/tests/testqPrefCloudStorage.cpp
index 26397c194..1165987d3 100644
--- a/tests/testqPrefCloudStorage.cpp
+++ b/tests/testqPrefCloudStorage.cpp
@@ -206,4 +206,61 @@ void TestQPrefCloudStorage::test_multiple()
QCOMPARE(tst->cloud_timeout(), tst_direct->cloud_timeout());
}
+#define TEST(METHOD, VALUE) \
+QCOMPARE(METHOD, VALUE); \
+cloud->sync(); \
+cloud->load(); \
+QCOMPARE(METHOD, VALUE);
+
+void TestQPrefCloudStorage::test_oldPreferences()
+{
+ auto cloud = qPrefCloudStorage::instance();
+
+ cloud->set_cloud_base_url("test_one");
+ TEST(cloud->cloud_base_url(), QStringLiteral("test_one"));
+ cloud->set_cloud_base_url("test_two");
+ TEST(cloud->cloud_base_url(), QStringLiteral("test_two"));
+
+ cloud->set_cloud_storage_email("tomaz@subsurface.com");
+ TEST(cloud->cloud_storage_email(), QStringLiteral("tomaz@subsurface.com"));
+ cloud->set_cloud_storage_email("tomaz@gmail.com");
+ TEST(cloud->cloud_storage_email(), QStringLiteral("tomaz@gmail.com"));
+
+ cloud->set_git_local_only(true);
+ TEST(cloud->git_local_only(), true);
+ cloud->set_git_local_only(false);
+ TEST(cloud->git_local_only(), false);
+
+ // Why there's new password and password on the prefs?
+ cloud->set_cloud_storage_newpassword("ABCD");
+ TEST(cloud->cloud_storage_newpassword(), QStringLiteral("ABCD"));
+ cloud->set_cloud_storage_newpassword("ABCDE");
+ TEST(cloud->cloud_storage_newpassword(), QStringLiteral("ABCDE"));
+
+ cloud->set_cloud_storage_password("ABCDE");
+ TEST(cloud->cloud_storage_password(), QStringLiteral("ABCDE"));
+ cloud->set_cloud_storage_password("ABCABC");
+ TEST(cloud->cloud_storage_password(), QStringLiteral("ABCABC"));
+
+ cloud->set_save_password_local(true);
+ TEST(cloud->save_password_local(), true);
+ cloud->set_save_password_local(false);
+ TEST(cloud->save_password_local(), false);
+
+ cloud->set_save_userid_local(1);
+ TEST(cloud->save_userid_local(), true);
+ cloud->set_save_userid_local(0);
+ TEST(cloud->save_userid_local(), false);
+
+ cloud->set_userid("Tomaz");
+ TEST(cloud->userid(), QStringLiteral("Tomaz"));
+ cloud->set_userid("Zamot");
+ TEST(cloud->userid(), QStringLiteral("Zamot"));
+
+ cloud->set_cloud_verification_status(0);
+ TEST(cloud->cloud_verification_status(), 0);
+ cloud->set_cloud_verification_status(1);
+ TEST(cloud->cloud_verification_status(), 1);
+}
+
QTEST_MAIN(TestQPrefCloudStorage)