aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2016-10-28 11:51:13 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-10-28 07:31:17 -0700
commit324b1d2dfc885226c2df81e78ddea4b6098aeaf8 (patch)
treefe398fd0773d789d564f1ce3a1f29de66b89d156
parenteb6f9e263c5e41e56fa4e6fe820839f26c27661d (diff)
downloadsubsurface-324b1d2dfc885226c2df81e78ddea4b6098aeaf8.tar.gz
Fix default file behavior tests
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp1
-rw-r--r--tests/testpreferences.cpp9
2 files changed, 5 insertions, 5 deletions
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index 7298f9006..7626befdb 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -1744,6 +1744,7 @@ void GeneralSettingsObjectWrapper::setDefaultFileBehavior(short value)
QSettings s;
s.beginGroup(group);
s.setValue("default_file_behavior", value);
+
prefs.default_file_behavior = value;
if (prefs.default_file_behavior == UNDEFINED_DEFAULT_FILE) {
// undefined, so check if there's a filename set and
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index 7ba25625a..862ba6154 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -451,9 +451,8 @@ void TestPreferences::testPreferences()
auto general = pref->general_settings;
general->setDefaultFilename ("filename");
general->setDefaultCylinder ("cylinder_2");
- //TODOl: Change this to a enum.
+ //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);
@@ -461,7 +460,7 @@ void TestPreferences::testPreferences()
TEST(general->defaultFilename(), QStringLiteral("filename"));
TEST(general->defaultCylinder(), QStringLiteral("cylinder_2"));
- TEST(general->defaultFileBehavior(), (short)0);
+ 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);
@@ -470,7 +469,7 @@ void TestPreferences::testPreferences()
general->setDefaultFilename ("no_file_name");
general->setDefaultCylinder ("cylinder_1");
//TODOl: Change this to a enum.
- general->setDefaultFileBehavior (1);
+ general->setDefaultFileBehavior (CLOUD_DEFAULT_FILE);
general->setDefaultSetPoint (1);
general->setO2Consumption (1);
@@ -479,7 +478,7 @@ void TestPreferences::testPreferences()
TEST(general->defaultFilename(), QStringLiteral("no_file_name"));
TEST(general->defaultCylinder(), QStringLiteral("cylinder_1"));
- TEST(general->defaultFileBehavior(), (short) 1);
+ TEST(general->defaultFileBehavior(), (short) CLOUD_DEFAULT_FILE);
TEST(general->defaultSetPoint(), 1);
TEST(general->o2Consumption(), 1);
TEST(general->pscrRatio(), 1);