From 4ce0146e6edf094a1ff869ba8f86fd5bcbd7f95d Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 17 Oct 2016 18:01:06 +0200 Subject: Add general settings unittests Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- tests/testpreferences.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) 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) -- cgit v1.2.3-70-g09d2