From aae82179bc5f04b4361c57f9a1073ff3af6899c4 Mon Sep 17 00:00:00 2001 From: aqua Date: Fri, 19 Aug 2022 21:20:26 +0300 Subject: Add rekonf script to generate SettingsWidgets - generate General Settings - generate Appearance Settings - removed previous settings widgets --- src/settings/test/dialog.cpp | 12 ++++++++++++ src/settings/test/fonts.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/settings/test/dialog.cpp create mode 100644 src/settings/test/fonts.cpp (limited to 'src/settings/test') diff --git a/src/settings/test/dialog.cpp b/src/settings/test/dialog.cpp new file mode 100644 index 00000000..2bc9ffe0 --- /dev/null +++ b/src/settings/test/dialog.cpp @@ -0,0 +1,12 @@ +#include "../settingsdialog.h" +#include + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + SettingsDialog dlg; + dlg.show(); + + return QApplication::exec(); +} \ No newline at end of file diff --git a/src/settings/test/fonts.cpp b/src/settings/test/fonts.cpp new file mode 100644 index 00000000..65cc7229 --- /dev/null +++ b/src/settings/test/fonts.cpp @@ -0,0 +1,31 @@ +#include "../helpers.hpp" +#include +#include +#include +#include + +TEST(Settings, getFont) +{ + const auto serif = getFont(QFont::Serif); + EXPECT_EQ(serif.styleHint(), QFont::Serif) << qUtf8Printable(serif.toString()); + + const auto fixed = getFont(QFont::Monospace); + EXPECT_EQ(fixed.styleHint(), QFont::Monospace) << qUtf8Printable(fixed.toString()); +} + +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + + // handling fonts requires a QGuiApplication + // The proper platform name needs to be added to the argument list before the QGuiApplication constructor is called + // This needs to be done here for gtest_discover_tests to work + QList args; + for (int i = 0; i < argc; ++i) args.append(argv[i]); + args.append({"-platform", "offscreen"}); + int args_count = args.count(); + + QGuiApplication app(args_count, args.data()); + + return RUN_ALL_TESTS(); +} -- cgit v1.2.1