diff options
author | jan Iversen <jani@apache.org> | 2018-08-13 22:12:06 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-08-14 09:09:06 -0700 |
commit | 91ec0fe8d40d619c32fab30c45565a7a2f24a749 (patch) | |
tree | 11853dd30713a84c0a9cefff956c6029141e179e /tests | |
parent | 4ba458318c48ff80017d8c5fe74e928b8b7df449 (diff) | |
download | subsurface-91ec0fe8d40d619c32fab30c45565a7a2f24a749.tar.gz |
tests: move General test from testpreferences
Remove General test in testpreferences
add the same General tests to testqPrefGeneral
Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testpreferences.cpp | 36 | ||||
-rw-r--r-- | tests/testqPrefGeneral.cpp | 45 | ||||
-rw-r--r-- | tests/testqPrefGeneral.h | 1 |
3 files changed, 46 insertions, 36 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index 8f0c12f24..2171ba989 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -23,42 +23,6 @@ void TestPreferences::testPreferences() { auto pref = SettingsObjectWrapper::instance(); pref->load(); - - auto general = pref->general_settings; - 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->set_default_file_behavior(LOCAL_DEFAULT_FILE); - general->set_defaultsetpoint(0); - general->set_o2consumption(0); - general->set_pscr_ratio(0); - general->set_use_default_file(true); - - TEST(general->default_filename(), QStringLiteral("filename")); - TEST(general->default_cylinder(), QStringLiteral("cylinder_2")); - TEST(general->default_file_behavior(), LOCAL_DEFAULT_FILE); // since we have a default file, here it returns - TEST(general->defaultsetpoint(), 0); - TEST(general->o2consumption(), 0); - TEST(general->pscr_ratio(), 0); - TEST(general->use_default_file(), true); - - general->set_default_filename("no_file_name"); - general->set_default_cylinder("cylinder_1"); - //TODOl: Change this to a enum. - general->set_default_file_behavior(CLOUD_DEFAULT_FILE); - - general->set_defaultsetpoint(1); - general->set_o2consumption(1); - general->set_pscr_ratio(1); - general->set_use_default_file(false); - - TEST(general->default_filename(), QStringLiteral("no_file_name")); - TEST(general->default_cylinder(), QStringLiteral("cylinder_1")); - TEST(general->default_file_behavior(), CLOUD_DEFAULT_FILE); - TEST(general->defaultsetpoint(), 1); - TEST(general->o2consumption(), 1); - TEST(general->pscr_ratio(), 1); - TEST(general->use_default_file(), false); } QTEST_MAIN(TestPreferences) diff --git a/tests/testqPrefGeneral.cpp b/tests/testqPrefGeneral.cpp index 6a8e1f242..2e6ec76c0 100644 --- a/tests/testqPrefGeneral.cpp +++ b/tests/testqPrefGeneral.cpp @@ -181,4 +181,49 @@ void TestQPrefGeneral::test_multiple() QCOMPARE(tst_direct->pscr_ratio(), 18); } +#define TEST(METHOD, VALUE) \ + QCOMPARE(METHOD, VALUE); \ + general->sync(); \ + general->load(); \ + QCOMPARE(METHOD, VALUE); + +void TestQPrefGeneral::test_oldPreferences() +{ + auto general = qPrefGeneral::instance(); + + general->set_default_filename("filename"); + general->set_default_cylinder("cylinder_2"); + general->set_default_file_behavior(LOCAL_DEFAULT_FILE); + general->set_defaultsetpoint(0); + general->set_o2consumption(0); + general->set_pscr_ratio(0); + general->set_use_default_file(true); + + TEST(general->default_filename(), QStringLiteral("filename")); + TEST(general->default_cylinder(), QStringLiteral("cylinder_2")); + TEST(general->default_file_behavior(), LOCAL_DEFAULT_FILE); // since we have a default file, here it returns + TEST(general->defaultsetpoint(), 0); + TEST(general->o2consumption(), 0); + TEST(general->pscr_ratio(), 0); + TEST(general->use_default_file(), true); + + general->set_default_filename("no_file_name"); + general->set_default_cylinder("cylinder_1"); + //TODOl: Change this to a enum. + general->set_default_file_behavior(CLOUD_DEFAULT_FILE); + + general->set_defaultsetpoint(1); + general->set_o2consumption(1); + general->set_pscr_ratio(1); + general->set_use_default_file(false); + + TEST(general->default_filename(), QStringLiteral("no_file_name")); + TEST(general->default_cylinder(), QStringLiteral("cylinder_1")); + TEST(general->default_file_behavior(), CLOUD_DEFAULT_FILE); + TEST(general->defaultsetpoint(), 1); + TEST(general->o2consumption(), 1); + TEST(general->pscr_ratio(), 1); + TEST(general->use_default_file(), false); +} + QTEST_MAIN(TestQPrefGeneral) diff --git a/tests/testqPrefGeneral.h b/tests/testqPrefGeneral.h index c96fa09fb..73a223396 100644 --- a/tests/testqPrefGeneral.h +++ b/tests/testqPrefGeneral.h @@ -14,6 +14,7 @@ private slots: void test_set_load_struct(); void test_struct_disk(); void test_multiple(); + void test_oldPreferences(); }; #endif // TESTQPREFGENERAL_H |