summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-07-17 16:19:56 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-07-18 10:40:08 -0700
commit0363e590f3160965341a069f1dd9244a8eaa5d1e (patch)
tree78905d1042e91a18f5ce83661f8de75d4ea5a784 /tests
parent3c3729711c86a621b425370fd11d4271e4208f1b (diff)
downloadsubsurface-0363e590f3160965341a069f1dd9244a8eaa5d1e.tar.gz
tests: update qPrefDisplay test cases
remove include of QtTest in header, becaue it is not needed, add include of QObject in header, so moc can generate code. add QTest in cpp file, which replaces QtTest Change content of strings to test divelist_font to a not normal font name, to ensure less confusion by readers. Remark the old surrounding code accept illegal font names, but correcting this is not covered in this commit. Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/testqPrefDisplay.cpp21
-rw-r--r--tests/testqPrefDisplay.h2
2 files changed, 12 insertions, 11 deletions
diff --git a/tests/testqPrefDisplay.cpp b/tests/testqPrefDisplay.cpp
index 5d510fe21..4ccba5203 100644
--- a/tests/testqPrefDisplay.cpp
+++ b/tests/testqPrefDisplay.cpp
@@ -1,11 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
#include "testqPrefDisplay.h"
-#include "core/settings/qPrefDisplay.h"
+#include "core/settings/qPref.h"
#include "core/pref.h"
#include "core/qthelper.h"
#include <QDate>
+#include <QTest>
void TestQPrefDisplay::initTestCase()
{
@@ -40,13 +41,13 @@ void TestQPrefDisplay::test_set_struct()
auto display = qPrefDisplay::instance();
display->set_display_invalid_dives(true);
- display->set_divelist_font("comic");
+ display->set_divelist_font("doNotCareAtAll");
display->set_font_size(12.0);
display->set_show_developer(false);
display->set_theme("myTheme");
QCOMPARE(prefs.display_invalid_dives, true);
- QCOMPARE(prefs.divelist_font, "comic");
+ QCOMPARE(prefs.divelist_font, "doNotCareAtAll");
QCOMPARE(prefs.font_size, 12.0);
QCOMPARE(prefs.show_developer, false);
QCOMPARE(prefs.theme, "myTheme");
@@ -59,20 +60,20 @@ void TestQPrefDisplay::test_set_load_struct()
auto display = qPrefDisplay::instance();
display->set_display_invalid_dives(false);
- display->set_divelist_font("helvitica");
+ display->set_divelist_font("doNotCareString");
display->set_font_size(15.0);
display->set_show_developer(true);
display->set_theme("myTheme2");
prefs.display_invalid_dives = true;
- prefs.divelist_font = copy_qstring("comic");
+ prefs.divelist_font = copy_qstring("doNotCareAtAll");
prefs.font_size = 12.0;
prefs.show_developer = false;
prefs.theme = copy_qstring("myTheme");
display->load();
QCOMPARE(prefs.display_invalid_dives, false);
- QCOMPARE(prefs.divelist_font, "helvitica");
+ QCOMPARE(prefs.divelist_font, "doNotCareString");
QCOMPARE(prefs.font_size, 15.0);
QCOMPARE(prefs.show_developer, true);
QCOMPARE(prefs.theme, "myTheme2");
@@ -85,21 +86,21 @@ void TestQPrefDisplay::test_struct_disk()
auto display = qPrefDisplay::instance();
prefs.display_invalid_dives = true;
- prefs.divelist_font = copy_qstring("helvitica");
+ prefs.divelist_font = copy_qstring("doNotCareAtAll");
prefs.font_size = 17.0;
prefs.show_developer = false;
prefs.theme = copy_qstring("myTheme3");
display->sync();
prefs.display_invalid_dives = false;
- prefs.divelist_font = copy_qstring("comic");
+ prefs.divelist_font = copy_qstring("noString");
prefs.font_size = 11.0;
prefs.show_developer = true;
prefs.theme = copy_qstring("myTheme");
display->load();
QCOMPARE(prefs.display_invalid_dives, true);
- QCOMPARE(prefs.divelist_font, "helvitica");
+ QCOMPARE(prefs.divelist_font, "doNotCareAtAll");
QCOMPARE(prefs.font_size, 17.0);
QCOMPARE(prefs.show_developer, false);
QCOMPARE(prefs.theme, "myTheme3");
@@ -117,7 +118,7 @@ void TestQPrefDisplay::test_multiple()
auto display_direct = new qPrefDisplay;
prefs.display_invalid_dives = true;
- prefs.divelist_font = copy_qstring("helvetica");
+ prefs.divelist_font = copy_qstring("multipleCharsInString");
prefs.font_size = 15.0;
prefs.show_developer = false;
prefs.theme = copy_qstring("myTheme8");
diff --git a/tests/testqPrefDisplay.h b/tests/testqPrefDisplay.h
index 6af2d2be5..dfc81aee2 100644
--- a/tests/testqPrefDisplay.h
+++ b/tests/testqPrefDisplay.h
@@ -2,7 +2,7 @@
#ifndef TESTQPREFDISPLAY_H
#define TESTQPREFDISPLAY_H
-#include <QtTest>
+#include <QObject>
class TestQPrefDisplay : public QObject
{