Test planner settings

Plus: fix a typo.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2016-10-15 19:52:17 +02:00 committed by Dirk Hohndel
parent 49e96e7816
commit 8cd4255a28
3 changed files with 104 additions and 3 deletions

View file

@ -1495,7 +1495,7 @@ void DivePlannerSettings::setBottomSac(int value)
emit bottomSacChanged(value);
}
void DivePlannerSettings::setSecoSac(int value)
void DivePlannerSettings::setDecoSac(int value)
{
if (value == prefs.decosac)
return;

View file

@ -403,7 +403,7 @@ class DivePlannerSettings : public QObject {
Q_PROPERTY(int reserve_gas READ reserveGas WRITE setReserveGas NOTIFY reserveGasChanged)
Q_PROPERTY(int min_switch_duration READ minSwitchDuration WRITE setMinSwitchDuration NOTIFY minSwitchDurationChanged)
Q_PROPERTY(int bottomsac READ bottomSac WRITE setBottomSac NOTIFY bottomSacChanged)
Q_PROPERTY(int decosac READ decoSac WRITE setSecoSac NOTIFY decoSacChanged)
Q_PROPERTY(int decosac READ decoSac WRITE setDecoSac NOTIFY decoSacChanged)
Q_PROPERTY(deco_mode decoMode READ decoMode WRITE setDecoMode NOTIFY decoModeChanged)
public:
@ -452,7 +452,7 @@ public slots:
void setReserveGas(int value);
void setMinSwitchDuration(int value);
void setBottomSac(int value);
void setSecoSac(int value);
void setDecoSac(int value);
void setDecoMode(deco_mode value);
signals:

View file

@ -309,6 +309,107 @@ void TestPreferences::testPreferences()
TEST(proxy->host(),QStringLiteral("localhost_1"));
TEST(proxy->user(),QStringLiteral("unknown_1"));
TEST(proxy->pass(),QStringLiteral("secret_1"));
auto planner = pref->planner_settings;
planner->setLastStop(true);
planner->setVerbatimPlan(true);
planner->setDisplayRuntime(true);
planner->setDisplayDuration(true);
planner->setDisplayTransitions(true);
planner->setDoo2breaks(true);
planner->setDropStoneMode(true);
planner->setSafetyStop(true);
planner->setSwitchAtRequiredStop(true);
planner->setAscrate75(1);
planner->setAscrate50(2);
planner->setAscratestops(3);
planner->setAscratelast6m(4);
planner->setDescrate(5);
planner->setBottompo2(6);
planner->setDecopo2(7);
planner->setBestmixend(8);
planner->setReserveGas(9);
planner->setMinSwitchDuration(10);
planner->setBottomSac(11);
planner->setDecoSac(12);
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);
planner->setLastStop(false);
planner->setVerbatimPlan(false);
planner->setDisplayRuntime(false);
planner->setDisplayDuration(false);
planner->setDisplayTransitions(false);
planner->setDoo2breaks(false);
planner->setDropStoneMode(false);
planner->setSafetyStop(false);
planner->setSwitchAtRequiredStop(false);
planner->setAscrate75(11);
planner->setAscrate50(12);
planner->setAscratestops(13);
planner->setAscratelast6m(14);
planner->setDescrate(15);
planner->setBottompo2(16);
planner->setDecopo2(17);
planner->setBestmixend(18);
planner->setReserveGas(19);
planner->setMinSwitchDuration(110);
planner->setBottomSac(111);
planner->setDecoSac(112);
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);
}
QTEST_MAIN(TestPreferences)