diff options
author | jan Iversen <jani@apache.org> | 2018-08-05 15:10:45 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-08-12 07:36:10 -0700 |
commit | bfafb51649ccc155fafb7df33f0dd14b7f236520 (patch) | |
tree | fbed633f14fedb65c20ce0323c6d895c8cb58019 | |
parent | 863c04f3f7cde734068c20dcab6f4edee810473c (diff) | |
download | subsurface-bfafb51649ccc155fafb7df33f0dd14b7f236520.tar.gz |
tests: move TechnicalDetails test from testpreferences
Remove TechnicalDetails test in testpreferences
add the same TechnicalDetails tests to testqPrefTechnicalDetails
Signed-off-by: Jan Iversen <jani@apache.org>
-rw-r--r-- | tests/testpreferences.cpp | 99 | ||||
-rw-r--r-- | tests/testqPrefTechnicalDetails.cpp | 108 | ||||
-rw-r--r-- | tests/testqPrefTechnicalDetails.h | 1 |
3 files changed, 109 insertions, 99 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index 3ae38bf03..bf2f0ed74 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -24,105 +24,6 @@ void TestPreferences::testPreferences() auto pref = SettingsObjectWrapper::instance(); pref->load(); - auto tecDetails = qPrefTechnicalDetails::instance(); - tecDetails->set_modpO2(0.2); - TEST(tecDetails->modpO2(), 0.2); - tecDetails->set_modpO2(1.0); - TEST(tecDetails->modpO2(), 1.0); - - tecDetails->set_gflow(2); - TEST(tecDetails->gflow(), 2); - tecDetails->set_gflow(3); - TEST(tecDetails->gflow(), 3); - - tecDetails->set_gfhigh(4); - TEST(tecDetails->gfhigh(), 4); - tecDetails->set_gfhigh(5); - TEST(tecDetails->gfhigh(), 5); - - tecDetails->set_vpmb_conservatism(5); - TEST(tecDetails->vpmb_conservatism(), (short)5); - tecDetails->set_vpmb_conservatism(6); - TEST(tecDetails->vpmb_conservatism(), (short)6); - - tecDetails->set_ead(true); - TEST(tecDetails->ead(), true); - tecDetails->set_mod(true); - TEST(tecDetails->mod(), true); - tecDetails->set_dcceiling(true); - TEST(tecDetails->dcceiling(), true); - tecDetails->set_redceiling(true); - TEST(tecDetails->redceiling(), true); - tecDetails->set_calcceiling(true); - TEST(tecDetails->calcceiling(), true); - tecDetails->set_calcceiling3m(true); - TEST(tecDetails->calcceiling3m(), true); - tecDetails->set_calcalltissues(true); - TEST(tecDetails->calcalltissues(), true); - tecDetails->set_calcndltts(true); - TEST(tecDetails->calcndltts(), true); - tecDetails->set_hrgraph(true); - TEST(tecDetails->hrgraph(), true); - tecDetails->set_tankbar(true); - TEST(tecDetails->tankbar(), true); - tecDetails->set_percentagegraph(true); - TEST(tecDetails->percentagegraph(), true); - tecDetails->set_rulergraph(true); - TEST(tecDetails->rulergraph(), true); - tecDetails->set_show_ccr_setpoint(true); - TEST(tecDetails->show_ccr_setpoint(), true); - tecDetails->set_show_ccr_sensors(true); - TEST(tecDetails->show_ccr_sensors(), true); - tecDetails->set_zoomed_plot(true); - TEST(tecDetails->zoomed_plot(), true); - tecDetails->set_show_sac(true); - TEST(tecDetails->show_sac(), true); - tecDetails->set_display_unused_tanks(true); - TEST(tecDetails->display_unused_tanks(), true); - tecDetails->set_show_average_depth(true); - TEST(tecDetails->show_average_depth(), true); - tecDetails->set_show_pictures_in_profile(true); - TEST(tecDetails->show_pictures_in_profile(), true); - - tecDetails->set_ead(false); - TEST(tecDetails->ead(), false); - tecDetails->set_mod(false); - TEST(tecDetails->mod(), false); - tecDetails->set_dcceiling(false); - TEST(tecDetails->dcceiling(), false); - tecDetails->set_redceiling(false); - TEST(tecDetails->redceiling(), false); - tecDetails->set_calcceiling(false); - TEST(tecDetails->calcceiling(), false); - tecDetails->set_calcceiling3m(false); - TEST(tecDetails->calcceiling3m(), false); - tecDetails->set_calcalltissues(false); - TEST(tecDetails->calcalltissues(), false); - tecDetails->set_calcndltts(false); - TEST(tecDetails->calcndltts(), false); - tecDetails->set_hrgraph(false); - TEST(tecDetails->hrgraph(), false); - tecDetails->set_tankbar(false); - TEST(tecDetails->tankbar(), false); - tecDetails->set_percentagegraph(false); - TEST(tecDetails->percentagegraph(), false); - tecDetails->set_rulergraph(false); - TEST(tecDetails->rulergraph(), false); - tecDetails->set_show_ccr_setpoint(false); - TEST(tecDetails->show_ccr_setpoint(), false); - tecDetails->set_show_ccr_sensors(false); - TEST(tecDetails->show_ccr_sensors(), false); - tecDetails->set_zoomed_plot(false); - TEST(tecDetails->zoomed_plot(), false); - tecDetails->set_show_sac(false); - TEST(tecDetails->show_sac(), false); - tecDetails->set_display_unused_tanks(false); - TEST(tecDetails->display_unused_tanks(), false); - tecDetails->set_show_average_depth(false); - TEST(tecDetails->show_average_depth(), false); - tecDetails->set_show_pictures_in_profile(false); - TEST(tecDetails->show_pictures_in_profile(), false); - auto pp = pref->pp_gas; pp->setShowPn2(false); pp->setShowPhe(false); diff --git a/tests/testqPrefTechnicalDetails.cpp b/tests/testqPrefTechnicalDetails.cpp index 107e1c20b..b3abd8500 100644 --- a/tests/testqPrefTechnicalDetails.cpp +++ b/tests/testqPrefTechnicalDetails.cpp @@ -337,4 +337,112 @@ void TestQPrefTechnicalDetails::test_multiple() QCOMPARE(tst_direct->gflow(), 25); } +#define TEST(METHOD, VALUE) \ + QCOMPARE(METHOD, VALUE); \ + tecDetails->sync(); \ + tecDetails->load(); \ + QCOMPARE(METHOD, VALUE); + +void TestQPrefTechnicalDetails::test_oldPreferences() +{ + auto tecDetails = qPrefTechnicalDetails::instance(); + tecDetails->set_modpO2(0.2); + TEST(tecDetails->modpO2(), 0.2); + tecDetails->set_modpO2(1.0); + TEST(tecDetails->modpO2(), 1.0); + + tecDetails->set_gflow(2); + TEST(tecDetails->gflow(), 2); + tecDetails->set_gflow(3); + TEST(tecDetails->gflow(), 3); + + tecDetails->set_gfhigh(4); + TEST(tecDetails->gfhigh(), 4); + tecDetails->set_gfhigh(5); + TEST(tecDetails->gfhigh(), 5); + + tecDetails->set_vpmb_conservatism(5); + TEST(tecDetails->vpmb_conservatism(), 5); + tecDetails->set_vpmb_conservatism(6); + TEST(tecDetails->vpmb_conservatism(), 6); + + tecDetails->set_ead(true); + TEST(tecDetails->ead(), true); + tecDetails->set_mod(true); + TEST(tecDetails->mod(), true); + tecDetails->set_dcceiling(true); + TEST(tecDetails->dcceiling(), true); + tecDetails->set_redceiling(true); + TEST(tecDetails->redceiling(), true); + tecDetails->set_calcceiling(true); + TEST(tecDetails->calcceiling(), true); + tecDetails->set_calcceiling3m(true); + TEST(tecDetails->calcceiling3m(), true); + tecDetails->set_calcalltissues(true); + TEST(tecDetails->calcalltissues(), true); + tecDetails->set_calcndltts(true); + TEST(tecDetails->calcndltts(), true); + tecDetails->set_hrgraph(true); + TEST(tecDetails->hrgraph(), true); + tecDetails->set_tankbar(true); + TEST(tecDetails->tankbar(), true); + tecDetails->set_percentagegraph(true); + TEST(tecDetails->percentagegraph(), true); + tecDetails->set_rulergraph(true); + TEST(tecDetails->rulergraph(), true); + tecDetails->set_show_ccr_setpoint(true); + TEST(tecDetails->show_ccr_setpoint(), true); + tecDetails->set_show_ccr_sensors(true); + TEST(tecDetails->show_ccr_sensors(), true); + tecDetails->set_zoomed_plot(true); + TEST(tecDetails->zoomed_plot(), true); + tecDetails->set_show_sac(true); + TEST(tecDetails->show_sac(), true); + tecDetails->set_display_unused_tanks(true); + TEST(tecDetails->display_unused_tanks(), true); + tecDetails->set_show_average_depth(true); + TEST(tecDetails->show_average_depth(), true); + tecDetails->set_show_pictures_in_profile(true); + TEST(tecDetails->show_pictures_in_profile(), true); + + tecDetails->set_ead(false); + TEST(tecDetails->ead(), false); + tecDetails->set_mod(false); + TEST(tecDetails->mod(), false); + tecDetails->set_dcceiling(false); + TEST(tecDetails->dcceiling(), false); + tecDetails->set_redceiling(false); + TEST(tecDetails->redceiling(), false); + tecDetails->set_calcceiling(false); + TEST(tecDetails->calcceiling(), false); + tecDetails->set_calcceiling3m(false); + TEST(tecDetails->calcceiling3m(), false); + tecDetails->set_calcalltissues(false); + TEST(tecDetails->calcalltissues(), false); + tecDetails->set_calcndltts(false); + TEST(tecDetails->calcndltts(), false); + tecDetails->set_hrgraph(false); + TEST(tecDetails->hrgraph(), false); + tecDetails->set_tankbar(false); + TEST(tecDetails->tankbar(), false); + tecDetails->set_percentagegraph(false); + TEST(tecDetails->percentagegraph(), false); + tecDetails->set_rulergraph(false); + TEST(tecDetails->rulergraph(), false); + tecDetails->set_show_ccr_setpoint(false); + TEST(tecDetails->show_ccr_setpoint(), false); + tecDetails->set_show_ccr_sensors(false); + TEST(tecDetails->show_ccr_sensors(), false); + tecDetails->set_zoomed_plot(false); + TEST(tecDetails->zoomed_plot(), false); + tecDetails->set_show_sac(false); + TEST(tecDetails->show_sac(), false); + tecDetails->set_display_unused_tanks(false); + TEST(tecDetails->display_unused_tanks(), false); + tecDetails->set_show_average_depth(false); + TEST(tecDetails->show_average_depth(), false); + tecDetails->set_show_pictures_in_profile(false); + TEST(tecDetails->show_pictures_in_profile(), false); +} + QTEST_MAIN(TestQPrefTechnicalDetails) diff --git a/tests/testqPrefTechnicalDetails.h b/tests/testqPrefTechnicalDetails.h index 8e935a621..41471cafa 100644 --- a/tests/testqPrefTechnicalDetails.h +++ b/tests/testqPrefTechnicalDetails.h @@ -14,6 +14,7 @@ private slots: void test_set_load_struct(); void test_struct_disk(); void test_multiple(); + void test_oldPreferences(); }; #endif // TESTQPREFTECHNICALDETAILS_H |