diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index dd4588af..92eb1a67 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -1,5 +1,3 @@ -remove_definitions(-DQT_NO_CAST_FROM_ASCII) - include(ECMAddTests) if(BUILD_TESTING) diff --git a/autotests/dupetest.cpp b/autotests/dupetest.cpp index 9bea4529..4bb6ab78 100644 --- a/autotests/dupetest.cpp +++ b/autotests/dupetest.cpp @@ -54,8 +54,8 @@ class DupeTest : public QObject { QString line; while (proc.canReadLine() || proc.waitForReadyRead()) { - line = proc.readLine(); - failListContent(splitOnUnescapedSpace(line.simplified()), "The following files are duplicates but not links:\n"); + line = QString::fromUtf8(proc.readLine()); + failListContent(splitOnUnescapedSpace(line.simplified()), QStringLiteral("The following files are duplicates but not links:\n")); } } diff --git a/autotests/scalabletest.cpp b/autotests/scalabletest.cpp index d041f4ec..1135b0bc 100644 --- a/autotests/scalabletest.cpp +++ b/autotests/scalabletest.cpp @@ -137,7 +137,7 @@ public: while (it.hasNext()) { it.next(); auto suffix = it.fileInfo().suffix(); - if (suffix != "svg" && suffix != "svgz" && suffix != "png") { + if (suffix != QLatin1String("svg") && suffix != QLatin1String("svgz") && suffix != QLatin1String("png")) { continue; // Probably not an icon. } icons << it.fileInfo(); @@ -170,7 +170,7 @@ private Q_SLOTS: QHash>> contextHash; QHash contextStringHash; - QSettings config(themeDir + "/index.theme", QSettings::IniFormat); + QSettings config(themeDir + QStringLiteral("/index.theme"), QSettings::IniFormat); auto keys = config.allKeys(); config.beginGroup("Icon Theme"); @@ -181,9 +181,9 @@ private Q_SLOTS: QVERIFY(!directoryPaths.isEmpty()); for (auto directoryPath : directoryPaths) { config.beginGroup(directoryPath); - QVERIFY2(keys.contains(directoryPath + "/Size"), + QVERIFY2(keys.contains(directoryPath + QStringLiteral("/Size")), QStringLiteral("The theme %1 has an entry 'Directories' which specifies '%2' as directory, but it has no associated entry '%2/Size'") - .arg(themeDir + "/index.theme", directoryPath) + .arg(themeDir + QStringLiteral("/index.theme"), directoryPath) .toLatin1() .constData()); auto dir = std::make_shared(config, themeDir); @@ -198,7 +198,7 @@ private Q_SLOTS: if (checkInherits && inherits.contains(QStringLiteral("breeze"))) { QString inheritedDir = PROJECT_SOURCE_DIR + QStringLiteral("/icons"); - QSettings inheritedConfig(inheritedDir + "/index.theme", QSettings::IniFormat); + QSettings inheritedConfig(inheritedDir + QStringLiteral("/index.theme"), QSettings::IniFormat); auto inheritedKeys = inheritedConfig.allKeys(); inheritedConfig.beginGroup("Icon Theme"); @@ -210,9 +210,9 @@ private Q_SLOTS: for (const auto& path : inheritedPaths) { inheritedConfig.beginGroup(path); QVERIFY2( - inheritedKeys.contains(path + "/Size"), + inheritedKeys.contains(path + QStringLiteral("/Size")), QStringLiteral("The theme %1 has an entry 'Directories' which specifies '%2' as directory, but it has no associated entry '%2/Size'") - .arg(inheritedDir + "/index.theme", path) + .arg(inheritedDir + QStringLiteral("/index.theme"), path) .toLatin1() .constData()); auto dir = std::make_shared(inheritedConfig, inheritedDir); @@ -233,7 +233,7 @@ private Q_SLOTS: } // FIXME: go through qenum to stringify the bugger // Gets rid of the stupid second hash - auto contextId = QString(QLatin1String(dir) + ":" + contextStringHash[key]).toLatin1(); + auto contextId = QString(dir + QStringLiteral(":") + contextStringHash[key]).toLatin1(); QTest::newRow(contextId.constData()) << key << contextHash[key]; } } diff --git a/autotests/symlinktest.cpp b/autotests/symlinktest.cpp index d07cd483..d08309c6 100644 --- a/autotests/symlinktest.cpp +++ b/autotests/symlinktest.cpp @@ -32,7 +32,7 @@ private Q_SLOTS: void initTestCase() { // Go up one level from the bin dir - m_buildDir = QDir(QCoreApplication::applicationDirPath() + "/..").canonicalPath(); + m_buildDir = QDir(QCoreApplication::applicationDirPath() + QStringLiteral("/..")).canonicalPath(); } // Invalid symlinks shouldn't happen. void test_broken() diff --git a/autotests/testdata.h.cmake b/autotests/testdata.h.cmake index 01b68981..eecd2e89 100644 --- a/autotests/testdata.h.cmake +++ b/autotests/testdata.h.cmake @@ -1,2 +1,2 @@ -#define PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}" -#define ICON_DIRS { "icons", "icons-dark" } +#define PROJECT_SOURCE_DIR QStringLiteral("${PROJECT_SOURCE_DIR}") +#define ICON_DIRS QStringList{ QStringLiteral("icons"), QStringLiteral("icons-dark") } diff --git a/autotests/testhelpers.h b/autotests/testhelpers.h index a071c2fc..508473a3 100644 --- a/autotests/testhelpers.h +++ b/autotests/testhelpers.h @@ -35,9 +35,9 @@ void failListContent(const QList &list, const QString &header) if (list.empty()) { return; } - QString message = ("\n" + _T_LIST_INDENT + header); + QString message = (QStringLiteral("\n") + _T_LIST_INDENT + header); for (const auto& path : list) { - message += (_T_LIST_INDENT2 + "- " + path + "\n"); + message += (_T_LIST_INDENT2 + QStringLiteral("- ") + path + QStringLiteral("\n")); } QFAIL(qPrintable(message)); } @@ -47,9 +47,9 @@ void failSymlinkList(const QList &list, const QString &header) if (list.empty()) { return; } - QString message = ("\n" + _T_LIST_INDENT + header); + QString message = (QStringLiteral("\n") + _T_LIST_INDENT + header); for (const auto& info : list) { - message += (_T_LIST_INDENT2 + info.filePath() + " => " + info.symLinkTarget() + "\n"); + message += (_T_LIST_INDENT2 + info.filePath() + QStringLiteral(" => ") + info.symLinkTarget() + QStringLiteral("\n")); } QFAIL(qPrintable(message)); }