a bunch more patches. this fixes a couple of bugs too - one of the tests don't pass yet (working on that currently)
Tomaz On Fri, Oct 14, 2016 at 10:46 AM, Tomaz Canabrava <tcanabr...@kde.org> wrote: > had the time to finish some patches today, and I also hope to continue > finishing others. > Those tests pass. :D > > >
From 591a05c1b8389be4c6bb908c055307c8c555d4d9 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <tcanabr...@kde.org> Date: Sat, 15 Oct 2016 18:54:21 +0200 Subject: [PATCH 3/8] Save tests for Partial Pressure Gas Signed-off-by: Tomaz Canabrava <tcanabr...@kde.org> --- tests/testpreferences.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index b22fb4e..d1d0012 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -201,6 +201,36 @@ void TestPreferences::testPreferences() TEST(tecDetails->showAverageDepth(), false); tecDetails->setShowPicturesInProfile(false); TEST(tecDetails->showPicturesInProfile(), false); + + auto pp = pref->pp_gas; + pp->setShowPn2(1); + pp->setShowPhe(2); + pp->setShowPo2(3); + pp->setPo2Threshold(1.0); + pp->setPn2Threshold(2.0); + pp->setPheThreshold(3.0); + + TEST(pp->showPn2(), (short) 1); + TEST(pp->showPhe(), (short) 2); + TEST(pp->showPo2(), (short) 3); + TEST(pp->pn2Threshold(), 1.0); + TEST(pp->pheThreshold(), 2.0); + TEST(pp->po2Threshold(), 3.0); + + pp->setShowPn2(4); + pp->setShowPhe(5); + pp->setShowPo2(6); + pp->setPo2Threshold(4.0); + pp->setPn2Threshold(5.0); + pp->setPheThreshold(6.0); + + TEST(pp->showPn2(), (short) 4); + TEST(pp->showPhe(), (short) 5); + TEST(pp->showPo2(), (short) 6); + TEST(pp->pn2Threshold(), 4.0); + TEST(pp->pheThreshold(), 5.0); + TEST(pp->po2Threshold(), 6.0); + } QTEST_MAIN(TestPreferences) -- 2.10.0
From 50d6c81a09c6ada7c1b214ceccb065a8e1e19e7a Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <tcanabr...@kde.org> Date: Sat, 15 Oct 2016 18:59:17 +0200 Subject: [PATCH 4/8] Test the facebook preferences. Signed-off-by: Tomaz Canabrava <tcanabr...@kde.org> --- tests/testpreferences.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index d1d0012..e9ea719 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -231,6 +231,22 @@ void TestPreferences::testPreferences() TEST(pp->pheThreshold(), 5.0); TEST(pp->po2Threshold(), 6.0); + auto fb = pref->facebook; + fb->setAccessToken("rand-access-token"); + fb->setUserId("tomaz-user-id"); + fb->setAlbumId("album-id"); + + TEST(fb->accessToken(),QStringLiteral("rand-access-token")); + TEST(fb->userId(), QStringLiteral("tomaz-user-id")); + TEST(fb->albumId(), QStringLiteral("album-id")); + + fb->setAccessToken("rand-access-token-2"); + fb->setUserId("tomaz-user-id-2"); + fb->setAlbumId("album-id-2"); + + TEST(fb->accessToken(),QStringLiteral("rand-access-token-2")); + TEST(fb->userId(), QStringLiteral("tomaz-user-id-2")); + TEST(fb->albumId(), QStringLiteral("album-id-2")); } QTEST_MAIN(TestPreferences) -- 2.10.0
From 9ed9e9882f39c864e3c95a73b30aff3a33d2629d Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <tcanabr...@kde.org> Date: Sat, 15 Oct 2016 19:21:44 +0200 Subject: [PATCH 5/8] Geologation testcase. Signed-off-by: Tomaz Canabrava <tcanabr...@kde.org> --- core/subsurface-qt/SettingsObjectWrapper.h | 6 +++--- tests/testpreferences.cpp | 33 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h index 8097fc3..8fd164f 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.h +++ b/core/subsurface-qt/SettingsObjectWrapper.h @@ -268,9 +268,9 @@ public slots: void setEnableGeocoding(bool value); void setParseDiveWithoutGps(bool value); void setTagExistingDives(bool value); - void setFirstTaxonomyCategory(taxonomy_category value); - void setSecondTaxonomyCategory(taxonomy_category value); - void setThirdTaxonomyCategory(taxonomy_category value); + void setFirstTaxonomyCategory(taxonomy_category value); + void setSecondTaxonomyCategory(taxonomy_category value); + void setThirdTaxonomyCategory(taxonomy_category value); signals: void enableGeocodingChanged(bool value); diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index e9ea719..9f66889 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -247,6 +247,39 @@ void TestPreferences::testPreferences() TEST(fb->accessToken(),QStringLiteral("rand-access-token-2")); TEST(fb->userId(), QStringLiteral("tomaz-user-id-2")); TEST(fb->albumId(), QStringLiteral("album-id-2")); + + auto geo = pref->geocoding; + geo->setEnableGeocoding(true); + geo->setParseDiveWithoutGps(true); + geo->setTagExistingDives(true); + + TEST(geo->enableGeocoding(),true); + TEST(geo->parseDiveWithoutGps(),true); + TEST(geo->tagExistingDives(),true); + + geo->setFirstTaxonomyCategory(TC_NONE); + geo->setSecondTaxonomyCategory(TC_OCEAN); + geo->setThirdTaxonomyCategory(TC_COUNTRY); + + TEST(geo->firstTaxonomyCategory(), TC_NONE); + TEST(geo->secondTaxonomyCategory(), TC_OCEAN); + TEST(geo->thirdTaxonomyCategory(), TC_COUNTRY); + + geo->setEnableGeocoding(false); + geo->setParseDiveWithoutGps(false); + geo->setTagExistingDives(false); + + TEST(geo->enableGeocoding(),false); + TEST(geo->parseDiveWithoutGps(),false); + TEST(geo->tagExistingDives(),false); + + geo->setFirstTaxonomyCategory(TC_OCEAN); + geo->setSecondTaxonomyCategory(TC_COUNTRY); + geo->setThirdTaxonomyCategory(TC_NONE); + + TEST(geo->firstTaxonomyCategory(), TC_OCEAN); + TEST(geo->secondTaxonomyCategory(), TC_COUNTRY); + TEST(geo->thirdTaxonomyCategory(), TC_NONE); } QTEST_MAIN(TestPreferences) -- 2.10.0
From 5d7b57ad0fbf6932725d5190143c7fb59f818095 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <tcanabr...@kde.org> Date: Sat, 15 Oct 2016 19:30:09 +0200 Subject: [PATCH 6/8] Tests for Proxy preferences. Signed-off-by: Tomaz Canabrava <tcanabr...@kde.org> --- tests/testpreferences.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index 9f66889..1814175 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -280,6 +280,35 @@ void TestPreferences::testPreferences() TEST(geo->firstTaxonomyCategory(), TC_OCEAN); TEST(geo->secondTaxonomyCategory(), TC_COUNTRY); TEST(geo->thirdTaxonomyCategory(), TC_NONE); + + auto proxy = pref->proxy; + proxy->setType(2); + proxy->setPort(80); + proxy->setAuth((short) 5); + proxy->setHost("localhost"); + proxy->setUser("unknown"); + proxy->setPass("secret"); + + TEST(proxy->type(),2); + TEST(proxy->port(),80); + TEST(proxy->auth(),(short) 5); + TEST(proxy->host(),QStringLiteral("localhost")); + TEST(proxy->user(),QStringLiteral("unknown")); + TEST(proxy->pass(),QStringLiteral("secret")); + + proxy->setType(3); + proxy->setPort(8080); + proxy->setAuth((short) 6); + proxy->setHost("127.0.0.1"); + proxy->setUser("unknown_1"); + proxy->setPass("secret_1"); + + TEST(proxy->type(),3); + TEST(proxy->port(),8080); + TEST(proxy->auth(),(short) 6); + TEST(proxy->host(),QStringLiteral("localhost_1")); + TEST(proxy->user(),QStringLiteral("unknown_1")); + TEST(proxy->pass(),QStringLiteral("secret_1")); } QTEST_MAIN(TestPreferences) -- 2.10.0
From a89c5e664dd994480caa4b01544b67ecd181e7b0 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <tcanabr...@kde.org> Date: Sat, 15 Oct 2016 19:52:17 +0200 Subject: [PATCH 7/8] Add Planner Settings test Plus: fix a typo. Signed-off-by: Tomaz Canabrava <tcanabr...@kde.org> --- core/subsurface-qt/SettingsObjectWrapper.cpp | 2 +- core/subsurface-qt/SettingsObjectWrapper.h | 4 +- tests/testpreferences.cpp | 101 +++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 3 deletions(-) diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index 8303afa..29b1043 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -1495,7 +1495,7 @@ void DivePlannerSettings::setBottomSac(int value) emit bottomSacChanged(value); } -void DivePlannerSettings::setSecoSac(int value) +void DivePlannerSettings::setDecoSac(int value) { if (value == prefs.decosac) return; diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h index 8fd164f..eeec3ab 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.h +++ b/core/subsurface-qt/SettingsObjectWrapper.h @@ -403,7 +403,7 @@ class DivePlannerSettings : public QObject { Q_PROPERTY(int reserve_gas READ reserveGas WRITE setReserveGas NOTIFY reserveGasChanged) Q_PROPERTY(int min_switch_duration READ minSwitchDuration WRITE setMinSwitchDuration NOTIFY minSwitchDurationChanged) Q_PROPERTY(int bottomsac READ bottomSac WRITE setBottomSac NOTIFY bottomSacChanged) - Q_PROPERTY(int decosac READ decoSac WRITE setSecoSac NOTIFY decoSacChanged) + Q_PROPERTY(int decosac READ decoSac WRITE setDecoSac NOTIFY decoSacChanged) Q_PROPERTY(deco_mode decoMode READ decoMode WRITE setDecoMode NOTIFY decoModeChanged) public: @@ -452,7 +452,7 @@ public slots: void setReserveGas(int value); void setMinSwitchDuration(int value); void setBottomSac(int value); - void setSecoSac(int value); + void setDecoSac(int value); void setDecoMode(deco_mode value); signals: diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index 1814175..22ffbbd 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -309,6 +309,107 @@ void TestPreferences::testPreferences() TEST(proxy->host(),QStringLiteral("localhost_1")); TEST(proxy->user(),QStringLiteral("unknown_1")); TEST(proxy->pass(),QStringLiteral("secret_1")); + + auto planner = pref->planner_settings; + planner->setLastStop(true); + planner->setVerbatimPlan(true); + planner->setDisplayRuntime(true); + planner->setDisplayDuration(true); + planner->setDisplayTransitions(true); + planner->setDoo2breaks(true); + planner->setDropStoneMode(true); + planner->setSafetyStop(true); + planner->setSwitchAtRequiredStop(true); + + planner->setAscrate75(1); + planner->setAscrate50(2); + planner->setAscratestops(3); + planner->setAscratelast6m(4); + planner->setDescrate(5); + planner->setBottompo2(6); + planner->setDecopo2(7); + planner->setBestmixend(8); + planner->setReserveGas(9); + planner->setMinSwitchDuration(10); + planner->setBottomSac(11); + planner->setDecoSac(12); + + planner->setDecoMode(BUEHLMANN); + + TEST(planner->lastStop(),true); + TEST(planner->verbatimPlan(),true); + TEST(planner->displayRuntime(),true); + TEST(planner->displayDuration(),true); + TEST(planner->displayTransitions(),true); + TEST(planner->doo2breaks(),true); + TEST(planner->dropStoneMode(),true); + TEST(planner->safetyStop(),true); + TEST(planner->switchAtRequiredStop(),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(),8); + TEST(planner->reserveGas(),9); + TEST(planner->minSwitchDuration(),10); + TEST(planner->bottomSac(),11); + TEST(planner->decoSac(),12); + + TEST(planner->decoMode(),BUEHLMANN); + + planner->setLastStop(false); + planner->setVerbatimPlan(false); + planner->setDisplayRuntime(false); + planner->setDisplayDuration(false); + planner->setDisplayTransitions(false); + planner->setDoo2breaks(false); + planner->setDropStoneMode(false); + planner->setSafetyStop(false); + planner->setSwitchAtRequiredStop(false); + + planner->setAscrate75(11); + planner->setAscrate50(12); + planner->setAscratestops(13); + planner->setAscratelast6m(14); + planner->setDescrate(15); + planner->setBottompo2(16); + planner->setDecopo2(17); + planner->setBestmixend(18); + planner->setReserveGas(19); + planner->setMinSwitchDuration(110); + planner->setBottomSac(111); + planner->setDecoSac(112); + + planner->setDecoMode(RECREATIONAL); + + TEST(planner->lastStop(),false); + TEST(planner->verbatimPlan(),false); + TEST(planner->displayRuntime(),false); + TEST(planner->displayDuration(),false); + TEST(planner->displayTransitions(),false); + TEST(planner->doo2breaks(),false); + TEST(planner->dropStoneMode(),false); + TEST(planner->safetyStop(),false); + TEST(planner->switchAtRequiredStop(),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(),18); + TEST(planner->reserveGas(),19); + TEST(planner->minSwitchDuration(),110); + TEST(planner->bottomSac(),111); + TEST(planner->decoSac(),112); + + TEST(planner->decoMode(),RECREATIONAL); } QTEST_MAIN(TestPreferences) -- 2.10.0
From ca76f4dd93fac938b9fb208762134dd205663086 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <tcanabr...@kde.org> Date: Sat, 15 Oct 2016 20:18:56 +0200 Subject: [PATCH 8/8] Update a few tests, implement Planner Also, fixed a typo that caused a bug. Signed-off-by: Tomaz Canabrava <tcanabr...@kde.org> --- core/subsurface-qt/SettingsObjectWrapper.cpp | 8 +++---- tests/testpreferences.cpp | 36 ++++++++++++++-------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index 29b1043..417b904 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -2229,13 +2229,11 @@ void SettingsObjectWrapper::load() // GeoManagement s.beginGroup("geocoding"); -#ifdef DISABLED + GET_BOOL("enable_geocoding", geocoding.enable_geocoding); - GET_BOOL("parse_dive_without_gps", geocoding.parse_dive_without_gps); + GET_BOOL("parse_dives_without_gps", geocoding.parse_dive_without_gps); GET_BOOL("tag_existing_dives", geocoding.tag_existing_dives); -#else - prefs.geocoding.enable_geocoding = true; -#endif + GET_ENUM("cat0", taxonomy_category, geocoding.category[0]); GET_ENUM("cat1", taxonomy_category, geocoding.category[1]); GET_ENUM("cat2", taxonomy_category, geocoding.category[2]); diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index 22ffbbd..069e78d 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -203,33 +203,33 @@ void TestPreferences::testPreferences() TEST(tecDetails->showPicturesInProfile(), false); auto pp = pref->pp_gas; - pp->setShowPn2(1); - pp->setShowPhe(2); - pp->setShowPo2(3); + pp->setShowPn2(false); + pp->setShowPhe(false); + pp->setShowPo2(false); pp->setPo2Threshold(1.0); pp->setPn2Threshold(2.0); pp->setPheThreshold(3.0); - TEST(pp->showPn2(), (short) 1); - TEST(pp->showPhe(), (short) 2); - TEST(pp->showPo2(), (short) 3); - TEST(pp->pn2Threshold(), 1.0); - TEST(pp->pheThreshold(), 2.0); - TEST(pp->po2Threshold(), 3.0); + TEST(pp->showPn2(), (short) false); + TEST(pp->showPhe(), (short) false); + TEST(pp->showPo2(), (short) false); + TEST(pp->pn2Threshold(), 2.0); + TEST(pp->pheThreshold(), 3.0); + TEST(pp->po2Threshold(), 1.0); - pp->setShowPn2(4); - pp->setShowPhe(5); - pp->setShowPo2(6); + pp->setShowPn2(true); + pp->setShowPhe(true); + pp->setShowPo2(true); pp->setPo2Threshold(4.0); pp->setPn2Threshold(5.0); pp->setPheThreshold(6.0); - TEST(pp->showPn2(), (short) 4); - TEST(pp->showPhe(), (short) 5); - TEST(pp->showPo2(), (short) 6); - TEST(pp->pn2Threshold(), 4.0); - TEST(pp->pheThreshold(), 5.0); - TEST(pp->po2Threshold(), 6.0); + TEST(pp->showPn2(), (short) true); + TEST(pp->showPhe(), (short) true); + TEST(pp->showPo2(), (short) true); + TEST(pp->pn2Threshold(), 5.0); + TEST(pp->pheThreshold(), 6.0); + TEST(pp->po2Threshold(), 4.0); auto fb = pref->facebook; fb->setAccessToken("rand-access-token"); -- 2.10.0
_______________________________________________ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface