tests: update qPref* to the shadow variable

The shadow variable causes properties only to be saved when
actual changed, therefore some test cases need update

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
jan Iversen 2018-09-02 09:13:04 +02:00 committed by Dirk Hohndel
parent ee6b5643b5
commit a93ecf3912
4 changed files with 71 additions and 71 deletions

View file

@ -41,7 +41,7 @@ void TestQPrefDisplay::test_set_struct()
auto display = qPrefDisplay::instance();
display->set_animation_speed(27);
display->set_display_invalid_dives(true);
display->set_display_invalid_dives(false);
display->set_divelist_font("doNotCareAtAll");
display->set_font_size(12.0);
display->set_show_developer(false);
@ -58,7 +58,7 @@ void TestQPrefDisplay::test_set_struct()
display->set_lastState(17);
QCOMPARE(prefs.animation_speed, 27);
QCOMPARE(prefs.display_invalid_dives, true);
QCOMPARE(prefs.display_invalid_dives, false);
QCOMPARE(prefs.divelist_font, "doNotCareAtAll");
QCOMPARE(prefs.font_size, 12.0);
QCOMPARE(prefs.show_developer, false);
@ -82,7 +82,7 @@ void TestQPrefDisplay::test_set_load_struct()
auto display = qPrefDisplay::instance();
display->set_animation_speed(33);
display->set_display_invalid_dives(false);
display->set_display_invalid_dives(true);
display->set_divelist_font("doNotCareString");
display->set_font_size(15.0);
display->set_show_developer(true);
@ -99,14 +99,14 @@ void TestQPrefDisplay::test_set_load_struct()
display->set_lastState(27);
prefs.animation_speed = 17;
prefs.display_invalid_dives = true;
prefs.display_invalid_dives = false;
prefs.divelist_font = copy_qstring("doNotCareAtAll");
prefs.font_size = 12.0;
prefs.show_developer = false;
display->load();
QCOMPARE(prefs.animation_speed, 33);
QCOMPARE(prefs.display_invalid_dives, false);
QCOMPARE(prefs.display_invalid_dives, true);
QCOMPARE(prefs.divelist_font, "doNotCareString");
QCOMPARE(prefs.font_size, 15.0);
QCOMPARE(prefs.show_developer, true);

View file

