summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-07-28 17:21:51 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-07-30 07:43:22 -0700
commit600da8b9ff4946d6500e2327dc8f7e361a3616cc (patch)
tree0a688b20a7941c7c61eb78388d41b85f4b1d1c0e
parent311b2672da5bda0efbdda70bfe33ccc088ba5c8d (diff)
downloadsubsurface-600da8b9ff4946d6500e2327dc8f7e361a3616cc.tar.gz
tests: correct test_multiple in all qPref classes
test_multiple did not test correctly, correct. Signed-off-by: Jan Iversen <jani@apache.org>
-rw-r--r--tests/testqPrefAnimations.cpp1
-rw-r--r--tests/testqPrefCloudStorage.cpp5
-rw-r--r--tests/testqPrefDisplay.cpp18
-rw-r--r--tests/testqPrefDiveComputer.cpp8
-rw-r--r--tests/testqPrefFacebook.cpp7
5 files changed, 18 insertions, 21 deletions
diff --git a/tests/testqPrefAnimations.cpp b/tests/testqPrefAnimations.cpp
index 70d030235..90292f28f 100644
--- a/tests/testqPrefAnimations.cpp
+++ b/tests/testqPrefAnimations.cpp
@@ -77,6 +77,7 @@ void TestQPrefAnimations::test_multiple()
auto tst = qPrefAnimations::instance();
QCOMPARE(tst->animation_speed(), tst_direct->animation_speed());
+ QCOMPARE(tst_direct->animation_speed(), 25);
}
QTEST_MAIN(TestQPrefAnimations)
diff --git a/tests/testqPrefCloudStorage.cpp b/tests/testqPrefCloudStorage.cpp
index 232aa990e..2ca2bb81a 100644
--- a/tests/testqPrefCloudStorage.cpp
+++ b/tests/testqPrefCloudStorage.cpp
@@ -20,7 +20,6 @@ void TestQPrefCloudStorage::test_struct_get()
auto tst = qPrefCloudStorage::instance();
- prefs.animation_speed = 17;
prefs.cloud_base_url = copy_qstring("new url");
prefs.cloud_git_url = copy_qstring("new again url");
prefs.cloud_storage_email = copy_qstring("myEmail");
@@ -199,13 +198,15 @@ void TestQPrefCloudStorage::test_multiple()
{
// test multiple instances have the same information
- prefs.animation_speed = 37;
+ prefs.userid = copy_qstring("my user");
auto tst_direct = new qPrefCloudStorage;
prefs.cloud_timeout = 25;
auto tst = qPrefCloudStorage::instance();
QCOMPARE(tst->cloud_timeout(), tst_direct->cloud_timeout());
+ QCOMPARE(tst->userid(), tst_direct->userid());
+ QCOMPARE(tst_direct->cloud_timeout(), 25);
}
#define TEST(METHOD, VALUE) \
diff --git a/tests/testqPrefDisplay.cpp b/tests/testqPrefDisplay.cpp
index 8b7275a39..0f534c0da 100644
--- a/tests/testqPrefDisplay.cpp
+++ b/tests/testqPrefDisplay.cpp
@@ -109,26 +109,16 @@ void TestQPrefDisplay::test_struct_disk()
void TestQPrefDisplay::test_multiple()
{
// test multiple instances have the same information
-
- prefs.display_invalid_dives = false;
+ auto display_direct = qPrefDisplay::instance();
prefs.divelist_font = copy_qstring("comic");
- prefs.font_size = 11.0;
- prefs.show_developer = true;
- prefs.theme = copy_qstring("myTheme");
- auto display_direct = new qPrefDisplay;
- prefs.display_invalid_dives = true;
- prefs.divelist_font = copy_qstring("multipleCharsInString");
- prefs.font_size = 15.0;
- prefs.show_developer = false;
- prefs.theme = copy_qstring("myTheme8");
auto display = qPrefDisplay::instance();
+ prefs.font_size = 15.0;
- QCOMPARE(display->display_invalid_dives(), display_direct->display_invalid_dives());
QCOMPARE(display->divelist_font(), display_direct->divelist_font());
+ QCOMPARE(display->divelist_font(), QString("comic"));
QCOMPARE(display->font_size(), display_direct->font_size());
- QCOMPARE(display->show_developer(), display_direct->show_developer());
- QCOMPARE(display->theme(), display_direct->theme());
+ QCOMPARE(display->font_size(), 15.0);
}
QTEST_MAIN(TestQPrefDisplay)
diff --git a/tests/testqPrefDiveComputer.cpp b/tests/testqPrefDiveComputer.cpp
index 915baecb8..5a26ffdac 100644
--- a/tests/testqPrefDiveComputer.cpp
+++ b/tests/testqPrefDiveComputer.cpp
@@ -110,14 +110,16 @@ void TestQPrefDiveComputer::test_struct_disk()
void TestQPrefDiveComputer::test_multiple()
{
// test multiple instances have the same information
- prefs.dive_computer.download_mode = 57;
-
auto tst_direct = new qPrefDiveComputer;
+ prefs.dive_computer.download_mode = 57;
- prefs.dive_computer.download_mode = 25;
auto tst = qPrefDiveComputer::instance();
+ prefs.dive_computer.device = copy_qstring("mine");
+ QCOMPARE(tst->device(), tst_direct->device());
+ QCOMPARE(tst->device(), QString("mine"));
QCOMPARE(tst->download_mode(), tst_direct->download_mode());
+ QCOMPARE(tst->download_mode(), 57);
}
#define TEST(METHOD, VALUE) \
diff --git a/tests/testqPrefFacebook.cpp b/tests/testqPrefFacebook.cpp
index 815896cd1..ef39d704c 100644
--- a/tests/testqPrefFacebook.cpp
+++ b/tests/testqPrefFacebook.cpp
@@ -48,13 +48,16 @@ void TestQPrefFacebook::test_multiple()
{
// test multiple instances have the same information
- prefs.facebook.access_token = copy_qstring("test 1");
auto tst_direct = new qPrefFacebook;
+ prefs.facebook.access_token = copy_qstring("test 1");
- prefs.facebook.access_token = copy_qstring("test 2");
auto tst = qPrefFacebook::instance();
+ prefs.facebook.album_id = copy_qstring("test 2");
QCOMPARE(tst->access_token(), tst_direct->access_token());
+ QCOMPARE(tst->access_token(), QString("test 1"));
+ QCOMPARE(tst->album_id(), tst_direct->album_id());
+ QCOMPARE(tst->album_id(), QString("test 2"));
}
#define TEST(METHOD, VALUE) \