mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
preferences: use std::string in struct preferences
This is a messy commit, because the "qPref" system relies heavily on QString, which means lots of conversions between the two worlds. Ultimately, I plan to base the preferences system on std::string and only convert to QString when pushing through Qt's property system or when writing into Qt's settings. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
82fc9de40b
commit
ccdd92aeb7
78 changed files with 645 additions and 694 deletions
|
|
@ -14,7 +14,7 @@ void TestAirPressure::initTestCase()
|
|||
{
|
||||
/* we need to manually tell that the resource exists, because we are using it as library. */
|
||||
Q_INIT_RESOURCE(subsurface);
|
||||
prefs.cloud_base_url = strdup(default_prefs.cloud_base_url);
|
||||
prefs.cloud_base_url = default_prefs.cloud_base_url;
|
||||
}
|
||||
|
||||
void TestAirPressure::get_dives()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
void TestDiveSiteDuplication::testReadV2()
|
||||
{
|
||||
prefs.cloud_base_url = strdup(default_prefs.cloud_base_url);
|
||||
prefs.cloud_base_url = default_prefs.cloud_base_url;
|
||||
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/TwoTimesTwo.ssrf", &divelog), 0);
|
||||
QCOMPARE(divelog.sites.size(), 2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ void TestGitStorage::initTestCase()
|
|||
QTextCodec::setCodecForLocale(QTextCodec::codecForMib(106));
|
||||
|
||||
// first, setup the preferences an proxy information
|
||||
copy_prefs(&default_prefs, &prefs);
|
||||
prefs = default_prefs;
|
||||
QCoreApplication::setOrganizationName("Subsurface");
|
||||
QCoreApplication::setOrganizationDomain("subsurface.hohndel.org");
|
||||
QCoreApplication::setApplicationName("Subsurface");
|
||||
|
|
@ -108,8 +108,8 @@ void TestGitStorage::initTestCase()
|
|||
if (gitUrl.empty() || gitUrl.back() != '/')
|
||||
gitUrl += "/";
|
||||
gitUrl += "git";
|
||||
prefs.cloud_storage_email_encoded = strdup(email.c_str());
|
||||
prefs.cloud_storage_password = strdup(password.c_str());
|
||||
prefs.cloud_storage_email_encoded = email;
|
||||
prefs.cloud_storage_password = password.c_str();
|
||||
gitUrl += "/" + email;
|
||||
// all user storage for historical reasons always uses the user's email both as
|
||||
// repo name and as branch. To allow us to keep testing and not step on parallel
|
||||
|
|
@ -138,11 +138,11 @@ void TestGitStorage::initTestCase()
|
|||
// make sure we deal with any proxy settings that are needed
|
||||
QNetworkProxy proxy;
|
||||
proxy.setType(QNetworkProxy::ProxyType(prefs.proxy_type));
|
||||
proxy.setHostName(prefs.proxy_host);
|
||||
proxy.setHostName(QString::fromStdString(prefs.proxy_host));
|
||||
proxy.setPort(prefs.proxy_port);
|
||||
if (prefs.proxy_auth) {
|
||||
proxy.setUser(prefs.proxy_user);
|
||||
proxy.setPassword(prefs.proxy_pass);
|
||||
proxy.setUser(QString::fromStdString(prefs.proxy_user));
|
||||
proxy.setPassword(QString::fromStdString(prefs.proxy_pass));
|
||||
}
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ void TestMerge::initTestCase()
|
|||
{
|
||||
/* we need to manually tell that the resource exists, because we are using it as library. */
|
||||
Q_INIT_RESOURCE(subsurface);
|
||||
copy_prefs(&default_prefs, &prefs);
|
||||
prefs = default_prefs;
|
||||
}
|
||||
|
||||
void TestMerge::cleanup()
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void TestParse::initTestCase()
|
|||
{
|
||||
/* we need to manually tell that the resource exists, because we are using it as library. */
|
||||
Q_INIT_RESOURCE(subsurface);
|
||||
copy_prefs(&default_prefs, &prefs);
|
||||
prefs = default_prefs;
|
||||
}
|
||||
|
||||
void TestParse::init()
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ void TestParsePerformance::initTestCase()
|
|||
QTextCodec::setCodecForLocale(QTextCodec::codecForMib(106));
|
||||
|
||||
// first, setup the preferences an proxy information
|
||||
copy_prefs(&default_prefs, &prefs);
|
||||
prefs = default_prefs;
|
||||
QCoreApplication::setOrganizationName("Subsurface");
|
||||
QCoreApplication::setOrganizationDomain("subsurface.hohndel.org");
|
||||
QCoreApplication::setApplicationName("Subsurface");
|
||||
|
|
@ -33,11 +33,11 @@ void TestParsePerformance::initTestCase()
|
|||
|
||||
QNetworkProxy proxy;
|
||||
proxy.setType(QNetworkProxy::ProxyType(prefs.proxy_type));
|
||||
proxy.setHostName(prefs.proxy_host);
|
||||
proxy.setHostName(QString::fromStdString(prefs.proxy_host));
|
||||
proxy.setPort(prefs.proxy_port);
|
||||
if (prefs.proxy_auth) {
|
||||
proxy.setUser(prefs.proxy_user);
|
||||
proxy.setPassword(prefs.proxy_pass);
|
||||
proxy.setUser(QString::fromStdString(prefs.proxy_user));
|
||||
proxy.setPassword(QString::fromStdString(prefs.proxy_pass));
|
||||
}
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ void TestPicture::initTestCase()
|
|||
{
|
||||
/* we need to manually tell that the resource exists, because we are using it as library. */
|
||||
Q_INIT_RESOURCE(subsurface);
|
||||
prefs.cloud_base_url = strdup(default_prefs.cloud_base_url);
|
||||
prefs.cloud_base_url = default_prefs.cloud_base_url;
|
||||
}
|
||||
|
||||
#define PIC1_NAME "/dives/images/wreck.jpg"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ static struct deco_state test_deco_state;
|
|||
extern bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, int dcNr, int timestep, struct decostop *decostoptable, deco_state_cache &cache, bool is_planner, bool show_disclaimer);
|
||||
void setupPrefs()
|
||||
{
|
||||
copy_prefs(&default_prefs, &prefs);
|
||||
prefs = default_prefs;
|
||||
prefs.ascrate50 = feet_to_mm(30) / 60;
|
||||
prefs.ascrate75 = prefs.ascrate50;
|
||||
prefs.ascratestops = prefs.ascrate50;
|
||||
|
|
@ -28,7 +28,7 @@ void setupPrefs()
|
|||
|
||||
void setupPrefsVpmb()
|
||||
{
|
||||
copy_prefs(&default_prefs, &prefs);
|
||||
prefs = default_prefs;
|
||||
prefs.ascrate50 = 10000 / 60;
|
||||
prefs.ascrate75 = prefs.ascrate50;
|
||||
prefs.ascratestops = prefs.ascrate50;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ void TestProfile::init()
|
|||
QTextCodec::setCodecForLocale(QTextCodec::codecForMib(106));
|
||||
|
||||
// first, setup the preferences
|
||||
copy_prefs(&default_prefs, &prefs);
|
||||
prefs = default_prefs;
|
||||
|
||||
QCoreApplication::setOrganizationName("Subsurface");
|
||||
QCoreApplication::setOrganizationDomain("subsurface.hohndel.org");
|
||||
|
|
|
|||
|
|
@ -22,21 +22,21 @@ void TestQPrefCloudStorage::test_struct_get()
|
|||
auto tst = qPrefCloudStorage::instance();
|
||||
|
||||
prefs.cloud_auto_sync = true;
|
||||
prefs.cloud_base_url = copy_qstring("new url");
|
||||
prefs.cloud_storage_email = copy_qstring("myEmail");
|
||||
prefs.cloud_storage_email_encoded = copy_qstring("encodedMyEMail");
|
||||
prefs.cloud_storage_password = copy_qstring("more secret");
|
||||
prefs.cloud_storage_pin = copy_qstring("a pin");
|
||||
prefs.cloud_base_url = "new url";
|
||||
prefs.cloud_storage_email = "myEmail";
|
||||
prefs.cloud_storage_email_encoded = "encodedMyEMail";
|
||||
prefs.cloud_storage_password = "more secret";
|
||||
prefs.cloud_storage_pin = "a pin";
|
||||
prefs.cloud_timeout = 117;
|
||||
prefs.cloud_verification_status = qPrefCloudStorage::CS_NOCLOUD;
|
||||
prefs.save_password_local = true;
|
||||
|
||||
QCOMPARE(tst->cloud_auto_sync(), prefs.cloud_auto_sync);
|
||||
QCOMPARE(tst->cloud_base_url(), QString(prefs.cloud_base_url));
|
||||
QCOMPARE(tst->cloud_storage_email(), QString(prefs.cloud_storage_email));
|
||||
QCOMPARE(tst->cloud_storage_email_encoded(), QString(prefs.cloud_storage_email_encoded));
|
||||
QCOMPARE(tst->cloud_storage_password(), QString(prefs.cloud_storage_password));
|
||||
QCOMPARE(tst->cloud_storage_pin(), QString(prefs.cloud_storage_pin));
|
||||
QCOMPARE(tst->cloud_base_url(), QString::fromStdString(prefs.cloud_base_url));
|
||||
QCOMPARE(tst->cloud_storage_email(), QString::fromStdString(prefs.cloud_storage_email));
|
||||
QCOMPARE(tst->cloud_storage_email_encoded(), QString::fromStdString(prefs.cloud_storage_email_encoded));
|
||||
QCOMPARE(tst->cloud_storage_password(), QString::fromStdString(prefs.cloud_storage_password));
|
||||
QCOMPARE(tst->cloud_storage_pin(), QString::fromStdString(prefs.cloud_storage_pin));
|
||||
QCOMPARE(tst->cloud_timeout(), (int)prefs.cloud_timeout);
|
||||
QCOMPARE(tst->cloud_verification_status(), (int)prefs.cloud_verification_status);
|
||||
QCOMPARE(tst->save_password_local(), prefs.save_password_local);
|
||||
|
|
@ -59,11 +59,11 @@ void TestQPrefCloudStorage::test_set_struct()
|
|||
tst->set_save_password_local(false);
|
||||
|
||||
QCOMPARE(prefs.cloud_auto_sync, false);
|
||||
QCOMPARE(QString(prefs.cloud_base_url), QString("t2 base"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_email), QString("t2 email"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_email_encoded), QString("t2 email2"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_password), QString("t2 pass2"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_pin), QString("t2 pin"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_base_url), QString("t2 base"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_email), QString("t2 email"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_email_encoded), QString("t2 email2"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_password), QString("t2 pass2"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_pin), QString("t2 pin"));
|
||||
QCOMPARE((int)prefs.cloud_timeout, 123);
|
||||
QCOMPARE((int)prefs.cloud_verification_status, (int)qPrefCloudStorage::CS_VERIFIED);
|
||||
QCOMPARE(prefs.save_password_local, false);
|
||||
|
|
@ -87,22 +87,22 @@ void TestQPrefCloudStorage::test_set_load_struct()
|
|||
tst->set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD);
|
||||
|
||||
prefs.cloud_auto_sync = false;
|
||||
prefs.cloud_base_url = copy_qstring("error1");
|
||||
prefs.cloud_storage_email = copy_qstring("error1");
|
||||
prefs.cloud_storage_email_encoded = copy_qstring("error1");
|
||||
prefs.cloud_storage_password = copy_qstring("error1");
|
||||
prefs.cloud_storage_pin = copy_qstring("error1");
|
||||
prefs.cloud_base_url = "error1";
|
||||
prefs.cloud_storage_email = "error1";
|
||||
prefs.cloud_storage_email_encoded = "error1";
|
||||
prefs.cloud_storage_password = "error1";
|
||||
prefs.cloud_storage_pin = "error1";
|
||||
prefs.cloud_timeout = 324;
|
||||
prefs.cloud_verification_status = qPrefCloudStorage::CS_VERIFIED;
|
||||
prefs.save_password_local = false;
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(prefs.cloud_auto_sync, true);
|
||||
QCOMPARE(QString(prefs.cloud_base_url), QString("t3 base"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_email), QString("t3 email"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_email_encoded), QString("t3 email2"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_password), QString("t3 pass2"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_pin), QString("t3 pin"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_base_url), QString("t3 base"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_email), QString("t3 email"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_email_encoded), QString("t3 email2"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_password), QString("t3 pass2"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_pin), QString("t3 pin"));
|
||||
QCOMPARE((int)prefs.cloud_timeout, 321);
|
||||
QCOMPARE((int)prefs.cloud_verification_status, (int)qPrefCloudStorage::CS_NOCLOUD);
|
||||
QCOMPARE(prefs.save_password_local, true);
|
||||
|
|
@ -114,25 +114,25 @@ void TestQPrefCloudStorage::test_struct_disk()
|
|||
|
||||
auto tst = qPrefCloudStorage::instance();
|
||||
|
||||
prefs.cloud_base_url = copy_qstring("t4 base");
|
||||
prefs.cloud_base_url = "t4 base";
|
||||
tst->store_cloud_base_url("t4 base"); // the base URL is no longer automatically saved to disk
|
||||
prefs.cloud_storage_email = copy_qstring("t4 email");
|
||||
prefs.cloud_storage_email_encoded = copy_qstring("t4 email2");
|
||||
prefs.cloud_storage_email =("t4 email");
|
||||
prefs.cloud_storage_email_encoded = "t4 email2";
|
||||
prefs.save_password_local = true;
|
||||
prefs.cloud_auto_sync = true;
|
||||
prefs.cloud_storage_password = copy_qstring("t4 pass2");
|
||||
prefs.cloud_storage_pin = copy_qstring("t4 pin");
|
||||
prefs.cloud_storage_password = "t4 pass2";
|
||||
prefs.cloud_storage_pin = "t4 pin";
|
||||
prefs.cloud_timeout = 123;
|
||||
prefs.cloud_verification_status = qPrefCloudStorage::CS_VERIFIED;
|
||||
|
||||
tst->sync();
|
||||
|
||||
prefs.cloud_auto_sync = false;
|
||||
prefs.cloud_base_url = copy_qstring("error1");
|
||||
prefs.cloud_storage_email = copy_qstring("error1");
|
||||
prefs.cloud_storage_email_encoded = copy_qstring("error1");
|
||||
prefs.cloud_storage_password = copy_qstring("error1");
|
||||
prefs.cloud_storage_pin = copy_qstring("error1");
|
||||
prefs.cloud_base_url = "error1";
|
||||
prefs.cloud_storage_email = "error1";
|
||||
prefs.cloud_storage_email_encoded = "error1";
|
||||
prefs.cloud_storage_password = "error1";
|
||||
prefs.cloud_storage_pin = "error1";
|
||||
prefs.cloud_timeout = 324;
|
||||
prefs.cloud_verification_status = qPrefCloudStorage::CS_VERIFIED;
|
||||
prefs.save_password_local = false;
|
||||
|
|
@ -140,11 +140,11 @@ void TestQPrefCloudStorage::test_struct_disk()
|
|||
tst->load();
|
||||
|
||||
QCOMPARE(prefs.cloud_auto_sync, true);
|
||||
QCOMPARE(QString(prefs.cloud_base_url), QString("t4 base"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_email), QString("t4 email"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_email_encoded), QString("t4 email2"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_password), QString("t4 pass2"));
|
||||
QCOMPARE(QString(prefs.cloud_storage_pin), QString("t4 pin"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_base_url), QString("t4 base"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_email), QString("t4 email"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_email_encoded), QString("t4 email2"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_password), QString("t4 pass2"));
|
||||
QCOMPARE(QString::fromStdString(prefs.cloud_storage_pin), QString("t4 pin"));
|
||||
QCOMPARE((int)prefs.cloud_timeout, 123);
|
||||
QCOMPARE((int)prefs.cloud_verification_status, (int)qPrefCloudStorage::CS_VERIFIED);
|
||||
QCOMPARE(prefs.save_password_local, true);
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@ void TestQPrefDisplay::test_struct_get()
|
|||
|
||||
prefs.animation_speed = 17;
|
||||
prefs.display_invalid_dives = true;
|
||||
prefs.divelist_font = copy_qstring("comic");
|
||||
prefs.divelist_font = "comic";
|
||||
prefs.font_size = 12.0;
|
||||
prefs.show_developer = false;
|
||||
|
||||
QCOMPARE(display->animation_speed(), prefs.animation_speed);
|
||||
QCOMPARE(display->display_invalid_dives(), prefs.display_invalid_dives);
|
||||
QCOMPARE(display->divelist_font(), QString(prefs.divelist_font));
|
||||
QCOMPARE(display->divelist_font(), QString::fromStdString(prefs.divelist_font));
|
||||
QCOMPARE(display->font_size(), prefs.font_size);
|
||||
QCOMPARE(display->show_developer(), prefs.show_developer);
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ void TestQPrefDisplay::test_set_load_struct()
|
|||
|
||||
prefs.animation_speed = 17;
|
||||
prefs.display_invalid_dives = false;
|
||||
prefs.divelist_font = copy_qstring("doNotCareAtAll");
|
||||
prefs.divelist_font = "doNotCareAtAll";
|
||||
prefs.font_size = 12.0;
|
||||
prefs.show_developer = false;
|
||||
|
||||
|
|
@ -131,14 +131,14 @@ void TestQPrefDisplay::test_struct_disk()
|
|||
|
||||
prefs.animation_speed = 27;
|
||||
prefs.display_invalid_dives = true;
|
||||
prefs.divelist_font = copy_qstring("doNotCareAtAll");
|
||||
prefs.divelist_font = "doNotCareAtAll";
|
||||
prefs.font_size = 17.0;
|
||||
prefs.show_developer = false;
|
||||
|
||||
display->sync();
|
||||
prefs.animation_speed = 35;
|
||||
prefs.display_invalid_dives = false;
|
||||
prefs.divelist_font = copy_qstring("noString");
|
||||
prefs.divelist_font = "noString";
|
||||
prefs.font_size = 11.0;
|
||||
prefs.show_developer = true;
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ void TestQPrefDisplay::test_struct_disk()
|
|||
void TestQPrefDisplay::test_multiple()
|
||||
{
|
||||
// test multiple instances have the same information
|
||||
prefs.divelist_font = copy_qstring("comic");
|
||||
prefs.divelist_font = "comic";
|
||||
auto display = qPrefDisplay::instance();
|
||||
prefs.font_size = 15.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@ void TestQPrefDiveComputer::test_struct_get()
|
|||
|
||||
auto tst = qPrefDiveComputer::instance();
|
||||
|
||||
prefs.dive_computer.device = copy_qstring("my device");
|
||||
prefs.dive_computer.device_name = copy_qstring("my device name");
|
||||
prefs.dive_computer.product = copy_qstring("my product");
|
||||
prefs.dive_computer.vendor = copy_qstring("my vendor");
|
||||
prefs.dive_computer.device = "my device";
|
||||
prefs.dive_computer.device_name = "my device name";
|
||||
prefs.dive_computer.product = "my product";
|
||||
prefs.dive_computer.vendor = "my vendor";
|
||||
|
||||
QCOMPARE(tst->device(), QString(prefs.dive_computer.device));
|
||||
QCOMPARE(tst->device_name(), QString(prefs.dive_computer.device_name));
|
||||
QCOMPARE(tst->product(), QString(prefs.dive_computer.product));
|
||||
QCOMPARE(tst->vendor(), QString(prefs.dive_computer.vendor));
|
||||
QCOMPARE(tst->device(), QString::fromStdString(prefs.dive_computer.device));
|
||||
QCOMPARE(tst->device_name(), QString::fromStdString(prefs.dive_computer.device_name));
|
||||
QCOMPARE(tst->product(), QString::fromStdString(prefs.dive_computer.product));
|
||||
QCOMPARE(tst->vendor(), QString::fromStdString(prefs.dive_computer.vendor));
|
||||
}
|
||||
|
||||
void TestQPrefDiveComputer::test_set_struct()
|
||||
|
|
@ -43,10 +43,10 @@ void TestQPrefDiveComputer::test_set_struct()
|
|||
tst->set_product("t2 product");
|
||||
tst->set_vendor("t2 vendor");
|
||||
|
||||
QCOMPARE(QString(prefs.dive_computer.device), QString("t2 device"));
|
||||
QCOMPARE(QString(prefs.dive_computer.device_name), QString("t2 device name"));
|
||||
QCOMPARE(QString(prefs.dive_computer.product), QString("t2 product"));
|
||||
QCOMPARE(QString(prefs.dive_computer.vendor), QString("t2 vendor"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.device), QString("t2 device"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.device_name), QString("t2 device name"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.product), QString("t2 product"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.vendor), QString("t2 vendor"));
|
||||
}
|
||||
|
||||
void TestQPrefDiveComputer::test_set_load_struct()
|
||||
|
|
@ -60,16 +60,16 @@ void TestQPrefDiveComputer::test_set_load_struct()
|
|||
tst->set_product("t3 product");
|
||||
tst->set_vendor("t3 vendor");
|
||||
|
||||
prefs.dive_computer.device = copy_qstring("error1");
|
||||
prefs.dive_computer.device_name = copy_qstring("error2");
|
||||
prefs.dive_computer.product = copy_qstring("error3");
|
||||
prefs.dive_computer.vendor = copy_qstring("error4");
|
||||
prefs.dive_computer.device = "error1";
|
||||
prefs.dive_computer.device_name = "error2";
|
||||
prefs.dive_computer.product = "error3";
|
||||
prefs.dive_computer.vendor = "error4";
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(QString(prefs.dive_computer.device), QString("t3 device"));
|
||||
QCOMPARE(QString(prefs.dive_computer.device_name), QString("t3 device name"));
|
||||
QCOMPARE(QString(prefs.dive_computer.product), QString("t3 product"));
|
||||
QCOMPARE(QString(prefs.dive_computer.vendor), QString("t3 vendor"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.device), QString("t3 device"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.device_name), QString("t3 device name"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.product), QString("t3 product"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.vendor), QString("t3 vendor"));
|
||||
}
|
||||
|
||||
void TestQPrefDiveComputer::test_struct_disk()
|
||||
|
|
@ -78,24 +78,24 @@ void TestQPrefDiveComputer::test_struct_disk()
|
|||
|
||||
auto tst = qPrefDiveComputer::instance();
|
||||
|
||||
prefs.dive_computer.device = copy_qstring("t4 device");
|
||||
prefs.dive_computer.device_name = copy_qstring("t4 device name");
|
||||
prefs.dive_computer.product = copy_qstring("t4 product");
|
||||
prefs.dive_computer.vendor = copy_qstring("t4 vendor");
|
||||
prefs.dive_computer.device = "t4 device";
|
||||
prefs.dive_computer.device_name = "t4 device name";
|
||||
prefs.dive_computer.product = "t4 product";
|
||||
prefs.dive_computer.vendor = "t4 vendor";
|
||||
|
||||
tst->sync();
|
||||
|
||||
prefs.dive_computer.device = copy_qstring("error");
|
||||
prefs.dive_computer.device_name = copy_qstring("error");
|
||||
prefs.dive_computer.product = copy_qstring("error");
|
||||
prefs.dive_computer.vendor = copy_qstring("error");
|
||||
prefs.dive_computer.device = "error";
|
||||
prefs.dive_computer.device_name = "error";
|
||||
prefs.dive_computer.product = "error";
|
||||
prefs.dive_computer.vendor = "error";
|
||||
|
||||
tst->load();
|
||||
|
||||
QCOMPARE(QString(prefs.dive_computer.device), QString("t4 device"));
|
||||
QCOMPARE(QString(prefs.dive_computer.device_name), QString("t4 device name"));
|
||||
QCOMPARE(QString(prefs.dive_computer.product), QString("t4 product"));
|
||||
QCOMPARE(QString(prefs.dive_computer.vendor), QString("t4 vendor"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.device), QString("t4 device"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.device_name), QString("t4 device name"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.product), QString("t4 product"));
|
||||
QCOMPARE(QString::fromStdString(prefs.dive_computer.vendor), QString("t4 vendor"));
|
||||
}
|
||||
|
||||
void TestQPrefDiveComputer::test_multiple()
|
||||
|
|
@ -103,7 +103,7 @@ void TestQPrefDiveComputer::test_multiple()
|
|||
// test multiple instances have the same information
|
||||
|
||||
auto tst = qPrefDiveComputer::instance();
|
||||
prefs.dive_computer.device = copy_qstring("mine");
|
||||
prefs.dive_computer.device = "mine";
|
||||
|
||||
QCOMPARE(tst->device(), qPrefDiveComputer::device());
|
||||
QCOMPARE(tst->device(), QString("mine"));
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ void TestQPrefEquipment::test_struct_get()
|
|||
// Test struct pref -> get func.
|
||||
|
||||
auto tst = qPrefEquipment::instance();
|
||||
prefs.default_cylinder = copy_qstring("new base11");
|
||||
QCOMPARE(tst->default_cylinder(), QString(prefs.default_cylinder));
|
||||
prefs.default_cylinder = "new base11";
|
||||
QCOMPARE(tst->default_cylinder(), QString::fromStdString(prefs.default_cylinder));
|
||||
prefs.include_unused_tanks = true;
|
||||
QCOMPARE(tst->include_unused_tanks(), prefs.include_unused_tanks);
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ void TestQPrefEquipment::test_set_struct()
|
|||
|
||||
auto tst = qPrefEquipment::instance();
|
||||
tst->set_default_cylinder("new base21");
|
||||
QCOMPARE(QString(prefs.default_cylinder), QString("new base21"));
|
||||
QCOMPARE(QString::fromStdString(prefs.default_cylinder), QString("new base21"));
|
||||
tst->set_include_unused_tanks(false);
|
||||
QCOMPARE(prefs.include_unused_tanks, false);
|
||||
}
|
||||
|
|
@ -46,11 +46,11 @@ void TestQPrefEquipment::test_set_load_struct()
|
|||
auto tst = qPrefEquipment::instance();
|
||||
|
||||
tst->set_default_cylinder("new base31");
|
||||
prefs.default_cylinder = copy_qstring("error");
|
||||
prefs.default_cylinder = "error";
|
||||
tst->set_include_unused_tanks(false);
|
||||
prefs.include_unused_tanks = true;
|
||||
tst->load();
|
||||
QCOMPARE(QString(prefs.default_cylinder), QString("new base31"));
|
||||
QCOMPARE(QString::fromStdString(prefs.default_cylinder), QString("new base31"));
|
||||
QCOMPARE(prefs.include_unused_tanks, false);
|
||||
}
|
||||
|
||||
|
|
@ -59,15 +59,15 @@ void TestQPrefEquipment::test_struct_disk()
|
|||
// test struct prefs -> disk
|
||||
|
||||
auto tst = qPrefEquipment::instance();
|
||||
prefs.default_cylinder = copy_qstring("base41");
|
||||
prefs.default_cylinder = "base41";
|
||||
prefs.include_unused_tanks = true;
|
||||
|
||||
tst->sync();
|
||||
prefs.default_cylinder = copy_qstring("error");
|
||||
prefs.default_cylinder = "error";
|
||||
prefs.include_unused_tanks = false;
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(QString(prefs.default_cylinder), QString("base41"));
|
||||
QCOMPARE(QString::fromStdString(prefs.default_cylinder), QString("base41"));
|
||||
QCOMPARE(prefs.include_unused_tanks, true);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,21 +21,21 @@ void TestQPrefLanguage::test_struct_get()
|
|||
|
||||
auto tst = qPrefLanguage::instance();
|
||||
|
||||
prefs.date_format = copy_qstring("new date format");
|
||||
prefs.date_format = "new date format";
|
||||
prefs.date_format_override = true;
|
||||
prefs.date_format_short = copy_qstring("new short format");
|
||||
prefs.locale.language = copy_qstring("new lang format");
|
||||
prefs.locale.lang_locale = copy_qstring("new loc lang format");
|
||||
prefs.time_format = copy_qstring("new time format");
|
||||
prefs.date_format_short = "new short format";
|
||||
prefs.locale.language = "new lang format";
|
||||
prefs.locale.lang_locale = "new loc lang format";
|
||||
prefs.time_format = "new time format";
|
||||
prefs.time_format_override = true;
|
||||
prefs.locale.use_system_language = true;
|
||||
|
||||
QCOMPARE(tst->date_format(), QString(prefs.date_format));
|
||||
QCOMPARE(tst->date_format(), QString::fromStdString(prefs.date_format));
|
||||
QCOMPARE(tst->date_format_override(), prefs.date_format_override);
|
||||
QCOMPARE(tst->date_format_short(), QString(prefs.date_format_short));
|
||||
QCOMPARE(tst->language(), QString(prefs.locale.language));
|
||||
QCOMPARE(tst->lang_locale(), QString(prefs.locale.lang_locale));
|
||||
QCOMPARE(tst->time_format(), QString(prefs.time_format));
|
||||
QCOMPARE(tst->date_format_short(), QString::fromStdString(prefs.date_format_short));
|
||||
QCOMPARE(tst->language(), QString::fromStdString(prefs.locale.language));
|
||||
QCOMPARE(tst->lang_locale(), QString::fromStdString(prefs.locale.lang_locale));
|
||||
QCOMPARE(tst->time_format(), QString::fromStdString(prefs.time_format));
|
||||
QCOMPARE(tst->time_format_override(), prefs.time_format_override);
|
||||
QCOMPARE(tst->use_system_language(), prefs.locale.use_system_language);
|
||||
}
|
||||
|
|
@ -80,22 +80,22 @@ void TestQPrefLanguage::test_set_load_struct()
|
|||
tst->set_time_format_override(true);
|
||||
tst->set_use_system_language(true);
|
||||
|
||||
prefs.date_format = copy_qstring("error3");
|
||||
prefs.date_format = "error3";
|
||||
prefs.date_format_override = false;
|
||||
prefs.date_format_short = copy_qstring("error3");
|
||||
prefs.locale.language = copy_qstring("error3");
|
||||
prefs.locale.lang_locale = copy_qstring("error3");
|
||||
prefs.time_format = copy_qstring("error3");
|
||||
prefs.date_format_short = "error3";
|
||||
prefs.locale.language = "error3";
|
||||
prefs.locale.lang_locale = "error3";
|
||||
prefs.time_format = "error3";
|
||||
prefs.time_format_override = false;
|
||||
prefs.locale.use_system_language = false;
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(QString(prefs.date_format), QString("new date3"));
|
||||
QCOMPARE(QString::fromStdString(prefs.date_format), QString("new date3"));
|
||||
QCOMPARE(prefs.date_format_override, true);
|
||||
QCOMPARE(QString(prefs.date_format_short), QString("new short3"));
|
||||
QCOMPARE(QString(prefs.locale.language), QString("new lang format3"));
|
||||
QCOMPARE(QString(prefs.locale.lang_locale), QString("new loc lang3"));
|
||||
QCOMPARE(QString(prefs.time_format), QString("new time3"));
|
||||
QCOMPARE(QString::fromStdString(prefs.date_format_short), QString("new short3"));
|
||||
QCOMPARE(QString::fromStdString(prefs.locale.language), QString("new lang format3"));
|
||||
QCOMPARE(QString::fromStdString(prefs.locale.lang_locale), QString("new loc lang3"));
|
||||
QCOMPARE(QString::fromStdString(prefs.time_format), QString("new time3"));
|
||||
QCOMPARE(prefs.time_format_override, true);
|
||||
QCOMPARE(prefs.locale.use_system_language, true);
|
||||
}
|
||||
|
|
@ -106,32 +106,32 @@ void TestQPrefLanguage::test_struct_disk()
|
|||
|
||||
auto tst = qPrefLanguage::instance();
|
||||
|
||||
prefs.date_format = copy_qstring("new date format");
|
||||
prefs.date_format = "new date format";
|
||||
prefs.date_format_override = true;
|
||||
prefs.date_format_short = copy_qstring("new short format");
|
||||
prefs.locale.language = copy_qstring("new lang format");
|
||||
prefs.locale.lang_locale = copy_qstring("new loc lang format");
|
||||
prefs.time_format = copy_qstring("new time format");
|
||||
prefs.date_format_short = "new short format";
|
||||
prefs.locale.language = "new lang format";
|
||||
prefs.locale.lang_locale = "new loc lang format";
|
||||
prefs.time_format = "new time format";
|
||||
prefs.time_format_override = true;
|
||||
prefs.locale.use_system_language = true;
|
||||
|
||||
tst->sync();
|
||||
prefs.date_format = copy_qstring("error3");
|
||||
prefs.date_format = "error3";
|
||||
prefs.date_format_override = false;
|
||||
prefs.date_format_short = copy_qstring("error3");
|
||||
prefs.locale.language = copy_qstring("error3");
|
||||
prefs.locale.lang_locale = copy_qstring("error3");
|
||||
prefs.time_format = copy_qstring("error3");
|
||||
prefs.date_format_short = "error3";
|
||||
prefs.locale.language = "error3";
|
||||
prefs.locale.lang_locale = "error3";
|
||||
prefs.time_format = "error3";
|
||||
prefs.time_format_override = false;
|
||||
prefs.locale.use_system_language = false;
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(QString(prefs.date_format), QString("new date format"));
|
||||
QCOMPARE(QString::fromStdString(prefs.date_format), QString("new date format"));
|
||||
QCOMPARE(prefs.date_format_override, true);
|
||||
QCOMPARE(QString(prefs.date_format_short), QString("new short format"));
|
||||
QCOMPARE(QString(prefs.locale.language), QString("new lang format"));
|
||||
QCOMPARE(QString(prefs.locale.lang_locale), QString("new loc lang format"));
|
||||
QCOMPARE(QString(prefs.time_format), QString("new time format"));
|
||||
QCOMPARE(QString::fromStdString(prefs.date_format_short), QString("new short format"));
|
||||
QCOMPARE(QString::fromStdString(prefs.locale.language), QString("new lang format"));
|
||||
QCOMPARE(QString::fromStdString(prefs.locale.lang_locale), QString("new loc lang format"));
|
||||
QCOMPARE(QString::fromStdString(prefs.time_format), QString("new time format"));
|
||||
QCOMPARE(prefs.time_format_override, true);
|
||||
QCOMPARE(prefs.locale.use_system_language, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@ void TestQPrefLog::test_struct_get()
|
|||
|
||||
auto tst = qPrefLog::instance();
|
||||
|
||||
prefs.default_filename = copy_qstring("new base12");
|
||||
prefs.default_filename = "new base12";
|
||||
prefs.default_file_behavior = UNDEFINED_DEFAULT_FILE;
|
||||
prefs.use_default_file = true;
|
||||
prefs.show_average_depth = true;
|
||||
prefs.extraEnvironmentalDefault = true;
|
||||
|
||||
QCOMPARE(tst->default_filename(), QString(prefs.default_filename));
|
||||
QCOMPARE(tst->default_filename(), QString::fromStdString(prefs.default_filename));
|
||||
QCOMPARE(tst->default_file_behavior(), prefs.default_file_behavior);
|
||||
QCOMPARE(tst->use_default_file(), prefs.use_default_file);
|
||||
QCOMPARE(tst->show_average_depth(), prefs.show_average_depth);
|
||||
|
|
@ -48,7 +48,7 @@ void TestQPrefLog::test_set_struct()
|
|||
tst->set_show_average_depth(false);
|
||||
tst->set_extraEnvironmentalDefault(false);
|
||||
|
||||
QCOMPARE(QString(prefs.default_filename), QString("new base22"));
|
||||
QCOMPARE(QString::fromStdString(prefs.default_filename), QString("new base22"));
|
||||
QCOMPARE(prefs.default_file_behavior, LOCAL_DEFAULT_FILE);
|
||||
QCOMPARE(prefs.use_default_file, false);
|
||||
QCOMPARE(prefs.show_average_depth, false);
|
||||
|
|
@ -67,14 +67,14 @@ void TestQPrefLog::test_set_load_struct()
|
|||
tst->set_show_average_depth(true);
|
||||
tst->set_extraEnvironmentalDefault(true);
|
||||
|
||||
prefs.default_filename = copy_qstring("error");
|
||||
prefs.default_filename = "error";
|
||||
prefs.default_file_behavior = UNDEFINED_DEFAULT_FILE;
|
||||
prefs.use_default_file = false;
|
||||
prefs.show_average_depth = false;
|
||||
prefs.extraEnvironmentalDefault = false;
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(QString(prefs.default_filename), QString("new base32"));
|
||||
QCOMPARE(QString::fromStdString(prefs.default_filename), QString("new base32"));
|
||||
QCOMPARE(prefs.default_file_behavior, NO_DEFAULT_FILE);
|
||||
QCOMPARE(prefs.use_default_file, true);
|
||||
QCOMPARE(prefs.show_average_depth, true);
|
||||
|
|
@ -87,21 +87,21 @@ void TestQPrefLog::test_struct_disk()
|
|||
|
||||
auto tst = qPrefLog::instance();
|
||||
|
||||
prefs.default_filename = copy_qstring("base42");
|
||||
prefs.default_filename = "base42";
|
||||
prefs.default_file_behavior = CLOUD_DEFAULT_FILE;
|
||||
prefs.use_default_file = true;
|
||||
prefs.show_average_depth = true;
|
||||
prefs.extraEnvironmentalDefault = true;
|
||||
|
||||
tst->sync();
|
||||
prefs.default_filename = copy_qstring("error");
|
||||
prefs.default_filename = "error";
|
||||
prefs.default_file_behavior = UNDEFINED_DEFAULT_FILE;
|
||||
prefs.use_default_file = false;
|
||||
prefs.show_average_depth = false;
|
||||
prefs.extraEnvironmentalDefault = false;
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(QString(prefs.default_filename), QString("base42"));
|
||||
QCOMPARE(QString::fromStdString(prefs.default_filename), QString("base42"));
|
||||
QCOMPARE(prefs.default_file_behavior, CLOUD_DEFAULT_FILE);
|
||||
QCOMPARE(prefs.use_default_file, true);
|
||||
QCOMPARE(prefs.show_average_depth, true);
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ void TestQPrefMedia::test_struct_get()
|
|||
prefs.auto_recalculate_thumbnails = true;
|
||||
prefs.extract_video_thumbnails = true;
|
||||
prefs.extract_video_thumbnails_position = 15;
|
||||
prefs.ffmpeg_executable = copy_qstring("new base16");
|
||||
prefs.ffmpeg_executable = "new base16";
|
||||
|
||||
QCOMPARE(tst->auto_recalculate_thumbnails(), prefs.auto_recalculate_thumbnails);
|
||||
QCOMPARE(tst->extract_video_thumbnails(), prefs.extract_video_thumbnails);
|
||||
QCOMPARE(tst->extract_video_thumbnails_position(), prefs.extract_video_thumbnails_position);
|
||||
QCOMPARE(tst->ffmpeg_executable(), QString(prefs.ffmpeg_executable));
|
||||
QCOMPARE(tst->ffmpeg_executable(), QString::fromStdString(prefs.ffmpeg_executable));
|
||||
}
|
||||
|
||||
void TestQPrefMedia::test_set_struct()
|
||||
|
|
@ -48,7 +48,7 @@ void TestQPrefMedia::test_set_struct()
|
|||
QCOMPARE(prefs.auto_recalculate_thumbnails, false);
|
||||
QCOMPARE(prefs.extract_video_thumbnails, false);
|
||||
QCOMPARE(prefs.extract_video_thumbnails_position, 25);
|
||||
QCOMPARE(QString(prefs.ffmpeg_executable), QString("new base26"));
|
||||
QCOMPARE(QString::fromStdString(prefs.ffmpeg_executable), QString("new base26"));
|
||||
}
|
||||
|
||||
void TestQPrefMedia::test_set_load_struct()
|
||||
|
|
@ -65,13 +65,13 @@ void TestQPrefMedia::test_set_load_struct()
|
|||
prefs.auto_recalculate_thumbnails = false;
|
||||
prefs.extract_video_thumbnails = false;
|
||||
prefs.extract_video_thumbnails_position = 15;
|
||||
prefs.ffmpeg_executable = copy_qstring("error");
|
||||
prefs.ffmpeg_executable = "error";
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(prefs.auto_recalculate_thumbnails, true);
|
||||
QCOMPARE(prefs.extract_video_thumbnails, true);
|
||||
QCOMPARE(prefs.extract_video_thumbnails_position, 35);
|
||||
QCOMPARE(QString(prefs.ffmpeg_executable), QString("new base36"));
|
||||
QCOMPARE(QString::fromStdString(prefs.ffmpeg_executable), QString("new base36"));
|
||||
}
|
||||
|
||||
void TestQPrefMedia::test_struct_disk()
|
||||
|
|
@ -83,19 +83,19 @@ void TestQPrefMedia::test_struct_disk()
|
|||
prefs.auto_recalculate_thumbnails = true;
|
||||
prefs.extract_video_thumbnails = true;
|
||||
prefs.extract_video_thumbnails_position = 45;
|
||||
prefs.ffmpeg_executable = copy_qstring("base46");
|
||||
prefs.ffmpeg_executable = "base46";
|
||||
|
||||
tst->sync();
|
||||
prefs.auto_recalculate_thumbnails = false;
|
||||
prefs.extract_video_thumbnails = false;
|
||||
prefs.extract_video_thumbnails_position = 15;
|
||||
prefs.ffmpeg_executable = copy_qstring("error");
|
||||
prefs.ffmpeg_executable = "error";
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(prefs.auto_recalculate_thumbnails, true);
|
||||
QCOMPARE(prefs.extract_video_thumbnails, true);
|
||||
QCOMPARE(prefs.extract_video_thumbnails_position, 45);
|
||||
QCOMPARE(QString(prefs.ffmpeg_executable), QString("base46"));
|
||||
QCOMPARE(QString::fromStdString(prefs.ffmpeg_executable), QString("base46"));
|
||||
}
|
||||
|
||||
#define TEST(METHOD, VALUE) \
|
||||
|
|
|
|||
|
|
@ -22,18 +22,18 @@ void TestQPrefProxy::test_struct_get()
|
|||
auto tst = qPrefProxy::instance();
|
||||
|
||||
prefs.proxy_auth = true;
|
||||
prefs.proxy_host = copy_qstring("t1 host");
|
||||
prefs.proxy_pass = copy_qstring("t1 pass");
|
||||
prefs.proxy_host = "t1 host";
|
||||
prefs.proxy_pass = "t1 pass";
|
||||
prefs.proxy_port = 512;
|
||||
prefs.proxy_type = 3;
|
||||
prefs.proxy_user = copy_qstring("t1 user");
|
||||
prefs.proxy_user = "t1 user";
|
||||
|
||||
QCOMPARE(tst->proxy_auth(), true);
|
||||
QCOMPARE(tst->proxy_host(), QString(prefs.proxy_host));
|
||||
QCOMPARE(tst->proxy_pass(), QString(prefs.proxy_pass));
|
||||
QCOMPARE(tst->proxy_host(), QString::fromStdString(prefs.proxy_host));
|
||||
QCOMPARE(tst->proxy_pass(), QString::fromStdString(prefs.proxy_pass));
|
||||
QCOMPARE(tst->proxy_port(), 512);
|
||||
QCOMPARE(tst->proxy_type(), 3);
|
||||
QCOMPARE(tst->proxy_user(), QString(prefs.proxy_user));
|
||||
QCOMPARE(tst->proxy_user(), QString::fromStdString(prefs.proxy_user));
|
||||
}
|
||||
|
||||
void TestQPrefProxy::test_set_struct()
|
||||
|
|
@ -50,11 +50,11 @@ void TestQPrefProxy::test_set_struct()
|
|||
tst->set_proxy_user("t2 user");
|
||||
|
||||
QCOMPARE(prefs.proxy_auth, false);
|
||||
QCOMPARE(QString(prefs.proxy_host), QString("t2 host"));
|
||||
QCOMPARE(QString(prefs.proxy_pass), QString("t2 pass"));
|
||||
QCOMPARE(QString::fromStdString(prefs.proxy_host), QString("t2 host"));
|
||||
QCOMPARE(QString::fromStdString(prefs.proxy_pass), QString("t2 pass"));
|
||||
QCOMPARE(prefs.proxy_port, 524);
|
||||
QCOMPARE(prefs.proxy_type, 2);
|
||||
QCOMPARE(QString(prefs.proxy_user), QString("t2 user"));
|
||||
QCOMPARE(QString::fromStdString(prefs.proxy_user), QString("t2 user"));
|
||||
}
|
||||
|
||||
void TestQPrefProxy::test_set_load_struct()
|
||||
|
|
@ -72,19 +72,19 @@ void TestQPrefProxy::test_set_load_struct()
|
|||
|
||||
tst->sync();
|
||||
prefs.proxy_auth = false;
|
||||
prefs.proxy_host = copy_qstring("error1");
|
||||
prefs.proxy_pass = copy_qstring("error1");
|
||||
prefs.proxy_host = "error1";
|
||||
prefs.proxy_pass = "error1";
|
||||
prefs.proxy_port = 128;
|
||||
prefs.proxy_type = 0;
|
||||
prefs.proxy_user = copy_qstring("error1");
|
||||
prefs.proxy_user = "error1";
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(prefs.proxy_auth, true);
|
||||
QCOMPARE(QString(prefs.proxy_host), QString("t3 host"));
|
||||
QCOMPARE(QString(prefs.proxy_pass), QString("t3 pass"));
|
||||
QCOMPARE(QString::fromStdString(prefs.proxy_host), QString("t3 host"));
|
||||
QCOMPARE(QString::fromStdString(prefs.proxy_pass), QString("t3 pass"));
|
||||
QCOMPARE(prefs.proxy_port, 532);
|
||||
QCOMPARE(prefs.proxy_type, 1);
|
||||
QCOMPARE(QString(prefs.proxy_user), QString("t3 user"));
|
||||
QCOMPARE(QString::fromStdString(prefs.proxy_user), QString("t3 user"));
|
||||
}
|
||||
|
||||
void TestQPrefProxy::test_struct_disk()
|
||||
|
|
@ -94,27 +94,27 @@ void TestQPrefProxy::test_struct_disk()
|
|||
auto tst = qPrefProxy::instance();
|
||||
|
||||
prefs.proxy_auth = false;
|
||||
prefs.proxy_host = copy_qstring("t4 host");
|
||||
prefs.proxy_pass = copy_qstring("t4 pass");
|
||||
prefs.proxy_host = "t4 host";
|
||||
prefs.proxy_pass = "t4 pass";
|
||||
prefs.proxy_port = 544;
|
||||
prefs.proxy_type = 4;
|
||||
prefs.proxy_user = copy_qstring("t4 user");
|
||||
prefs.proxy_user = "t4 user";
|
||||
|
||||
tst->sync();
|
||||
prefs.proxy_auth = true;
|
||||
prefs.proxy_host = copy_qstring("error1");
|
||||
prefs.proxy_pass = copy_qstring("error1");
|
||||
prefs.proxy_host = "error1";
|
||||
prefs.proxy_pass = "error1";
|
||||
prefs.proxy_port = 128;
|
||||
prefs.proxy_type = 5;
|
||||
prefs.proxy_user = copy_qstring("error1");
|
||||
prefs.proxy_user = "error1";
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(prefs.proxy_auth, false);
|
||||
QCOMPARE(QString(prefs.proxy_host), QString("t4 host"));
|
||||
QCOMPARE(QString(prefs.proxy_pass), QString("t4 pass"));
|
||||
QCOMPARE(QString::fromStdString(prefs.proxy_host), QString("t4 host"));
|
||||
QCOMPARE(QString::fromStdString(prefs.proxy_pass), QString("t4 pass"));
|
||||
QCOMPARE(prefs.proxy_port, 544);
|
||||
QCOMPARE(prefs.proxy_type, 4);
|
||||
QCOMPARE(QString(prefs.proxy_user), QString("t4 user"));
|
||||
QCOMPARE(QString::fromStdString(prefs.proxy_user), QString("t4 user"));
|
||||
}
|
||||
|
||||
void TestQPrefProxy::test_multiple()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ void TestQPrefUpdateManager::test_struct_get()
|
|||
auto tst = qPrefUpdateManager::instance();
|
||||
|
||||
prefs.update_manager.dont_check_for_updates = true;
|
||||
prefs.update_manager.last_version_used = copy_qstring("last_version");
|
||||
prefs.update_manager.last_version_used = "last_version";
|
||||
prefs.update_manager.next_check = QDate::fromString("11/09/1957", "dd/MM/yyyy").toJulianDay();
|
||||
|
||||
QCOMPARE(tst->dont_check_for_updates(), true);
|
||||
|
|
@ -42,7 +42,7 @@ void TestQPrefUpdateManager::test_set_struct()
|
|||
tst->set_uuidString("uuid");
|
||||
|
||||
QCOMPARE(prefs.update_manager.dont_check_for_updates, false);
|
||||
QCOMPARE(QString(prefs.update_manager.last_version_used), QString("last_version2"));
|
||||
QCOMPARE(QString::fromStdString(prefs.update_manager.last_version_used), QString("last_version2"));
|
||||
QCOMPARE(QDate::fromJulianDay(prefs.update_manager.next_check), QDate::fromString("11/09/1957", "dd/MM/yyyy"));
|
||||
QCOMPARE(tst->uuidString(), QString("uuid"));
|
||||
}
|
||||
|
|
@ -63,12 +63,12 @@ void TestQPrefUpdateManager::test_set_load_struct()
|
|||
tst->set_uuidString("uuid2");
|
||||
|
||||
prefs.update_manager.dont_check_for_updates = true;
|
||||
prefs.update_manager.last_version_used = copy_qstring("last_version");
|
||||
prefs.update_manager.last_version_used = "last_version";
|
||||
prefs.update_manager.next_check = 1000;
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(prefs.update_manager.dont_check_for_updates, false);
|
||||
QCOMPARE(QString(prefs.update_manager.last_version_used), QString("last_version2"));
|
||||
QCOMPARE(QString::fromStdString(prefs.update_manager.last_version_used), QString("last_version2"));
|
||||
QCOMPARE(QDate::fromJulianDay(prefs.update_manager.next_check), QDate::fromString("11/09/1957", "dd/MM/yyyy"));
|
||||
QCOMPARE(tst->uuidString(), QString("uuid2"));
|
||||
}
|
||||
|
|
@ -80,12 +80,12 @@ void TestQPrefUpdateManager::test_struct_disk()
|
|||
auto tst = qPrefUpdateManager::instance();
|
||||
|
||||
prefs.update_manager.dont_check_for_updates = true;
|
||||
prefs.update_manager.last_version_used = copy_qstring("last_version");
|
||||
prefs.update_manager.last_version_used = "last_version";
|
||||
prefs.update_manager.next_check = QDate::fromString("11/09/1957", "dd/MM/yyyy").toJulianDay();
|
||||
|
||||
tst->sync();
|
||||
prefs.update_manager.dont_check_for_updates = false;
|
||||
prefs.update_manager.last_version_used = copy_qstring("");
|
||||
prefs.update_manager.last_version_used.clear();
|
||||
prefs.update_manager.next_check = 1000;
|
||||
|
||||
tst->load();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
void TestRenumber::setup()
|
||||
{
|
||||
prefs.cloud_base_url = strdup(default_prefs.cloud_base_url);
|
||||
prefs.cloud_base_url = default_prefs.cloud_base_url;
|
||||
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &divelog), 0);
|
||||
process_loaded_dives();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue