mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
tests: make qprefdisplay test file
Remove display tests from testpreferences and make a new file Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
parent
928fc1ee79
commit
8f7f1cacd6
5 changed files with 67 additions and 19 deletions
42
tests/testqPrefDisplay.cpp
Normal file
42
tests/testqPrefDisplay.cpp
Normal file
|
@ -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)
|
Loading…
Add table
Add a link
Reference in a new issue