mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
54f8217eec
commit
6e846eb4c0
13 changed files with 38 additions and 61 deletions
|
@ -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) \
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue