summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-11 21:15:19 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-14 07:12:41 -0700
commitb70e002728912ba88ae266ceef0645db35e15cc4 (patch)
tree2e8afba7eae417b12359e3b32a8fc0895785f894 /tests
parent1e8e9f345a0e9362b75556dcf66600b9f2e8fc2b (diff)
downloadsubsurface-b70e002728912ba88ae266ceef0645db35e15cc4.tar.gz
tests: move PartialPressureGas test from testpreferences
Remove PartialPressureGas test in testpreferences add the same PartialPressureGas tests to testqPrefPartialPressureGas Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/testpreferences.cpp33
-rw-r--r--tests/testqPrefPartialPressureGas.cpp43
-rw-r--r--tests/testqPrefPartialPressureGas.h1
3 files changed, 44 insertions, 33 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index 7171a6202..41e2950d8 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -24,39 +24,6 @@ void TestPreferences::testPreferences()
auto pref = SettingsObjectWrapper::instance();
pref->load();
- auto pp = qPrefPartialPressureGas::instance();
- pp->set_pn2(false);
- pp->set_phe(false);
- pp->set_po2(false);
- pp->set_po2_threshold_min(1.0);
- pp->set_po2_threshold_max(2.0);
- pp->set_pn2_threshold(3.0);
- pp->set_phe_threshold(4.0);
-
- TEST(pp->pn2(), false);
- TEST(pp->phe(), false);
- TEST(pp->po2(), false);
- TEST(pp->pn2_threshold(), 3.0);
- TEST(pp->phe_threshold(), 4.0);
- TEST(pp->po2_threshold_min(), 1.0);
- TEST(pp->po2_threshold_max(), 2.0);
-
- pp->set_pn2(true);
- pp->set_phe(true);
- pp->set_po2(true);
- pp->set_po2_threshold_min(4.0);
- pp->set_po2_threshold_max(5.0);
- pp->set_pn2_threshold(6.0);
- pp->set_phe_threshold(7.0);
-
- TEST(pp->pn2(), true);
- TEST(pp->phe(), true);
- TEST(pp->po2(), true);
- TEST(pp->pn2_threshold(), 6.0);
- TEST(pp->phe_threshold(), 7.0);
- TEST(pp->po2_threshold_min(), 4.0);
- TEST(pp->po2_threshold_max(), 5.0);
-
auto general = pref->general_settings;
general->setDefaultFilename("filename");
general->setDefaultCylinder("cylinder_2");
diff --git a/tests/testqPrefPartialPressureGas.cpp b/tests/testqPrefPartialPressureGas.cpp
index b676ac162..5e5c090ab 100644
--- a/tests/testqPrefPartialPressureGas.cpp
+++ b/tests/testqPrefPartialPressureGas.cpp
@@ -141,4 +141,47 @@ void TestQPrefPartialPressureGas::test_multiple()
QCOMPARE(tst_direct->pn2_threshold(), 2.3);
}
+#define TEST(METHOD, VALUE) \
+ QCOMPARE(METHOD, VALUE); \
+ pp->sync(); \
+ pp->load(); \
+ QCOMPARE(METHOD, VALUE);
+
+void TestQPrefPartialPressureGas::test_oldPreferences()
+{
+ auto pp = qPrefPartialPressureGas::instance();
+ pp->set_pn2(false);
+ pp->set_phe(false);
+ pp->set_po2(false);
+ pp->set_po2_threshold_min(1.0);
+ pp->set_po2_threshold_max(2.0);
+ pp->set_pn2_threshold(3.0);
+ pp->set_phe_threshold(4.0);
+
+ TEST(pp->pn2(), false);
+ TEST(pp->phe(), false);
+ TEST(pp->po2(), false);
+ TEST(pp->pn2_threshold(), 3.0);
+ TEST(pp->phe_threshold(), 4.0);
+ TEST(pp->po2_threshold_min(), 1.0);
+ TEST(pp->po2_threshold_max(), 2.0);
+
+ pp->set_pn2(true);
+ pp->set_phe(true);
+ pp->set_po2(true);
+ pp->set_po2_threshold_min(4.0);
+ pp->set_po2_threshold_max(5.0);
+ pp->set_pn2_threshold(6.0);
+ pp->set_phe_threshold(7.0);
+
+ TEST(pp->pn2(), true);
+ TEST(pp->phe(), true);
+ TEST(pp->po2(), true);
+ TEST(pp->pn2_threshold(), 6.0);
+ TEST(pp->phe_threshold(), 7.0);
+ TEST(pp->po2_threshold_min(), 4.0);
+ TEST(pp->po2_threshold_max(), 5.0);
+
+}
+
QTEST_MAIN(TestQPrefPartialPressureGas)
diff --git a/tests/testqPrefPartialPressureGas.h b/tests/testqPrefPartialPressureGas.h
index f1f34c4e3..28c1b20a3 100644
--- a/tests/testqPrefPartialPressureGas.h
+++ b/tests/testqPrefPartialPressureGas.h
@@ -14,6 +14,7 @@ private slots:
void test_set_load_struct();
void test_struct_disk();
void test_multiple();
+ void test_oldPreferences();
};
#endif // TESTQPREFPARTIALPRESSUREGAS_H