allow the test to compile with strict flags
This commit is contained in:
parent
9cbf1d8790
commit
3f87478124
@ -1,5 +1,3 @@
|
|||||||
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
|
|
||||||
|
|
||||||
include(ECMAddTests)
|
include(ECMAddTests)
|
||||||
|
|
||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
|
|||||||
@ -54,8 +54,8 @@ class DupeTest : public QObject
|
|||||||
{
|
{
|
||||||
QString line;
|
QString line;
|
||||||
while (proc.canReadLine() || proc.waitForReadyRead()) {
|
while (proc.canReadLine() || proc.waitForReadyRead()) {
|
||||||
line = proc.readLine();
|
line = QString::fromUtf8(proc.readLine());
|
||||||
failListContent(splitOnUnescapedSpace(line.simplified()), "The following files are duplicates but not links:\n");
|
failListContent(splitOnUnescapedSpace(line.simplified()), QStringLiteral("The following files are duplicates but not links:\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -137,7 +137,7 @@ public:
|
|||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
auto suffix = it.fileInfo().suffix();
|
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.
|
continue; // Probably not an icon.
|
||||||
}
|
}
|
||||||
icons << it.fileInfo();
|
icons << it.fileInfo();
|
||||||
@ -170,7 +170,7 @@ private Q_SLOTS:
|
|||||||
QHash<KIconLoaderDummy::Context, QList<std::shared_ptr<Dir>>> contextHash;
|
QHash<KIconLoaderDummy::Context, QList<std::shared_ptr<Dir>>> contextHash;
|
||||||
QHash<KIconLoaderDummy::Context, QString> contextStringHash;
|
QHash<KIconLoaderDummy::Context, QString> contextStringHash;
|
||||||
|
|
||||||
QSettings config(themeDir + "/index.theme", QSettings::IniFormat);
|
QSettings config(themeDir + QStringLiteral("/index.theme"), QSettings::IniFormat);
|
||||||
auto keys = config.allKeys();
|
auto keys = config.allKeys();
|
||||||
|
|
||||||
config.beginGroup("Icon Theme");
|
config.beginGroup("Icon Theme");
|
||||||
@ -181,9 +181,9 @@ private Q_SLOTS:
|
|||||||
QVERIFY(!directoryPaths.isEmpty());
|
QVERIFY(!directoryPaths.isEmpty());
|
||||||
for (auto directoryPath : directoryPaths) {
|
for (auto directoryPath : directoryPaths) {
|
||||||
config.beginGroup(directoryPath);
|
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'")
|
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()
|
.toLatin1()
|
||||||
.constData());
|
.constData());
|
||||||
auto dir = std::make_shared<Dir>(config, themeDir);
|
auto dir = std::make_shared<Dir>(config, themeDir);
|
||||||
@ -198,7 +198,7 @@ private Q_SLOTS:
|
|||||||
if (checkInherits && inherits.contains(QStringLiteral("breeze"))) {
|
if (checkInherits && inherits.contains(QStringLiteral("breeze"))) {
|
||||||
QString inheritedDir = PROJECT_SOURCE_DIR + QStringLiteral("/icons");
|
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();
|
auto inheritedKeys = inheritedConfig.allKeys();
|
||||||
|
|
||||||
inheritedConfig.beginGroup("Icon Theme");
|
inheritedConfig.beginGroup("Icon Theme");
|
||||||
@ -210,9 +210,9 @@ private Q_SLOTS:
|
|||||||
for (const auto& path : inheritedPaths) {
|
for (const auto& path : inheritedPaths) {
|
||||||
inheritedConfig.beginGroup(path);
|
inheritedConfig.beginGroup(path);
|
||||||
QVERIFY2(
|
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'")
|
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()
|
.toLatin1()
|
||||||
.constData());
|
.constData());
|
||||||
auto dir = std::make_shared<Dir>(inheritedConfig, inheritedDir);
|
auto dir = std::make_shared<Dir>(inheritedConfig, inheritedDir);
|
||||||
@ -233,7 +233,7 @@ private Q_SLOTS:
|
|||||||
}
|
}
|
||||||
// FIXME: go through qenum to stringify the bugger
|
// FIXME: go through qenum to stringify the bugger
|
||||||
// Gets rid of the stupid second hash
|
// 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];
|
QTest::newRow(contextId.constData()) << key << contextHash[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ private Q_SLOTS:
|
|||||||
void initTestCase()
|
void initTestCase()
|
||||||
{
|
{
|
||||||
// Go up one level from the bin dir
|
// 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.
|
// Invalid symlinks shouldn't happen.
|
||||||
void test_broken()
|
void test_broken()
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
#define PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}"
|
#define PROJECT_SOURCE_DIR QStringLiteral("${PROJECT_SOURCE_DIR}")
|
||||||
#define ICON_DIRS { "icons", "icons-dark" }
|
#define ICON_DIRS QStringList{ QStringLiteral("icons"), QStringLiteral("icons-dark") }
|
||||||
|
|||||||
@ -35,9 +35,9 @@ void failListContent(const QList<QString> &list, const QString &header)
|
|||||||
if (list.empty()) {
|
if (list.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString message = ("\n" + _T_LIST_INDENT + header);
|
QString message = (QStringLiteral("\n") + _T_LIST_INDENT + header);
|
||||||
for (const auto& path : list) {
|
for (const auto& path : list) {
|
||||||
message += (_T_LIST_INDENT2 + "- " + path + "\n");
|
message += (_T_LIST_INDENT2 + QStringLiteral("- ") + path + QStringLiteral("\n"));
|
||||||
}
|
}
|
||||||
QFAIL(qPrintable(message));
|
QFAIL(qPrintable(message));
|
||||||
}
|
}
|
||||||
@ -47,9 +47,9 @@ void failSymlinkList(const QList<QFileInfo> &list, const QString &header)
|
|||||||
if (list.empty()) {
|
if (list.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString message = ("\n" + _T_LIST_INDENT + header);
|
QString message = (QStringLiteral("\n") + _T_LIST_INDENT + header);
|
||||||
for (const auto& info : list) {
|
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));
|
QFAIL(qPrintable(message));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user