summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar willemferguson <willemferguson@zoology.up.ac.za>2019-12-09 20:58:20 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-25 02:57:42 +0900
commitb6c3cdb20cbcb1654c83d555d278476f55d3d103 (patch)
tree67c566c81e286391f804660f7cd0017ada058902 /tests
parentb24caa4e2db42d300e3806ca3d13ce72202a24d8 (diff)
downloadsubsurface-b6c3cdb20cbcb1654c83d555d278476f55d3d103.tar.gz
Preferences UI: add dive log tab
This adds a tab for dive log - related preferences. A suitable test programs is still required. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/testqPrefGeneral.cpp53
-rw-r--r--tests/testqPrefTechnicalDetails.cpp19
2 files changed, 0 insertions, 72 deletions
diff --git a/tests/testqPrefGeneral.cpp b/tests/testqPrefGeneral.cpp
index 9718650ed..4910647f1 100644
--- a/tests/testqPrefGeneral.cpp
+++ b/tests/testqPrefGeneral.cpp
@@ -23,19 +23,13 @@ void TestQPrefGeneral::test_struct_get()
auto tst = qPrefGeneral::instance();
- prefs.default_filename = copy_qstring("new base12");
- prefs.default_file_behavior = UNDEFINED_DEFAULT_FILE;
prefs.defaultsetpoint = 14;
prefs.o2consumption = 17;
prefs.pscr_ratio = 18;
- prefs.use_default_file = true;
- QCOMPARE(tst->default_filename(), QString(prefs.default_filename));
- QCOMPARE(tst->default_file_behavior(), prefs.default_file_behavior);
QCOMPARE(tst->defaultsetpoint(), prefs.defaultsetpoint);
QCOMPARE(tst->o2consumption(), prefs.o2consumption);
QCOMPARE(tst->pscr_ratio(), prefs.pscr_ratio);
- QCOMPARE(tst->use_default_file(), prefs.use_default_file);
}
void TestQPrefGeneral::test_set_struct()
@@ -44,21 +38,15 @@ void TestQPrefGeneral::test_set_struct()
auto tst = qPrefGeneral::instance();
- tst->set_default_filename("new base22");
- tst->set_default_file_behavior(LOCAL_DEFAULT_FILE);
tst->set_defaultsetpoint(24);
tst->set_o2consumption(27);
tst->set_pscr_ratio(28);
- tst->set_use_default_file(false);
tst->set_diveshareExport_uid("uid1");
tst->set_diveshareExport_private(false);
- QCOMPARE(QString(prefs.default_filename), QString("new base22"));
- QCOMPARE(prefs.default_file_behavior, LOCAL_DEFAULT_FILE);
QCOMPARE(prefs.defaultsetpoint, 24);
QCOMPARE(prefs.o2consumption, 27);
QCOMPARE(prefs.pscr_ratio, 28);
- QCOMPARE(prefs.use_default_file, false);
QCOMPARE(tst->diveshareExport_uid(), QString("uid1"));
QCOMPARE(tst->diveshareExport_private(), false);
}
@@ -69,29 +57,20 @@ void TestQPrefGeneral::test_set_load_struct()
auto tst = qPrefGeneral::instance();
- tst->set_default_filename("new base32");
- tst->set_default_file_behavior(NO_DEFAULT_FILE);
tst->set_defaultsetpoint(34);
tst->set_o2consumption(37);
tst->set_pscr_ratio(38);
- tst->set_use_default_file(true);
tst->set_diveshareExport_uid("uid2");
tst->set_diveshareExport_private(true);
- prefs.default_filename = copy_qstring("error");
- prefs.default_file_behavior = UNDEFINED_DEFAULT_FILE;
prefs.defaultsetpoint = 14;
prefs.o2consumption = 17;
prefs.pscr_ratio = 18;
- prefs.use_default_file = false;
tst->load();
- QCOMPARE(QString(prefs.default_filename), QString("new base32"));
- QCOMPARE(prefs.default_file_behavior, NO_DEFAULT_FILE);
QCOMPARE(prefs.defaultsetpoint, 34);
QCOMPARE(prefs.o2consumption, 37);
QCOMPARE(prefs.pscr_ratio, 38);
- QCOMPARE(prefs.use_default_file, true);
QCOMPARE(tst->diveshareExport_uid(), QString("uid2"));
QCOMPARE(tst->diveshareExport_private(), true);
}
@@ -102,28 +81,19 @@ void TestQPrefGeneral::test_struct_disk()
auto tst = qPrefGeneral::instance();
- prefs.default_filename = copy_qstring("base42");
- prefs.default_file_behavior = CLOUD_DEFAULT_FILE;
prefs.defaultsetpoint = 44;
prefs.o2consumption = 47;
prefs.pscr_ratio = 48;
- prefs.use_default_file = true;
tst->sync();
- prefs.default_filename = copy_qstring("error");
- prefs.default_file_behavior = UNDEFINED_DEFAULT_FILE;
prefs.defaultsetpoint = 14;
prefs.o2consumption = 17;
prefs.pscr_ratio = 18;
- prefs.use_default_file = false;
tst->load();
- QCOMPARE(QString(prefs.default_filename), QString("base42"));
- QCOMPARE(prefs.default_file_behavior, CLOUD_DEFAULT_FILE);
QCOMPARE(prefs.defaultsetpoint, 44);
QCOMPARE(prefs.o2consumption, 47);
QCOMPARE(prefs.pscr_ratio, 48);
- QCOMPARE(prefs.use_default_file, true);
}
void TestQPrefGeneral::test_multiple()
@@ -150,63 +120,40 @@ void TestQPrefGeneral::test_oldPreferences()
{
auto general = qPrefGeneral::instance();
- general->set_default_filename("filename");
- 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_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");
- //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_file_behavior(), CLOUD_DEFAULT_FILE);
TEST(general->defaultsetpoint(), 1);
TEST(general->o2consumption(), 1);
TEST(general->pscr_ratio(), 1);
- TEST(general->use_default_file(), false);
}
void TestQPrefGeneral::test_signals()
{
- QSignalSpy spy3(qPrefGeneral::instance(), &qPrefGeneral::default_filenameChanged);
- QSignalSpy spy4(qPrefGeneral::instance(), &qPrefGeneral::default_file_behaviorChanged);
QSignalSpy spy5(qPrefGeneral::instance(), &qPrefGeneral::defaultsetpointChanged);
QSignalSpy spy9(qPrefGeneral::instance(), &qPrefGeneral::o2consumptionChanged);
QSignalSpy spy10(qPrefGeneral::instance(), &qPrefGeneral::pscr_ratioChanged);
- QSignalSpy spy11(qPrefGeneral::instance(), &qPrefGeneral::use_default_fileChanged);
QSignalSpy spy12(qPrefGeneral::instance(), &qPrefGeneral::diveshareExport_uidChanged);
QSignalSpy spy13(qPrefGeneral::instance(), &qPrefGeneral::diveshareExport_privateChanged);
- qPrefGeneral::set_default_filename("new base22");
- qPrefGeneral::set_default_file_behavior(LOCAL_DEFAULT_FILE);
qPrefGeneral::set_defaultsetpoint(24);
qPrefGeneral::set_o2consumption(27);
qPrefGeneral::set_pscr_ratio(28);
- qPrefGeneral::set_use_default_file(false);
qPrefGeneral::set_diveshareExport_uid("uid1");
qPrefGeneral::set_diveshareExport_private(false);
- qPrefGeneral::set_default_filename("new base22");
- qPrefGeneral::set_default_file_behavior(LOCAL_DEFAULT_FILE);
qPrefGeneral::set_defaultsetpoint(24);
qPrefGeneral::set_o2consumption(27);
qPrefGeneral::set_pscr_ratio(28);
- qPrefGeneral::set_use_default_file(false);
qPrefGeneral::set_diveshareExport_uid("uid1");
qPrefGeneral::set_diveshareExport_private(false);
}
diff --git a/tests/testqPrefTechnicalDetails.cpp b/tests/testqPrefTechnicalDetails.cpp
index b6272dbff..49a6829d6 100644
--- a/tests/testqPrefTechnicalDetails.cpp
+++ b/tests/testqPrefTechnicalDetails.cpp
@@ -39,7 +39,6 @@ void TestQPrefTechnicalDetails::test_struct_get()
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;
@@ -65,7 +64,6 @@ void TestQPrefTechnicalDetails::test_struct_get()
QCOMPARE(tst->percentagegraph(), prefs.percentagegraph);
QCOMPARE(tst->redceiling(), prefs.redceiling);
QCOMPARE(tst->rulergraph(), prefs.rulergraph);
- QCOMPARE(tst->show_average_depth(), prefs.show_average_depth);
QCOMPARE(tst->show_ccr_sensors(), prefs.show_ccr_sensors);
QCOMPARE(tst->show_ccr_setpoint(), prefs.show_ccr_setpoint);
QCOMPARE(tst->show_icd(), prefs.show_icd);
@@ -99,7 +97,6 @@ void TestQPrefTechnicalDetails::test_set_struct()
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);
@@ -125,7 +122,6 @@ void TestQPrefTechnicalDetails::test_set_struct()
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);
@@ -159,7 +155,6 @@ void TestQPrefTechnicalDetails::test_set_load_struct()
tst->set_percentagegraph(false);
tst->set_redceiling(false);
tst->set_rulergraph(false);
- tst->set_show_average_depth(true);
tst->set_show_ccr_sensors(true);
tst->set_show_ccr_setpoint(true);
tst->set_show_icd(true);
@@ -186,7 +181,6 @@ void TestQPrefTechnicalDetails::test_set_load_struct()
prefs.percentagegraph = true;
prefs.redceiling = true;
prefs.rulergraph = true;
- prefs.show_average_depth = false;
prefs.show_ccr_sensors = false;
prefs.show_ccr_setpoint = false;
prefs.show_icd = false;
@@ -213,7 +207,6 @@ void TestQPrefTechnicalDetails::test_set_load_struct()
QCOMPARE(prefs.percentagegraph, false);
QCOMPARE(prefs.redceiling, false);
QCOMPARE(prefs.rulergraph, false);
- QCOMPARE(prefs.show_average_depth, true);
QCOMPARE(prefs.show_ccr_sensors, true);
QCOMPARE(prefs.show_ccr_setpoint, true);
QCOMPARE(prefs.show_icd, true);
@@ -247,7 +240,6 @@ void TestQPrefTechnicalDetails::test_struct_disk()
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;
@@ -275,7 +267,6 @@ void TestQPrefTechnicalDetails::test_struct_disk()
prefs.percentagegraph = false;
prefs.redceiling = false;
prefs.rulergraph = false;
- prefs.show_average_depth = false;
prefs.show_ccr_sensors = false;
prefs.show_ccr_setpoint = false;
prefs.show_icd = false;
@@ -302,7 +293,6 @@ void TestQPrefTechnicalDetails::test_struct_disk()
QCOMPARE(prefs.percentagegraph, true);
QCOMPARE(prefs.redceiling, true);
QCOMPARE(prefs.rulergraph, true);
- QCOMPARE(prefs.show_average_depth, true);
QCOMPARE(prefs.show_ccr_sensors, true);
QCOMPARE(prefs.show_ccr_setpoint, true);
QCOMPARE(prefs.show_icd, true);
@@ -389,8 +379,6 @@ void TestQPrefTechnicalDetails::test_oldPreferences()
TEST(tecDetails->zoomed_plot(), true);
tecDetails->set_show_sac(true);
TEST(tecDetails->show_sac(), 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);
@@ -426,8 +414,6 @@ void TestQPrefTechnicalDetails::test_oldPreferences()
TEST(tecDetails->zoomed_plot(), false);
tecDetails->set_show_sac(false);
TEST(tecDetails->show_sac(), 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);
}
@@ -450,7 +436,6 @@ void TestQPrefTechnicalDetails::test_signals()
QSignalSpy spy15(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::percentagegraphChanged);
QSignalSpy spy16(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::redceilingChanged);
QSignalSpy spy17(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::rulergraphChanged);
- QSignalSpy spy18(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_average_depthChanged);
QSignalSpy spy19(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_ccr_sensorsChanged);
QSignalSpy spy20(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_ccr_setpointChanged);
QSignalSpy spy21(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_icdChanged);
@@ -489,8 +474,6 @@ void TestQPrefTechnicalDetails::test_signals()
qPrefTechnicalDetails::set_redceiling(false);
prefs.rulergraph = true;
qPrefTechnicalDetails::set_rulergraph(false);
- prefs.show_average_depth = true;
- qPrefTechnicalDetails::set_show_average_depth(false);
prefs.show_ccr_sensors = true;
qPrefTechnicalDetails::set_show_ccr_sensors(false);
prefs.show_ccr_setpoint = true;
@@ -525,7 +508,6 @@ void TestQPrefTechnicalDetails::test_signals()
QCOMPARE(spy15.count(), 1);
QCOMPARE(spy16.count(), 1);
QCOMPARE(spy17.count(), 1);
- QCOMPARE(spy18.count(), 1);
QCOMPARE(spy19.count(), 1);
QCOMPARE(spy20.count(), 1);
QCOMPARE(spy21.count(), 1);
@@ -552,7 +534,6 @@ void TestQPrefTechnicalDetails::test_signals()
QVERIFY(spy15.takeFirst().at(0).toBool() == false);
QVERIFY(spy16.takeFirst().at(0).toBool() == false);
QVERIFY(spy17.takeFirst().at(0).toBool() == false);
- QVERIFY(spy18.takeFirst().at(0).toBool() == false);
QVERIFY(spy19.takeFirst().at(0).toBool() == false);
QVERIFY(spy20.takeFirst().at(0).toBool() == false);
QVERIFY(spy21.takeFirst().at(0).toBool() == false);