@ -152,21 +152,21 @@ void TestQPrefDivePlanner::test_set_load_struct()
tst->set_decopo2(26);
tst->set_decosac(27);
tst->set_descrate(28);
tst->set_display_duration(false);
tst->set_display_runtime(false);
tst->set_display_transitions(false);
tst->set_display_variations(false);
tst->set_doo2breaks(false);
tst->set_drop_stone_mode(false);
tst->set_last_stop(false);
tst->set_display_duration(true);
tst->set_display_runtime(true);
tst->set_display_transitions(true);
tst->set_display_variations(true);
tst->set_doo2breaks(true);
tst->set_drop_stone_mode(true);
tst->set_last_stop(true);
tst->set_min_switch_duration(29);
tst->set_planner_deco_mode(VPMB);
tst->set_problemsolvingtime(30);
tst->set_reserve_gas(31);
tst->set_sacfactor(32);
tst->set_safetystop(false);
tst->set_switch_at_req_stop(false);
tst->set_verbatim_plan(false);
tst->set_safetystop(true);
tst->set_switch_at_req_stop(true);
tst->set_verbatim_plan(true);
prefs.ascratelast6m = 10;
prefs.ascratestops = 11;
@ -178,21 +178,21 @@ void TestQPrefDivePlanner::test_set_load_struct()
prefs.decopo2 = 16;
prefs.decosac = 17;
prefs.descrate = 18;
prefs.display_duration = true;
prefs.display_runtime = true;
prefs.display_transitions = true;
prefs.display_variations = true;
prefs.doo2breaks = true;
prefs.drop_stone_mode = true;
prefs.last_stop = true;
prefs.display_duration = false;
prefs.display_runtime = false;
prefs.display_transitions = false;
prefs.display_variations = false;
prefs.doo2breaks = false;
prefs.drop_stone_mode = false;
prefs.last_stop = false;
prefs.min_switch_duration = 19;
prefs.planner_deco_mode = BUEHLMANN;
prefs.problemsolvingtime = 20;
prefs.reserve_gas = 21;
prefs.sacfactor = 22;
prefs.safetystop = true;
prefs.switch_at_req_stop = true;
prefs.verbatim_plan = true;
prefs.safetystop = false;
prefs.switch_at_req_stop = false;
prefs.verbatim_plan = false;
tst->load();
QCOMPARE(prefs.ascratelast6m, 20);
@ -205,21 +205,21 @@ void TestQPrefDivePlanner::test_set_load_struct()
QCOMPARE(prefs.decopo2, 26);
QCOMPARE(prefs.decosac, 27);
QCOMPARE(prefs.descrate, 28);
QCOMPARE(prefs.display_duration, false);
QCOMPARE(prefs.display_runtime, false);
QCOMPARE(prefs.display_transitions, false);
QCOMPARE(prefs.display_variations, false);
QCOMPARE(prefs.doo2breaks, false);
QCOMPARE(prefs.drop_stone_mode, false);
QCOMPARE(prefs.last_stop, false);
QCOMPARE(prefs.display_duration, true);
QCOMPARE(prefs.display_runtime, true);
QCOMPARE(prefs.display_transitions, true);
QCOMPARE(prefs.display_variations, true);
QCOMPARE(prefs.doo2breaks, true);
QCOMPARE(prefs.drop_stone_mode, true);
QCOMPARE(prefs.last_stop, true);
QCOMPARE(prefs.min_switch_duration, 29);
QCOMPARE(prefs.planner_deco_mode, VPMB);
QCOMPARE(prefs.problemsolvingtime, 30);
QCOMPARE(prefs.reserve_gas, 31);
QCOMPARE(prefs.sacfactor, 32);
QCOMPARE(prefs.safetystop, false);
QCOMPARE(prefs.switch_at_req_stop, false);
QCOMPARE(prefs.verbatim_plan, false);
QCOMPARE(prefs.safetystop, true);
QCOMPARE(prefs.switch_at_req_stop, true);
QCOMPARE(prefs.verbatim_plan, true);
}
void TestQPrefDivePlanner::test_struct_disk()

View file

