aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testpreferences.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2016-10-17 17:50:55 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-10-18 11:12:33 -0700
commita42b05578fe731ce0b722e5c7383d616880289ef (patch)
tree9edd7965c3da102f508d0c765ff727c6c48755aa /tests/testpreferences.cpp
parent9c4b0170bfc321a31c6f3d0f7cd34edfa74fe1f4 (diff)
downloadsubsurface-a42b05578fe731ce0b722e5c7383d616880289ef.tar.gz
Tests for Units Preferences
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests/testpreferences.cpp')
-rw-r--r--tests/testpreferences.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index 684795891..50389a0c6 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -410,6 +410,43 @@ void TestPreferences::testPreferences()
TEST(planner->decoSac(),112);
TEST(planner->decoMode(),RECREATIONAL);
+
+ auto units = pref->unit_settings;
+ units->setLength(0);
+ units->setPressure(0);
+ units->setVolume(0);
+ units->setTemperature(0);
+ units->setWeight(0);
+ units->setVerticalSpeedTime(0);
+ units->setUnitSystem(QStringLiteral("metric"));
+ units->setCoordinatesTraditional(false);
+
+ TEST(units->length(),0);
+ TEST(units->pressure(),0);
+ TEST(units->volume(),0);
+ TEST(units->temperature(),0);
+ TEST(units->weight(),0);
+ TEST(units->verticalSpeedTime(),0);
+ TEST(units->unitSystem(),QStringLiteral("metric"));
+ TEST(units->coordinatesTraditional(),false);
+
+ units->setLength(1);
+ units->setPressure(1);
+ units->setVolume(1);
+ units->setTemperature(1);
+ units->setWeight(1);
+ units->setVerticalSpeedTime(1);
+ units->setUnitSystem(QStringLiteral("fake-metric-system"));
+ units->setCoordinatesTraditional(true);
+
+ TEST(units->length(),1);
+ TEST(units->pressure(),1);
+ TEST(units->volume(),1);
+ TEST(units->temperature(),1);
+ TEST(units->weight(),1);
+ TEST(units->verticalSpeedTime(),1);
+ TEST(units->unitSystem(),QStringLiteral("personalized"));
+ TEST(units->coordinatesTraditional(),true);
}
QTEST_MAIN(TestPreferences)