summaryrefslogtreecommitdiffstats
path: root/tests/testqPrefDisplay.cpp
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-07-05 22:34:04 +0200
committerGravatar jan Iversen <jani@apache.org>2018-07-12 18:44:31 +0200
commit8f7f1cacd60f150f5d2520d3c9c47d31322fd4c1 (patch)
tree1d498700825dcd70378354ac633b8bbceb515a03 /tests/testqPrefDisplay.cpp
parent928fc1ee79a4391384f448cb75369ddb5e03ef28 (diff)
downloadsubsurface-8f7f1cacd60f150f5d2520d3c9c47d31322fd4c1.tar.gz
tests: make qprefdisplay test file
Remove display tests from testpreferences and make a new file Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'tests/testqPrefDisplay.cpp')
-rw-r--r--tests/testqPrefDisplay.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/testqPrefDisplay.cpp b/tests/testqPrefDisplay.cpp
new file mode 100644
index 000000000..bfd5b5eae
--- /dev/null
+++ b/tests/testqPrefDisplay.cpp
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "testqPrefDisplay.h"
+
+#include "core/settings/qPrefDisplay.h"
+
+#include <QtTest>
+#include <QDate>
+
+#define TEST(METHOD, VALUE) \
+QCOMPARE(METHOD, VALUE); \
+display->sync(); \
+display->load(); \
+QCOMPARE(METHOD, VALUE);
+
+void TestQPrefDisplay::initTestCase()
+{
+ QCoreApplication::setOrganizationName("Subsurface");
+ QCoreApplication::setOrganizationDomain("subsurface.hohndel.org");
+ QCoreApplication::setApplicationName("SubsurfaceTestQPrefDisplay");
+}
+
+void TestQPrefDisplay::test1()
+{
+ auto display = qPrefDisplay::instance();
+ display->set_divelist_font("comic");
+ display->set_font_size(10.0);
+ display->set_display_invalid_dives(true);
+
+ TEST(display->divelist_font(),QStringLiteral("comic"));
+ TEST(display->font_size(), 10.0);
+ TEST(display->display_invalid_dives(), true);
+
+ display->set_divelist_font("helvetica");
+ display->set_font_size(14.0);
+ display->set_display_invalid_dives(false);
+
+ TEST(display->divelist_font(),QStringLiteral("helvetica"));
+ TEST(display->font_size(), 14.0);
+ TEST(display->display_invalid_dives(), false);
+}
+
+QTEST_MAIN(TestQPrefDisplay)