aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfigguitest.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2021-02-04 14:06:34 +0200
committerAhmad Samir <a.samirh78@gmail.com>2021-02-06 22:10:10 +0200
commitbce76d2e73a462de673d18dbf6d94da0c592bf08 (patch)
tree455687733ca90a74ecf8c4c90100695332378bf4 /autotests/kconfigguitest.cpp
parent2ac45198cf101f094cf8d94f3a546a57624e59f5 (diff)
downloadkconfig-bce76d2e73a462de673d18dbf6d94da0c592bf08.tar.gz
kconfig-bce76d2e73a462de673d18dbf6d94da0c592bf08.tar.bz2
Less implicit cast from ASCII
NO_CHANGELOG
Diffstat (limited to 'autotests/kconfigguitest.cpp')
-rw-r--r--autotests/kconfigguitest.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/autotests/kconfigguitest.cpp b/autotests/kconfigguitest.cpp
index 2a618ce2..87168a7f 100644
--- a/autotests/kconfigguitest.cpp
+++ b/autotests/kconfigguitest.cpp
@@ -16,10 +16,16 @@
QTEST_MAIN(KConfigTest)
-#define COLORENTRY1 QColor("steelblue")
-#define COLORENTRY2 QColor(235, 235, 100, 125)
-#define COLORENTRY3 QColor(234, 234, 127)
-#define FONTENTRY QFont("Times", 16, QFont::Normal)
+// clazy:excludeall=non-pod-global-static
+
+const QColor COLORENTRY1(QLatin1String{"steelblue"});
+const QColor COLORENTRY2(235, 235, 100, 125);
+const QColor COLORENTRY3(234, 234, 127);
+
+static QFont fontEntry()
+{
+ return QFont{QStringLiteral("Times"), 16, QFont::Normal};
+}
void KConfigTest::initTestCase()
{
@@ -36,7 +42,7 @@ void KConfigTest::initTestCase()
cg.writeEntry("colorEntry2", COLORENTRY2);
cg.writeEntry("colorEntry3", (QList<int>() << 234 << 234 << 127));
cg.writeEntry("colorEntry4", (QList<int>() << 235 << 235 << 100 << 125));
- cg.writeEntry("fontEntry", FONTENTRY);
+ cg.writeEntry("fontEntry", fontEntry());
QVERIFY(sc.sync());
KConfig sc1(QStringLiteral("kdebugrc"));
@@ -51,7 +57,7 @@ void KConfigTest::initTestCase()
// This is fixed by https://codereview.qt-project.org/181645
// It's not in yet, and it depends on the app font, so rather than
// a version check, let's do a runtime check.
- QFont orig(FONTENTRY);
+ QFont orig(fontEntry());
QFont f;
f.fromString(orig.toString());
m_fontFromStringBug = (f.toString() != orig.toString());
@@ -81,7 +87,7 @@ void KConfigTest::testComplex()
if (m_fontFromStringBug) {
QEXPECT_FAIL("", "QFont fromString bug from Qt 5.8.0", Continue);
}
- QCOMPARE(sc3.readEntry("fontEntry", QFont()), FONTENTRY);
+ QCOMPARE(sc3.readEntry("fontEntry", QFont()), fontEntry());
}
void KConfigTest::testInvalid()