summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2016-10-17 18:01:06 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-10-18 11:13:28 -0700
commit4ce0146e6edf094a1ff869ba8f86fd5bcbd7f95d (patch)
treebe231438038715436035befd60d13463afdff284 /tests
parenta42b05578fe731ce0b722e5c7383d616880289ef (diff)
downloadsubsurface-4ce0146e6edf094a1ff869ba8f86fd5bcbd7f95d.tar.gz
Add general settings unittests
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/testpreferences.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index 50389a0c6..ba8e6feaf 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -447,6 +447,44 @@ void TestPreferences::testPreferences()
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");
+ //TODOl: Change this to a enum.
+ 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)0);
+ 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");
+ //TODOl: Change this to a enum.
+ general->setDefaultFileBehavior (1);
+
+ 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) 1);
+ TEST(general->defaultSetPoint(), 1);
+ TEST(general->o2Consumption(), 1);
+ TEST(general->pscrRatio(), 1);
+ TEST(general->useDefaultFile(), false);
+
}
QTEST_MAIN(TestPreferences)