@ -148,85 +148,85 @@ void TestQPrefTechnicalDetails::test_set_load_struct()
tst->set_calcceiling(false);
tst->set_calcceiling3m(false);
tst->set_calcndltts(false);
tst->set_dcceiling(false);
tst->set_dcceiling(true);
tst->set_display_deco_mode(RECREATIONAL);
tst->set_display_unused_tanks(false);
tst->set_ead(false);
tst->set_gfhigh(29);
tst->set_gflow(24);
tst->set_gf_low_at_maxdepth(false);
tst->set_gf_low_at_maxdepth(true);
tst->set_hrgraph(false);
tst->set_mod(false);
tst->set_modpO2(1.12);
tst->set_percentagegraph(false);
tst->set_redceiling(false);
tst->set_rulergraph(false);
tst->set_show_average_depth(false);
tst->set_show_ccr_sensors(false);
tst->set_show_ccr_setpoint(false);
tst->set_show_icd(false);
tst->set_show_pictures_in_profile(false);
tst->set_show_sac(false);
tst->set_show_scr_ocpo2(false);
tst->set_tankbar(false);
tst->set_show_average_depth(true);
tst->set_show_ccr_sensors(true);
tst->set_show_ccr_setpoint(true);
tst->set_show_icd(true);
tst->set_show_pictures_in_profile(true);
tst->set_show_sac(true);
tst->set_show_scr_ocpo2(true);
tst->set_tankbar(true);
tst->set_vpmb_conservatism(64);
tst->set_zoomed_plot(false);
tst->set_zoomed_plot(true);
prefs.calcalltissues = true;
prefs.calcceiling = true;
prefs.calcceiling3m = true;
prefs.calcndltts = true;
prefs.dcceiling = true;
prefs.dcceiling = false;
prefs.display_deco_mode = BUEHLMANN;
prefs.display_unused_tanks = true;
prefs.ead = true;
prefs.gfhigh = 27;
prefs.gflow = 25;
prefs.gf_low_at_maxdepth = true;
prefs.gf_low_at_maxdepth = false;
prefs.hrgraph = true;
prefs.mod = true;
prefs.modpO2 = 1.02;
prefs.percentagegraph = true;
prefs.redceiling = true;
prefs.rulergraph = true;
prefs.show_average_depth = true;
prefs.show_ccr_sensors = true;
prefs.show_ccr_setpoint = true;
prefs.show_icd = true;
prefs.show_pictures_in_profile = true;
prefs.show_sac = true;
prefs.show_scr_ocpo2 = true;
prefs.tankbar = true;
prefs.show_average_depth = false;
prefs.show_ccr_sensors = false;
prefs.show_ccr_setpoint = false;
prefs.show_icd = false;
prefs.show_pictures_in_profile = false;
prefs.show_sac = false;
prefs.show_scr_ocpo2 = false;
prefs.tankbar = false;
prefs.vpmb_conservatism = 123;
prefs.zoomed_plot = true;
prefs.zoomed_plot = false;
tst->load();
QCOMPARE(prefs.calcceiling, false);
QCOMPARE(prefs.calcceiling3m, false);
QCOMPARE(prefs.calcndltts, false);
QCOMPARE(prefs.dcceiling, false);
QCOMPARE(prefs.dcceiling, true);
QCOMPARE(prefs.display_deco_mode, RECREATIONAL);
QCOMPARE(prefs.display_unused_tanks, false);
QCOMPARE(prefs.ead, false);
QCOMPARE((int)prefs.gfhigh, 29);
QCOMPARE((int)prefs.gflow, 24);
QCOMPARE(prefs.gf_low_at_maxdepth, false);
QCOMPARE(prefs.gf_low_at_maxdepth, true);
QCOMPARE(prefs.hrgraph, false);
QCOMPARE(prefs.mod, false);
QCOMPARE(prefs.modpO2, 1.12);
QCOMPARE(prefs.percentagegraph, false);
QCOMPARE(prefs.redceiling, false);
QCOMPARE(prefs.rulergraph, false);
QCOMPARE(prefs.show_average_depth, false);
QCOMPARE(prefs.show_ccr_sensors, false);
QCOMPARE(prefs.show_ccr_setpoint, false);
QCOMPARE(prefs.show_icd, false);
QCOMPARE(prefs.show_pictures_in_profile, false);
QCOMPARE(prefs.show_sac, false);
QCOMPARE(prefs.show_scr_ocpo2, false);
QCOMPARE(prefs.tankbar, false);
QCOMPARE(prefs.show_average_depth, true);
QCOMPARE(prefs.show_ccr_sensors, true);
QCOMPARE(prefs.show_ccr_setpoint, true);
QCOMPARE(prefs.show_icd, true);
QCOMPARE(prefs.show_pictures_in_profile, true);
QCOMPARE(prefs.show_sac, true);
QCOMPARE(prefs.show_scr_ocpo2, true);
QCOMPARE(prefs.tankbar, true);
QCOMPARE((int)prefs.vpmb_conservatism, 64);
QCOMPARE(prefs.zoomed_plot, false);
QCOMPARE(prefs.zoomed_plot, true);
}
void TestQPrefTechnicalDetails::test_struct_disk()

View file

@ -74,7 +74,7 @@ void TestQPrefUnits::test_set_load_struct()
auto tst = qPrefUnits::instance();
tst->set_coordinates_traditional(false);
tst->set_coordinates_traditional(true);
tst->set_duration_units(units::MINUTES_ONLY);
tst->set_length(units::FEET);
tst->set_pressure(units::PSI);
@ -85,7 +85,7 @@ void TestQPrefUnits::test_set_load_struct()
tst->set_weight(units::LBS);
tst->sync();
prefs.coordinates_traditional = true;
prefs.coordinates_traditional = false;
prefs.units.duration_units = units::MIXED;
prefs.units.length = units::METERS;
prefs.units.pressure = units::BAR;
@ -96,7 +96,7 @@ void TestQPrefUnits::test_set_load_struct()
prefs.units.weight = units::KG;
tst->load();
QCOMPARE(prefs.coordinates_traditional, false);
QCOMPARE(prefs.coordinates_traditional, true);
QCOMPARE(prefs.units.duration_units, units::MINUTES_ONLY);
QCOMPARE(prefs.units.length, units::FEET);
QCOMPARE(prefs.units.pressure, units::PSI);