mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
1e8e9f345a
commit
b70e002728
3 changed files with 44 additions and 33 deletions
|
@ -24,39 +24,6 @@ void TestPreferences::testPreferences()
|
||||||
auto pref = SettingsObjectWrapper::instance();
|
auto pref = SettingsObjectWrapper::instance();
|
||||||
pref->load();
|
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;
|
auto general = pref->general_settings;
|
||||||
general->setDefaultFilename("filename");
|
general->setDefaultFilename("filename");
|
||||||
general->setDefaultCylinder("cylinder_2");
|
general->setDefaultCylinder("cylinder_2");
|
||||||
|
|
|
@ -141,4 +141,47 @@ void TestQPrefPartialPressureGas::test_multiple()
|
||||||
QCOMPARE(tst_direct->pn2_threshold(), 2.3);
|
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)
|
QTEST_MAIN(TestQPrefPartialPressureGas)
|
||||||
|
|
|
@ -14,6 +14,7 @@ private slots:
|
||||||
void test_set_load_struct();
|
void test_set_load_struct();
|
||||||
void test_struct_disk();
|
void test_struct_disk();
|
||||||
void test_multiple();
|
void test_multiple();
|
||||||
|
void test_oldPreferences();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TESTQPREFPARTIALPRESSUREGAS_H
|
#endif // TESTQPREFPARTIALPRESSUREGAS_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue