summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-03 18:14:55 +0200
committerGravatar Robert C. Helling <helling@atdotde.de>2018-08-08 14:29:50 +0200
commitfff0e54593b005b128b17411524cefee342facf0 (patch)
treefae9fc0c73c3331d50f4223357da810ee8eef7d8 /tests
parent9c26a491a725be7a061191d0bd4ee01096182e69 (diff)
downloadsubsurface-fff0e54593b005b128b17411524cefee342facf0.tar.gz
tests: move DivePlanner test from testpreferences
Remove DivePlanner test in testpreferences add the same DivePlanner tests to testqPrefDivePlanner Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/testpreferences.cpp105
-rw-r--r--tests/testqPrefDivePlanner.cpp115
-rw-r--r--tests/testqPrefDivePlanner.h1
3 files changed, 116 insertions, 105 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index 345aaf094..aae6ffe7d 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -177,111 +177,6 @@ void TestPreferences::testPreferences()
TEST(geo->secondTaxonomyCategory(), TC_COUNTRY);
TEST(geo->thirdTaxonomyCategory(), TC_NONE);
- auto planner = qPrefDivePlanner::instance();
- depth_t x;
-
- planner->set_last_stop(true);
- planner->set_verbatim_plan(true);
- planner->set_display_runtime(true);
- planner->set_display_duration(true);
- planner->set_display_transitions(true);
- planner->set_doo2breaks(true);
- planner->set_drop_stone_mode(true);
- planner->set_safetystop(true);
- planner->set_switch_at_req_stop(true);
-
- planner->set_ascrate75(1);
- planner->set_ascrate50(2);
- planner->set_ascratestops(3);
- planner->set_ascratelast6m(4);
- planner->set_descrate(5);
- planner->set_bottompo2(6);
- planner->set_decopo2(7);
- x.mm = 8;
- planner->set_bestmixend(x);
- planner->set_reserve_gas(9);
- planner->set_min_switch_duration(10);
- planner->set_bottomsac(11);
- planner->set_decosac(12);
-
- planner->set_planner_deco_mode(BUEHLMANN);
-
- TEST(planner->last_stop(), true);
- TEST(planner->verbatim_plan(), true);
- TEST(planner->display_runtime(), true);
- TEST(planner->display_duration(), true);
- TEST(planner->display_transitions(), true);
- TEST(planner->doo2breaks(), true);
- TEST(planner->drop_stone_mode(), true);
- TEST(planner->safetystop(), true);
- TEST(planner->switch_at_req_stop(), 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().mm, 8);
- TEST(planner->reserve_gas(), 9);
- TEST(planner->min_switch_duration(), 10);
- TEST(planner->bottomsac(), 11);
- TEST(planner->decosac(), 12);
-
- TEST(planner->planner_deco_mode(), BUEHLMANN);
-
- planner->set_last_stop(false);
- planner->set_verbatim_plan(false);
- planner->set_display_runtime(false);
- planner->set_display_duration(false);
- planner->set_display_transitions(false);
- planner->set_doo2breaks(false);
- planner->set_drop_stone_mode(false);
- planner->set_safetystop(false);
- planner->set_switch_at_req_stop(false);
-
- planner->set_ascrate75(11);
- planner->set_ascrate50(12);
- planner->set_ascratestops(13);
- planner->set_ascratelast6m(14);
- planner->set_descrate(15);
- planner->set_bottompo2(16);
- planner->set_decopo2(17);
- x.mm = 18;
- planner->set_bestmixend(x);
- planner->set_reserve_gas(19);
- planner->set_min_switch_duration(110);
- planner->set_bottomsac(111);
- planner->set_decosac(112);
-
- planner->set_planner_deco_mode(RECREATIONAL);
-
- TEST(planner->last_stop(), false);
- TEST(planner->verbatim_plan(), false);
- TEST(planner->display_runtime(), false);
- TEST(planner->display_duration(), false);
- TEST(planner->display_transitions(), false);
- TEST(planner->doo2breaks(), false);
- TEST(planner->drop_stone_mode(), false);
- TEST(planner->safetystop(), false);
- TEST(planner->switch_at_req_stop(), 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().mm, 18);
- TEST(planner->reserve_gas(), 19);
- TEST(planner->min_switch_duration(), 110);
- TEST(planner->bottomsac(), 111);
- TEST(planner->decosac(), 112);
-
- TEST(planner->planner_deco_mode(), RECREATIONAL);
-
auto general = pref->general_settings;
general->setDefaultFilename("filename");
general->setDefaultCylinder("cylinder_2");
diff --git a/tests/testqPrefDivePlanner.cpp b/tests/testqPrefDivePlanner.cpp
index e3ff1f77e..173bc1d96 100644
--- a/tests/testqPrefDivePlanner.cpp
+++ b/tests/testqPrefDivePlanner.cpp
@@ -326,4 +326,119 @@ void TestQPrefDivePlanner::test_multiple()
QCOMPARE(tst_direct->safetystop(), true);
}
+#define TEST(METHOD, VALUE) \
+ QCOMPARE(METHOD, VALUE); \
+ planner->sync(); \
+ planner->load(); \
+ QCOMPARE(METHOD, VALUE);
+
+void TestQPrefDivePlanner::test_oldPreferences()
+{
+ auto planner = qPrefDivePlanner::instance();
+ depth_t x;
+
+ planner->set_last_stop(true);
+ planner->set_verbatim_plan(true);
+ planner->set_display_runtime(true);
+ planner->set_display_duration(true);
+ planner->set_display_transitions(true);
+ planner->set_doo2breaks(true);
+ planner->set_drop_stone_mode(true);
+ planner->set_safetystop(true);
+ planner->set_switch_at_req_stop(true);
+
+ planner->set_ascrate75(1);
+ planner->set_ascrate50(2);
+ planner->set_ascratestops(3);
+ planner->set_ascratelast6m(4);
+ planner->set_descrate(5);
+ planner->set_bottompo2(6);
+ planner->set_decopo2(7);
+ x.mm = 8;
+ planner->set_bestmixend(x);
+ planner->set_reserve_gas(9);
+ planner->set_min_switch_duration(10);
+ planner->set_bottomsac(11);
+ planner->set_decosac(12);
+
+ planner->set_planner_deco_mode(BUEHLMANN);
+
+ TEST(planner->last_stop(), true);
+ TEST(planner->verbatim_plan(), true);
+ TEST(planner->display_runtime(), true);
+ TEST(planner->display_duration(), true);
+ TEST(planner->display_transitions(), true);
+ TEST(planner->doo2breaks(), true);
+ TEST(planner->drop_stone_mode(), true);
+ TEST(planner->safetystop(), true);
+ TEST(planner->switch_at_req_stop(), 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().mm, 8);
+ TEST(planner->reserve_gas(), 9);
+ TEST(planner->min_switch_duration(), 10);
+ TEST(planner->bottomsac(), 11);
+ TEST(planner->decosac(), 12);
+
+ TEST(planner->planner_deco_mode(), BUEHLMANN);
+
+ planner->set_last_stop(false);
+ planner->set_verbatim_plan(false);
+ planner->set_display_runtime(false);
+ planner->set_display_duration(false);
+ planner->set_display_transitions(false);
+ planner->set_doo2breaks(false);
+ planner->set_drop_stone_mode(false);
+ planner->set_safetystop(false);
+ planner->set_switch_at_req_stop(false);
+
+ planner->set_ascrate75(11);
+ planner->set_ascrate50(12);
+ planner->set_ascratestops(13);
+ planner->set_ascratelast6m(14);
+ planner->set_descrate(15);
+ planner->set_bottompo2(16);
+ planner->set_decopo2(17);
+ x.mm = 18;
+ planner->set_bestmixend(x);
+ planner->set_reserve_gas(19);
+ planner->set_min_switch_duration(110);
+ planner->set_bottomsac(111);
+ planner->set_decosac(112);
+
+ planner->set_planner_deco_mode(RECREATIONAL);
+
+ TEST(planner->last_stop(), false);
+ TEST(planner->verbatim_plan(), false);
+ TEST(planner->display_runtime(), false);
+ TEST(planner->display_duration(), false);
+ TEST(planner->display_transitions(), false);
+ TEST(planner->doo2breaks(), false);
+ TEST(planner->drop_stone_mode(), false);
+ TEST(planner->safetystop(), false);
+ TEST(planner->switch_at_req_stop(), 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().mm, 18);
+ TEST(planner->reserve_gas(), 19);
+ TEST(planner->min_switch_duration(), 110);
+ TEST(planner->bottomsac(), 111);
+ TEST(planner->decosac(), 112);
+
+ TEST(planner->planner_deco_mode(), RECREATIONAL);
+
+}
+
QTEST_MAIN(TestQPrefDivePlanner)
diff --git a/tests/testqPrefDivePlanner.h b/tests/testqPrefDivePlanner.h
index 801a756de..7d61c3aed 100644
--- a/tests/testqPrefDivePlanner.h
+++ b/tests/testqPrefDivePlanner.h
@@ -14,6 +14,7 @@ private slots:
void test_set_load_struct();
void test_struct_disk();
void test_multiple();
+ void test_oldPreferences();
};
#endif // TESTQPREFDIVEPLANNER_H