mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
tests: correct test_multiple in all qPref classes
test_multiple did not test correctly, correct. Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
parent
311b2672da
commit
600da8b9ff
5 changed files with 18 additions and 21 deletions
|
@ -77,6 +77,7 @@ void TestQPrefAnimations::test_multiple()
|
||||||
auto tst = qPrefAnimations::instance();
|
auto tst = qPrefAnimations::instance();
|
||||||
|
|
||||||
QCOMPARE(tst->animation_speed(), tst_direct->animation_speed());
|
QCOMPARE(tst->animation_speed(), tst_direct->animation_speed());
|
||||||
|
QCOMPARE(tst_direct->animation_speed(), 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_MAIN(TestQPrefAnimations)
|
QTEST_MAIN(TestQPrefAnimations)
|
||||||
|
|
|
@ -20,7 +20,6 @@ void TestQPrefCloudStorage::test_struct_get()
|
||||||
|
|
||||||
auto tst = qPrefCloudStorage::instance();
|
auto tst = qPrefCloudStorage::instance();
|
||||||
|
|
||||||
prefs.animation_speed = 17;
|
|
||||||
prefs.cloud_base_url = copy_qstring("new url");
|
prefs.cloud_base_url = copy_qstring("new url");
|
||||||
prefs.cloud_git_url = copy_qstring("new again url");
|
prefs.cloud_git_url = copy_qstring("new again url");
|
||||||
prefs.cloud_storage_email = copy_qstring("myEmail");
|
prefs.cloud_storage_email = copy_qstring("myEmail");
|
||||||
|
@ -199,13 +198,15 @@ void TestQPrefCloudStorage::test_multiple()
|
||||||
{
|
{
|
||||||
// test multiple instances have the same information
|
// test multiple instances have the same information
|
||||||
|
|
||||||
prefs.animation_speed = 37;
|
prefs.userid = copy_qstring("my user");
|
||||||
auto tst_direct = new qPrefCloudStorage;
|
auto tst_direct = new qPrefCloudStorage;
|
||||||
|
|
||||||
prefs.cloud_timeout = 25;
|
prefs.cloud_timeout = 25;
|
||||||
auto tst = qPrefCloudStorage::instance();
|
auto tst = qPrefCloudStorage::instance();
|
||||||
|
|
||||||
QCOMPARE(tst->cloud_timeout(), tst_direct->cloud_timeout());
|
QCOMPARE(tst->cloud_timeout(), tst_direct->cloud_timeout());
|
||||||
|
QCOMPARE(tst->userid(), tst_direct->userid());
|
||||||
|
QCOMPARE(tst_direct->cloud_timeout(), 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TEST(METHOD, VALUE) \
|
#define TEST(METHOD, VALUE) \
|
||||||
|
|
|
@ -109,26 +109,16 @@ void TestQPrefDisplay::test_struct_disk()
|
||||||
void TestQPrefDisplay::test_multiple()
|
void TestQPrefDisplay::test_multiple()
|
||||||
{
|
{
|
||||||
// test multiple instances have the same information
|
// test multiple instances have the same information
|
||||||
|
auto display_direct = qPrefDisplay::instance();
|
||||||
prefs.display_invalid_dives = false;
|
|
||||||
prefs.divelist_font = copy_qstring("comic");
|
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();
|
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(), display_direct->divelist_font());
|
||||||
|
QCOMPARE(display->divelist_font(), QString("comic"));
|
||||||
QCOMPARE(display->font_size(), display_direct->font_size());
|
QCOMPARE(display->font_size(), display_direct->font_size());
|
||||||
QCOMPARE(display->show_developer(), display_direct->show_developer());
|
QCOMPARE(display->font_size(), 15.0);
|
||||||
QCOMPARE(display->theme(), display_direct->theme());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_MAIN(TestQPrefDisplay)
|
QTEST_MAIN(TestQPrefDisplay)
|
||||||
|
|
|
@ -110,14 +110,16 @@ void TestQPrefDiveComputer::test_struct_disk()
|
||||||
void TestQPrefDiveComputer::test_multiple()
|
void TestQPrefDiveComputer::test_multiple()
|
||||||
{
|
{
|
||||||
// test multiple instances have the same information
|
// test multiple instances have the same information
|
||||||
|
auto tst_direct = new qPrefDiveComputer;
|
||||||
prefs.dive_computer.download_mode = 57;
|
prefs.dive_computer.download_mode = 57;
|
||||||
|
|
||||||
auto tst_direct = new qPrefDiveComputer;
|
|
||||||
|
|
||||||
prefs.dive_computer.download_mode = 25;
|
|
||||||
auto tst = qPrefDiveComputer::instance();
|
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(), tst_direct->download_mode());
|
||||||
|
QCOMPARE(tst->download_mode(), 57);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TEST(METHOD, VALUE) \
|
#define TEST(METHOD, VALUE) \
|
||||||
|
|
|
@ -48,13 +48,16 @@ void TestQPrefFacebook::test_multiple()
|
||||||
{
|
{
|
||||||
// test multiple instances have the same information
|
// test multiple instances have the same information
|
||||||
|
|
||||||
prefs.facebook.access_token = copy_qstring("test 1");
|
|
||||||
auto tst_direct = new qPrefFacebook;
|
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();
|
auto tst = qPrefFacebook::instance();
|
||||||
|
prefs.facebook.album_id = copy_qstring("test 2");
|
||||||
|
|
||||||
QCOMPARE(tst->access_token(), tst_direct->access_token());
|
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) \
|
#define TEST(METHOD, VALUE) \
|
||||||
|
|
Loading…
Reference in a new issue