diff options
author | jan Iversen <jan@casacondor.com> | 2019-11-23 17:40:56 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-12-05 11:48:26 -0800 |
commit | 6e846eb4c0c5755ddddbd696aeb6531eab5488d8 (patch) | |
tree | 08fb31f179eb2f254f0457b4fa06b22d09ef675d | |
parent | 54f8217eec0df1876086849c8dcc594da709201a (diff) | |
download | subsurface-6e846eb4c0c5755ddddbd696aeb6531eab5488d8.tar.gz |
tests: correct testqPref*.cpp to use static qPref* functions.
qPref* set/get functions are static.
remove creation of qPref* instances, reference
static functions.
Signed-off-by: Jan Iversen <jan@casacondor.com>
-rw-r--r-- | tests/testqPrefCloudStorage.cpp | 6 | ||||
-rw-r--r-- | tests/testqPrefDisplay.cpp | 6 | ||||
-rw-r--r-- | tests/testqPrefDiveComputer.cpp | 3 | ||||
-rw-r--r-- | tests/testqPrefDivePlanner.cpp | 11 | ||||
-rw-r--r-- | tests/testqPrefGeneral.cpp | 10 | ||||
-rw-r--r-- | tests/testqPrefGeocoding.cpp | 6 | ||||
-rw-r--r-- | tests/testqPrefLanguage.cpp | 9 | ||||
-rw-r--r-- | tests/testqPrefLocationService.cpp | 10 | ||||
-rw-r--r-- | tests/testqPrefPartialPressureGas.cpp | 10 | ||||
-rw-r--r-- | tests/testqPrefProxy.cpp | 6 | ||||
-rw-r--r-- | tests/testqPrefTechnicalDetails.cpp | 10 | ||||
-rw-r--r-- | tests/testqPrefUnits.cpp | 5 | ||||
-rw-r--r-- | tests/testqPrefUpdateManager.cpp | 7 |
13 files changed, 38 insertions, 61 deletions
diff --git a/tests/testqPrefCloudStorage.cpp b/tests/testqPrefCloudStorage.cpp index d18c7a6e7..9d55ca743 100644 --- a/tests/testqPrefCloudStorage.cpp +++ b/tests/testqPrefCloudStorage.cpp @@ -165,13 +165,11 @@ void TestQPrefCloudStorage::test_multiple() { // test multiple instances have the same information - auto tst_direct = new qPrefCloudStorage; - prefs.cloud_timeout = 25; auto tst = qPrefCloudStorage::instance(); - QCOMPARE(tst->cloud_timeout(), tst_direct->cloud_timeout()); - QCOMPARE(tst_direct->cloud_timeout(), 25); + QCOMPARE(tst->cloud_timeout(), qPrefCloudStorage::cloud_timeout()); + QCOMPARE(qPrefCloudStorage::cloud_timeout(), 25); } #define TEST(METHOD, VALUE) \ diff --git a/tests/testqPrefDisplay.cpp b/tests/testqPrefDisplay.cpp index 32fe1b927..5992b1bf2 100644 --- a/tests/testqPrefDisplay.cpp +++ b/tests/testqPrefDisplay.cpp @@ -154,15 +154,13 @@ void TestQPrefDisplay::test_struct_disk() void TestQPrefDisplay::test_multiple() { // test multiple instances have the same information - auto display_direct = qPrefDisplay::instance(); prefs.divelist_font = copy_qstring("comic"); - auto display = qPrefDisplay::instance(); prefs.font_size = 15.0; - QCOMPARE(display->divelist_font(), display_direct->divelist_font()); + QCOMPARE(display->divelist_font(), qPrefDisplay::divelist_font()); QCOMPARE(display->divelist_font(), QString("comic")); - QCOMPARE(display->font_size(), display_direct->font_size()); + QCOMPARE(display->font_size(), qPrefDisplay::font_size()); QCOMPARE(display->font_size(), 15.0); } diff --git a/tests/testqPrefDiveComputer.cpp b/tests/testqPrefDiveComputer.cpp index fff589c17..36967bea6 100644 --- a/tests/testqPrefDiveComputer.cpp +++ b/tests/testqPrefDiveComputer.cpp @@ -101,12 +101,11 @@ void TestQPrefDiveComputer::test_struct_disk() void TestQPrefDiveComputer::test_multiple() { // test multiple instances have the same information - auto tst_direct = new qPrefDiveComputer; auto tst = qPrefDiveComputer::instance(); prefs.dive_computer.device = copy_qstring("mine"); - QCOMPARE(tst->device(), tst_direct->device()); + QCOMPARE(tst->device(), qPrefDiveComputer::device()); QCOMPARE(tst->device(), QString("mine")); } diff --git a/tests/testqPrefDivePlanner.cpp b/tests/testqPrefDivePlanner.cpp index 55cbb9348..48583cc26 100644 --- a/tests/testqPrefDivePlanner.cpp +++ b/tests/testqPrefDivePlanner.cpp @@ -312,17 +312,14 @@ void TestQPrefDivePlanner::test_multiple() { // test multiple instances have the same information - prefs.sacfactor = 22; prefs.safetystop = true; - auto tst_direct = new qPrefDivePlanner; - prefs.sacfactor = 32; auto tst = qPrefDivePlanner::instance(); - QCOMPARE(tst->sacfactor(), tst_direct->sacfactor()); - QCOMPARE(tst->safetystop(), tst_direct->safetystop()); - QCOMPARE(tst_direct->sacfactor(), 32); - QCOMPARE(tst_direct->safetystop(), true); + QCOMPARE(tst->sacfactor(), qPrefDivePlanner::sacfactor()); + QCOMPARE(tst->safetystop(), qPrefDivePlanner::safetystop()); + QCOMPARE(qPrefDivePlanner::sacfactor(), 32); + QCOMPARE(qPrefDivePlanner::safetystop(), true); } #define TEST(METHOD, VALUE) \ diff --git a/tests/testqPrefGeneral.cpp b/tests/testqPrefGeneral.cpp index 0265fb59c..29ff6a811 100644 --- a/tests/testqPrefGeneral.cpp +++ b/tests/testqPrefGeneral.cpp @@ -181,15 +181,13 @@ void TestQPrefGeneral::test_multiple() // test multiple instances have the same information prefs.o2consumption = 17; - auto tst_direct = new qPrefGeneral; - prefs.pscr_ratio = 18; auto tst = qPrefGeneral::instance(); - QCOMPARE(tst->o2consumption(), tst_direct->o2consumption()); - QCOMPARE(tst->pscr_ratio(), tst_direct->pscr_ratio()); - QCOMPARE(tst_direct->o2consumption(), 17); - QCOMPARE(tst_direct->pscr_ratio(), 18); + QCOMPARE(tst->o2consumption(), qPrefGeneral::o2consumption()); + QCOMPARE(tst->pscr_ratio(), qPrefGeneral::pscr_ratio()); + QCOMPARE(qPrefGeneral::o2consumption(), 17); + QCOMPARE(qPrefGeneral::pscr_ratio(), 18); } #define TEST(METHOD, VALUE) \ diff --git a/tests/testqPrefGeocoding.cpp b/tests/testqPrefGeocoding.cpp index aec602339..ff936a069 100644 --- a/tests/testqPrefGeocoding.cpp +++ b/tests/testqPrefGeocoding.cpp @@ -93,13 +93,11 @@ void TestQPrefGeocoding::test_multiple() // test multiple instances have the same information prefs.geocoding.category[0] = TC_NONE; - auto tst_direct = new qPrefGeocoding; - prefs.geocoding.category[1] = TC_OCEAN; auto tst = qPrefGeocoding::instance(); - QCOMPARE(tst->first_taxonomy_category(), tst_direct->first_taxonomy_category()); - QCOMPARE(tst->second_taxonomy_category(), tst_direct->second_taxonomy_category()); + QCOMPARE(tst->first_taxonomy_category(), qPrefGeocoding::first_taxonomy_category()); + QCOMPARE(tst->second_taxonomy_category(), qPrefGeocoding::second_taxonomy_category()); QCOMPARE(tst->first_taxonomy_category(), TC_NONE); QCOMPARE(tst->second_taxonomy_category(), TC_OCEAN); } diff --git a/tests/testqPrefLanguage.cpp b/tests/testqPrefLanguage.cpp index 96caebd0f..6a5ac1e92 100644 --- a/tests/testqPrefLanguage.cpp +++ b/tests/testqPrefLanguage.cpp @@ -141,15 +141,14 @@ void TestQPrefLanguage::test_multiple() // test multiple instances have the same information prefs.locale.use_system_language = false; - auto tst_direct = new qPrefLanguage; prefs.time_format_override = true; auto tst = qPrefLanguage::instance(); - QCOMPARE(tst->use_system_language(), tst_direct->use_system_language()); - QCOMPARE(tst->time_format_override(), tst_direct->time_format_override()); - QCOMPARE(tst_direct->use_system_language(), false); - QCOMPARE(tst_direct->time_format_override(), true); + QCOMPARE(tst->use_system_language(), qPrefLanguage::use_system_language()); + QCOMPARE(tst->time_format_override(), qPrefLanguage::time_format_override()); + QCOMPARE(qPrefLanguage::use_system_language(), false); + QCOMPARE(qPrefLanguage::time_format_override(), true); } #define TEST(METHOD, VALUE) \ diff --git a/tests/testqPrefLocationService.cpp b/tests/testqPrefLocationService.cpp index 4e0d410cb..43c438003 100644 --- a/tests/testqPrefLocationService.cpp +++ b/tests/testqPrefLocationService.cpp @@ -81,15 +81,13 @@ void TestQPrefLocationService::test_multiple() // test multiple instances have the same information prefs.distance_threshold = 52; - auto tst_direct = new qPrefLocationService; - prefs.time_threshold = 62; auto tst = qPrefLocationService::instance(); - QCOMPARE(tst->distance_threshold(), tst_direct->distance_threshold()); - QCOMPARE(tst->time_threshold(), tst_direct->time_threshold()); - QCOMPARE(tst_direct->distance_threshold(), 52); - QCOMPARE(tst_direct->time_threshold(), 62); + QCOMPARE(tst->distance_threshold(), qPrefLocationService::distance_threshold()); + QCOMPARE(tst->time_threshold(), qPrefLocationService::time_threshold()); + QCOMPARE(qPrefLocationService::distance_threshold(), 52); + QCOMPARE(qPrefLocationService::time_threshold(), 62); } #define TEST(METHOD, VALUE) \ diff --git a/tests/testqPrefPartialPressureGas.cpp b/tests/testqPrefPartialPressureGas.cpp index fa68270e9..15fa478b9 100644 --- a/tests/testqPrefPartialPressureGas.cpp +++ b/tests/testqPrefPartialPressureGas.cpp @@ -131,15 +131,13 @@ void TestQPrefPartialPressureGas::test_multiple() // test multiple instances have the same information prefs.pp_graphs.phe_threshold = 2.2; - auto tst_direct = new qPrefPartialPressureGas; - prefs.pp_graphs.pn2_threshold = 2.3; auto tst = qPrefPartialPressureGas::instance(); - QCOMPARE(tst->phe_threshold(), tst_direct->phe_threshold()); - QCOMPARE(tst->pn2_threshold(), tst_direct->pn2_threshold()); - QCOMPARE(tst_direct->phe_threshold(), 2.2); - QCOMPARE(tst_direct->pn2_threshold(), 2.3); + QCOMPARE(tst->phe_threshold(), qPrefPartialPressureGas::phe_threshold()); + QCOMPARE(tst->pn2_threshold(), qPrefPartialPressureGas::pn2_threshold()); + QCOMPARE(qPrefPartialPressureGas::phe_threshold(), 2.2); + QCOMPARE(qPrefPartialPressureGas::pn2_threshold(), 2.3); } #define TEST(METHOD, VALUE) \ diff --git a/tests/testqPrefProxy.cpp b/tests/testqPrefProxy.cpp index 0568cd7b5..196a8c6d3 100644 --- a/tests/testqPrefProxy.cpp +++ b/tests/testqPrefProxy.cpp @@ -122,14 +122,12 @@ void TestQPrefProxy::test_multiple() // test multiple instances have the same information prefs.proxy_port= 37; - auto tst_direct = new qPrefProxy; - prefs.proxy_type = 25; auto tst = qPrefProxy::instance(); - QCOMPARE(tst->proxy_port(), tst_direct->proxy_port()); + QCOMPARE(tst->proxy_port(), qPrefProxy::proxy_port()); QCOMPARE(tst->proxy_port(), 37); - QCOMPARE(tst->proxy_type(), tst_direct->proxy_type()); + QCOMPARE(tst->proxy_type(), qPrefProxy::proxy_type()); QCOMPARE(tst->proxy_type(), 25); } diff --git a/tests/testqPrefTechnicalDetails.cpp b/tests/testqPrefTechnicalDetails.cpp index a0b70f7fb..9b6d88a45 100644 --- a/tests/testqPrefTechnicalDetails.cpp +++ b/tests/testqPrefTechnicalDetails.cpp @@ -329,15 +329,13 @@ void TestQPrefTechnicalDetails::test_multiple() // test multiple instances have the same information prefs.gfhigh = 27; - auto tst_direct = new qPrefTechnicalDetails; - prefs.gflow = 25; auto tst = qPrefTechnicalDetails::instance(); - QCOMPARE(tst->gfhigh(), tst_direct->gfhigh()); - QCOMPARE(tst->gflow(), tst_direct->gflow()); - QCOMPARE(tst_direct->gfhigh(), 27); - QCOMPARE(tst_direct->gflow(), 25); + QCOMPARE(tst->gfhigh(), qPrefTechnicalDetails::gfhigh()); + QCOMPARE(tst->gflow(), qPrefTechnicalDetails::gflow()); + QCOMPARE(qPrefTechnicalDetails::gfhigh(), 27); + QCOMPARE(qPrefTechnicalDetails::gflow(), 25); } #define TEST(METHOD, VALUE) \ diff --git a/tests/testqPrefUnits.cpp b/tests/testqPrefUnits.cpp index 122a35ce9..decae35a8 100644 --- a/tests/testqPrefUnits.cpp +++ b/tests/testqPrefUnits.cpp @@ -152,14 +152,13 @@ void TestQPrefUnits::test_multiple() // test multiple instances have the same information prefs.units.length = units::METERS; - auto tst_direct = new qPrefUnits; prefs.units.pressure = units::BAR; auto tst = qPrefUnits::instance(); - QCOMPARE(tst->length(), tst_direct->length()); + QCOMPARE(tst->length(), qPrefUnits::length()); QCOMPARE(tst->length(), units::METERS); - QCOMPARE(tst->pressure(), tst_direct->pressure()); + QCOMPARE(tst->pressure(), qPrefUnits::pressure()); QCOMPARE(tst->pressure(), units::BAR); } diff --git a/tests/testqPrefUpdateManager.cpp b/tests/testqPrefUpdateManager.cpp index 259813cbe..8e3047fdb 100644 --- a/tests/testqPrefUpdateManager.cpp +++ b/tests/testqPrefUpdateManager.cpp @@ -114,15 +114,14 @@ void TestQPrefUpdateManager::test_multiple() // test multiple instances have the same information prefs.update_manager.dont_check_for_updates = false; - auto tst_direct = new qPrefUpdateManager; prefs.update_manager.dont_check_exists = false; auto tst = qPrefUpdateManager::instance(); - QCOMPARE(tst->dont_check_for_updates(), tst_direct->dont_check_for_updates()); + QCOMPARE(tst->dont_check_for_updates(), qPrefUpdateManager::dont_check_for_updates()); QCOMPARE(tst->dont_check_for_updates(), false); - QCOMPARE(tst->dont_check_exists(), tst_direct->dont_check_exists()); - QCOMPARE(tst_direct->dont_check_exists(), false); + QCOMPARE(tst->dont_check_exists(), qPrefUpdateManager::dont_check_exists()); + QCOMPARE(qPrefUpdateManager::dont_check_exists(), false); } void TestQPrefUpdateManager::test_next_check() |