diff options
author | jan Iversen <jani@apache.org> | 2018-07-22 17:47:17 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-25 08:35:04 -0700 |
commit | 87b00aea2b120fefea36d3c86e35babc01720f3f (patch) | |
tree | 8fa0cf7516905783ab75fc5ba352a22016749463 /tests | |
parent | bb5c1da1b7e8f5b2758db4d3235dad190f530fac (diff) | |
download | subsurface-87b00aea2b120fefea36d3c86e35babc01720f3f.tar.gz |
tests: move DiveComputer test from testpreferences
Remove DiveComputer test in testpreferences
add the same DiveComputer tests to testqPrefDiveComputer
Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testpreferences.cpp | 21 | ||||
-rw-r--r-- | tests/testqPrefDiveComputer.cpp | 31 | ||||
-rw-r--r-- | tests/testqPrefDiveComputer.h | 1 |
3 files changed, 32 insertions, 21 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index de39b0fd5..4cc024408 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -466,27 +466,6 @@ void TestPreferences::testPreferences() TEST(update->dontCheckForUpdates(), false); TEST(update->lastVersionUsed(), QStringLiteral("tomaz-2")); TEST(update->nextCheck(), date); - - auto dc = pref->dive_computer_settings; - dc->set_device("TomazComputer"); - TEST(dc->device(), QStringLiteral("TomazComputer")); - dc->set_device("Deepwater"); - TEST(dc->device(), QStringLiteral("Deepwater")); - - dc->set_download_mode(0); - TEST(dc->download_mode(), 0); - dc->set_download_mode(1); - TEST(dc->download_mode(), 1); - - dc->set_product("Thingy1"); - TEST(dc->product(), QStringLiteral("Thingy1")); - dc->set_product("Thingy2"); - TEST(dc->product(), QStringLiteral("Thingy2")); - - dc->set_vendor("Sharewater"); - TEST(dc->vendor(), QStringLiteral("Sharewater")); - dc->set_vendor("OSTS"); - TEST(dc->vendor(), QStringLiteral("OSTS")); } QTEST_MAIN(TestPreferences) diff --git a/tests/testqPrefDiveComputer.cpp b/tests/testqPrefDiveComputer.cpp index e95b51432..b16170488 100644 --- a/tests/testqPrefDiveComputer.cpp +++ b/tests/testqPrefDiveComputer.cpp @@ -120,5 +120,36 @@ void TestQPrefDiveComputer::test_multiple() QCOMPARE(tst->download_mode(), tst_direct->download_mode()); } +#define TEST(METHOD, VALUE) \ +QCOMPARE(METHOD, VALUE); \ +dc->sync(); \ +dc->load(); \ +QCOMPARE(METHOD, VALUE); + +void TestQPrefDiveComputer::test_oldPreferences() +{ + auto dc = qPrefDiveComputer::instance(); + + dc->set_device("TomazComputer"); + TEST(dc->device(), QStringLiteral("TomazComputer")); + dc->set_device("Deepwater"); + TEST(dc->device(), QStringLiteral("Deepwater")); + + dc->set_download_mode(0); + TEST(dc->download_mode(), 0); + dc->set_download_mode(1); + TEST(dc->download_mode(), 1); + + dc->set_product("Thingy1"); + TEST(dc->product(), QStringLiteral("Thingy1")); + dc->set_product("Thingy2"); + TEST(dc->product(), QStringLiteral("Thingy2")); + + dc->set_vendor("Sharewater"); + TEST(dc->vendor(), QStringLiteral("Sharewater")); + dc->set_vendor("OSTS"); + TEST(dc->vendor(), QStringLiteral("OSTS")); +} + QTEST_MAIN(TestQPrefDiveComputer) diff --git a/tests/testqPrefDiveComputer.h b/tests/testqPrefDiveComputer.h index df0e2cfef..addf019d1 100644 --- a/tests/testqPrefDiveComputer.h +++ b/tests/testqPrefDiveComputer.h @@ -15,6 +15,7 @@ private slots: void test_set_load_struct(); void test_struct_disk(); void test_multiple(); + void test_oldPreferences(); }; #endif // TESTQPREFDIVECOMPUTER_H |