summaryrefslogtreecommitdiff
path: root/src/settings/test/fonts.cpp
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2022-08-19 21:20:26 +0300
committeraqua <aqua@iserlohn-fortress.net>2022-08-28 09:47:51 +0300
commitaae82179bc5f04b4361c57f9a1073ff3af6899c4 (patch)
tree7c5728b70c74497e50c9d078f09f2ec742c6dd50 /src/settings/test/fonts.cpp
parentAdd parseCommandLine tests (diff)
downloadrekonq-aae82179bc5f04b4361c57f9a1073ff3af6899c4.tar.xz
Add rekonf script to generate SettingsWidgets
- generate General Settings - generate Appearance Settings - removed previous settings widgets
Diffstat (limited to 'src/settings/test/fonts.cpp')
-rw-r--r--src/settings/test/fonts.cpp31
1 files changed, 31 insertions, 0 deletions
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 <QFontInfo>
+#include <QGuiApplication>
+#include <gtest/gtest.h>
+#include <vector>
+
+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<char *> 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();
+}