aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testpreferences.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testpreferences.cpp')
-rw-r--r--tests/testpreferences.cpp244
1 files changed, 122 insertions, 122 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index 4cc024408..bba580458 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -3,14 +3,14 @@
#include "core/subsurface-qt/SettingsObjectWrapper.h"
-#include <QtTest>
#include <QDate>
+#include <QtTest>
-#define TEST(METHOD, VALUE) \
-QCOMPARE(METHOD, VALUE); \
-pref->sync(); \
-pref->load(); \
-QCOMPARE(METHOD, VALUE);
+#define TEST(METHOD, VALUE) \
+ QCOMPARE(METHOD, VALUE); \
+ pref->sync(); \
+ pref->load(); \
+ QCOMPARE(METHOD, VALUE);
void TestPreferences::initTestCase()
{
@@ -165,17 +165,17 @@ void TestPreferences::testPreferences()
fb->setUserId("tomaz-user-id");
fb->setAlbumId("album-id");
- TEST(fb->accessToken(),QStringLiteral("rand-access-token"));
- TEST(fb->userId(), QStringLiteral("tomaz-user-id"));
- TEST(fb->albumId(), QStringLiteral("album-id"));
+ TEST(fb->accessToken(), QStringLiteral("rand-access-token"));
+ TEST(fb->userId(), QStringLiteral("tomaz-user-id"));
+ TEST(fb->albumId(), QStringLiteral("album-id"));
fb->setAccessToken("rand-access-token-2");
fb->setUserId("tomaz-user-id-2");
fb->setAlbumId("album-id-2");
- TEST(fb->accessToken(),QStringLiteral("rand-access-token-2"));
- TEST(fb->userId(), QStringLiteral("tomaz-user-id-2"));
- TEST(fb->albumId(), QStringLiteral("album-id-2"));
+ TEST(fb->accessToken(), QStringLiteral("rand-access-token-2"));
+ TEST(fb->userId(), QStringLiteral("tomaz-user-id-2"));
+ TEST(fb->albumId(), QStringLiteral("album-id-2"));
auto geo = pref->geocoding;
geo->setFirstTaxonomyCategory(TC_NONE);
@@ -202,12 +202,12 @@ void TestPreferences::testPreferences()
proxy->setUser("unknown");
proxy->setPass("secret");
- TEST(proxy->type(),2);
- TEST(proxy->port(),80);
- TEST(proxy->auth(),true);
- TEST(proxy->host(),QStringLiteral("localhost"));
- TEST(proxy->user(),QStringLiteral("unknown"));
- TEST(proxy->pass(),QStringLiteral("secret"));
+ TEST(proxy->type(), 2);
+ TEST(proxy->port(), 80);
+ TEST(proxy->auth(), true);
+ TEST(proxy->host(), QStringLiteral("localhost"));
+ TEST(proxy->user(), QStringLiteral("unknown"));
+ TEST(proxy->pass(), QStringLiteral("secret"));
proxy->setType(3);
proxy->setPort(8080);
@@ -216,12 +216,12 @@ void TestPreferences::testPreferences()
proxy->setUser("unknown_1");
proxy->setPass("secret_1");
- TEST(proxy->type(),3);
- TEST(proxy->port(),8080);
- TEST(proxy->auth(),false);
- TEST(proxy->host(),QStringLiteral("127.0.0.1"));
- TEST(proxy->user(),QStringLiteral("unknown_1"));
- TEST(proxy->pass(),QStringLiteral("secret_1"));
+ TEST(proxy->type(), 3);
+ TEST(proxy->port(), 8080);
+ TEST(proxy->auth(), false);
+ TEST(proxy->host(), QStringLiteral("127.0.0.1"));
+ TEST(proxy->user(), QStringLiteral("unknown_1"));
+ TEST(proxy->pass(), QStringLiteral("secret_1"));
auto planner = pref->planner_settings;
planner->setLastStop(true);
@@ -249,30 +249,30 @@ void TestPreferences::testPreferences()
planner->setDecoMode(BUEHLMANN);
- TEST(planner->lastStop(),true);
- TEST(planner->verbatimPlan(),true);
- TEST(planner->displayRuntime(),true);
- TEST(planner->displayDuration(),true);
- TEST(planner->displayTransitions(),true);
- TEST(planner->doo2breaks(),true);
- TEST(planner->dropStoneMode(),true);
- TEST(planner->safetyStop(),true);
- TEST(planner->switchAtRequiredStop(),true);
-
- TEST(planner->ascrate75(),1);
- TEST(planner->ascrate50(),2);
- TEST(planner->ascratestops(),3);
- TEST(planner->ascratelast6m(),4);
- TEST(planner->descrate(),5);
- TEST(planner->bottompo2(),6);
- TEST(planner->decopo2(),7);
- TEST(planner->bestmixend(),8);
- TEST(planner->reserveGas(),9);
- TEST(planner->minSwitchDuration(),10);
- TEST(planner->bottomSac(),11);
- TEST(planner->decoSac(),12);
-
- TEST(planner->decoMode(),BUEHLMANN);
+ TEST(planner->lastStop(), true);
+ TEST(planner->verbatimPlan(), true);
+ TEST(planner->displayRuntime(), true);
+ TEST(planner->displayDuration(), true);
+ TEST(planner->displayTransitions(), true);
+ TEST(planner->doo2breaks(), true);
+ TEST(planner->dropStoneMode(), true);
+ TEST(planner->safetyStop(), true);
+ TEST(planner->switchAtRequiredStop(), true);
+
+ TEST(planner->ascrate75(), 1);
+ TEST(planner->ascrate50(), 2);
+ TEST(planner->ascratestops(), 3);
+ TEST(planner->ascratelast6m(), 4);
+ TEST(planner->descrate(), 5);
+ TEST(planner->bottompo2(), 6);
+ TEST(planner->decopo2(), 7);
+ TEST(planner->bestmixend(), 8);
+ TEST(planner->reserveGas(), 9);
+ TEST(planner->minSwitchDuration(), 10);
+ TEST(planner->bottomSac(), 11);
+ TEST(planner->decoSac(), 12);
+
+ TEST(planner->decoMode(), BUEHLMANN);
planner->setLastStop(false);
planner->setVerbatimPlan(false);
@@ -299,30 +299,30 @@ void TestPreferences::testPreferences()
planner->setDecoMode(RECREATIONAL);
- TEST(planner->lastStop(),false);
- TEST(planner->verbatimPlan(),false);
- TEST(planner->displayRuntime(),false);
- TEST(planner->displayDuration(),false);
- TEST(planner->displayTransitions(),false);
- TEST(planner->doo2breaks(),false);
- TEST(planner->dropStoneMode(),false);
- TEST(planner->safetyStop(),false);
- TEST(planner->switchAtRequiredStop(),false);
-
- TEST(planner->ascrate75(),11);
- TEST(planner->ascrate50(),12);
- TEST(planner->ascratestops(),13);
- TEST(planner->ascratelast6m(),14);
- TEST(planner->descrate(),15);
- TEST(planner->bottompo2(),16);
- TEST(planner->decopo2(),17);
- TEST(planner->bestmixend(),18);
- TEST(planner->reserveGas(),19);
- TEST(planner->minSwitchDuration(),110);
- TEST(planner->bottomSac(),111);
- TEST(planner->decoSac(),112);
-
- TEST(planner->decoMode(),RECREATIONAL);
+ TEST(planner->lastStop(), false);
+ TEST(planner->verbatimPlan(), false);
+ TEST(planner->displayRuntime(), false);
+ TEST(planner->displayDuration(), false);
+ TEST(planner->displayTransitions(), false);
+ TEST(planner->doo2breaks(), false);
+ TEST(planner->dropStoneMode(), false);
+ TEST(planner->safetyStop(), false);
+ TEST(planner->switchAtRequiredStop(), false);
+
+ TEST(planner->ascrate75(), 11);
+ TEST(planner->ascrate50(), 12);
+ TEST(planner->ascratestops(), 13);
+ TEST(planner->ascratelast6m(), 14);
+ TEST(planner->descrate(), 15);
+ TEST(planner->bottompo2(), 16);
+ TEST(planner->decopo2(), 17);
+ TEST(planner->bestmixend(), 18);
+ TEST(planner->reserveGas(), 19);
+ TEST(planner->minSwitchDuration(), 110);
+ TEST(planner->bottomSac(), 111);
+ TEST(planner->decoSac(), 112);
+
+ TEST(planner->decoMode(), RECREATIONAL);
auto units = pref->unit_settings;
units->setLength(0);
@@ -334,14 +334,14 @@ void TestPreferences::testPreferences()
units->setUnitSystem(QStringLiteral("metric"));
units->setCoordinatesTraditional(false);
- TEST(units->length(),0);
- TEST(units->pressure(),0);
- TEST(units->volume(),0);
- TEST(units->temperature(),0);
- TEST(units->weight(),0);
- TEST(units->verticalSpeedTime(),0);
- TEST(units->unitSystem(),QStringLiteral("metric"));
- TEST(units->coordinatesTraditional(),false);
+ TEST(units->length(), 0);
+ TEST(units->pressure(), 0);
+ TEST(units->volume(), 0);
+ TEST(units->temperature(), 0);
+ TEST(units->weight(), 0);
+ TEST(units->verticalSpeedTime(), 0);
+ TEST(units->unitSystem(), QStringLiteral("metric"));
+ TEST(units->coordinatesTraditional(), false);
units->setLength(1);
units->setPressure(1);
@@ -352,60 +352,60 @@ void TestPreferences::testPreferences()
units->setUnitSystem(QStringLiteral("fake-metric-system"));
units->setCoordinatesTraditional(true);
- TEST(units->length(),1);
- TEST(units->pressure(),1);
- TEST(units->volume(),1);
- TEST(units->temperature(),1);
- TEST(units->weight(),1);
- TEST(units->verticalSpeedTime(),1);
- TEST(units->unitSystem(),QStringLiteral("personalized"));
- TEST(units->coordinatesTraditional(),true);
+ TEST(units->length(), 1);
+ TEST(units->pressure(), 1);
+ TEST(units->volume(), 1);
+ TEST(units->temperature(), 1);
+ TEST(units->weight(), 1);
+ TEST(units->verticalSpeedTime(), 1);
+ TEST(units->unitSystem(), QStringLiteral("personalized"));
+ TEST(units->coordinatesTraditional(), true);
auto general = pref->general_settings;
- general->setDefaultFilename ("filename");
- general->setDefaultCylinder ("cylinder_2");
+ general->setDefaultFilename("filename");
+ general->setDefaultCylinder("cylinder_2");
//TODOl: Change this to a enum. // This is 'undefined', it will need to figure out later between no_file or use_deault file.
- general->setDefaultFileBehavior (0);
- general->setDefaultSetPoint (0);
- general->setO2Consumption (0);
- general->setPscrRatio (0);
- general->setUseDefaultFile (true);
+ general->setDefaultFileBehavior(0);
+ general->setDefaultSetPoint(0);
+ general->setO2Consumption(0);
+ general->setPscrRatio(0);
+ general->setUseDefaultFile(true);
TEST(general->defaultFilename(), QStringLiteral("filename"));
TEST(general->defaultCylinder(), QStringLiteral("cylinder_2"));
- TEST(general->defaultFileBehavior(), (short) LOCAL_DEFAULT_FILE); // since we have a default file, here it returns
+ TEST(general->defaultFileBehavior(), (short)LOCAL_DEFAULT_FILE); // since we have a default file, here it returns
TEST(general->defaultSetPoint(), 0);
TEST(general->o2Consumption(), 0);
TEST(general->pscrRatio(), 0);
TEST(general->useDefaultFile(), true);
- general->setDefaultFilename ("no_file_name");
- general->setDefaultCylinder ("cylinder_1");
+ general->setDefaultFilename("no_file_name");
+ general->setDefaultCylinder("cylinder_1");
//TODOl: Change this to a enum.
- general->setDefaultFileBehavior (CLOUD_DEFAULT_FILE);
+ general->setDefaultFileBehavior(CLOUD_DEFAULT_FILE);
- general->setDefaultSetPoint (1);
- general->setO2Consumption (1);
- general->setPscrRatio (1);
- general->setUseDefaultFile (false);
+ general->setDefaultSetPoint(1);
+ general->setO2Consumption(1);
+ general->setPscrRatio(1);
+ general->setUseDefaultFile(false);
TEST(general->defaultFilename(), QStringLiteral("no_file_name"));
TEST(general->defaultCylinder(), QStringLiteral("cylinder_1"));
- TEST(general->defaultFileBehavior(), (short) CLOUD_DEFAULT_FILE);
+ TEST(general->defaultFileBehavior(), (short)CLOUD_DEFAULT_FILE);
TEST(general->defaultSetPoint(), 1);
TEST(general->o2Consumption(), 1);
TEST(general->pscrRatio(), 1);
TEST(general->useDefaultFile(), false);
auto language = pref->language_settings;
- language->setLangLocale ("en_US");
- language->setLanguage ("en");
- language->setTimeFormat ("hh:mm");
- language->setDateFormat ("dd/mm/yy");
- language->setDateFormatShort ("dd/mm");
- language->setTimeFormatOverride (false);
- language->setDateFormatOverride (false);
- language->setUseSystemLanguage (false);
+ language->setLangLocale("en_US");
+ language->setLanguage("en");
+ language->setTimeFormat("hh:mm");
+ language->setDateFormat("dd/mm/yy");
+ language->setDateFormatShort("dd/mm");
+ language->setTimeFormatOverride(false);
+ language->setDateFormatOverride(false);
+ language->setUseSystemLanguage(false);
TEST(language->langLocale(), QStringLiteral("en_US"));
TEST(language->language(), QStringLiteral("en"));
@@ -416,22 +416,22 @@ void TestPreferences::testPreferences()
TEST(language->dateFormatOverride(), false);
TEST(language->useSystemLanguage(), false);
- language->setLangLocale ("en_EN");
- language->setLanguage ("br");
- language->setTimeFormat ("mm:hh");
- language->setDateFormat ("yy/mm/dd");
- language->setDateFormatShort ("dd/yy");
- language->setTimeFormatOverride (true);
- language->setDateFormatOverride (true);
- language->setUseSystemLanguage (true);
+ language->setLangLocale("en_EN");
+ language->setLanguage("br");
+ language->setTimeFormat("mm:hh");
+ language->setDateFormat("yy/mm/dd");
+ language->setDateFormatShort("dd/yy");
+ language->setTimeFormatOverride(true);
+ language->setDateFormatOverride(true);
+ language->setUseSystemLanguage(true);
TEST(language->langLocale(), QStringLiteral("en_EN"));
TEST(language->language(), QStringLiteral("br"));
TEST(language->timeFormat(), QStringLiteral("mm:hh"));
TEST(language->dateFormat(), QStringLiteral("yy/mm/dd"));
TEST(language->dateFormatShort(), QStringLiteral("dd/yy"));
- TEST(language->timeFormatOverride(),true);
- TEST(language->dateFormatOverride(),true);
+ TEST(language->timeFormatOverride(), true);
+ TEST(language->dateFormatOverride(), true);
TEST(language->useSystemLanguage(), true);
auto location = pref->location_settings;