tst_rcc: port away from Q_FOREACH
Most of these are of trivial kind (loops over const locals). The one that isn't, in cleanupTestCase(), is, however, also simple: it's a loop over a local, too, but it would be too much churn to change the initialization to make the container const, and the loop body clearly doesn't modify the container, so just go with the std::as_const() pattern here. Task-number: QTBUG-115839 Change-Id: I188a78ea67a63be2d50a81fea431e5ea9f2783cb Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 961717d372ad94b90e8d06152e92f1af54810a25) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
bdeaa4b3cc
commit
0be8f763d5
@ -211,8 +211,8 @@ static QStringMap readExpectedFiles(const QString &fileName)
|
|||||||
{
|
{
|
||||||
QStringMap expectedFiles;
|
QStringMap expectedFiles;
|
||||||
|
|
||||||
QStringList lines = readLinesFromFile(fileName, Qt::SkipEmptyParts);
|
const QStringList lines = readLinesFromFile(fileName, Qt::SkipEmptyParts);
|
||||||
foreach (const QString &line, lines) {
|
for (const QString &line : lines) {
|
||||||
QString resourceFileName = line.section(QLatin1Char(' '), 0, 0, QString::SectionSkipEmpty);
|
QString resourceFileName = line.section(QLatin1Char(' '), 0, 0, QString::SectionSkipEmpty);
|
||||||
QString actualFileName = line.section(QLatin1Char(' '), 1, 1, QString::SectionSkipEmpty);
|
QString actualFileName = line.section(QLatin1Char(' '), 1, 1, QString::SectionSkipEmpty);
|
||||||
expectedFiles[resourceFileName] = actualFileName;
|
expectedFiles[resourceFileName] = actualFileName;
|
||||||
@ -276,8 +276,8 @@ void tst_rcc::binary_data()
|
|||||||
QString localeFileName = absoluteBaseName + QLatin1String(".locale");
|
QString localeFileName = absoluteBaseName + QLatin1String(".locale");
|
||||||
QFile localeFile(localeFileName);
|
QFile localeFile(localeFileName);
|
||||||
if (localeFile.exists()) {
|
if (localeFile.exists()) {
|
||||||
QStringList locales = readLinesFromFile(localeFileName, Qt::SkipEmptyParts);
|
const QStringList locales = readLinesFromFile(localeFileName, Qt::SkipEmptyParts);
|
||||||
foreach (const QString &locale, locales) {
|
for (const QString &locale : locales) {
|
||||||
QString expectedFileName = QString::fromLatin1("%1.%2.%3").arg(absoluteBaseName, locale, QLatin1String("expected"));
|
QString expectedFileName = QString::fromLatin1("%1.%2.%3").arg(absoluteBaseName, locale, QLatin1String("expected"));
|
||||||
QStringMap expectedFiles = readExpectedFiles(expectedFileName);
|
QStringMap expectedFiles = readExpectedFiles(expectedFileName);
|
||||||
QTest::newRow(qPrintable(qrcFileInfo.baseName() + QLatin1Char('_') + locale)) << rccFileName
|
QTest::newRow(qPrintable(qrcFileInfo.baseName() + QLatin1Char('_') + locale)) << rccFileName
|
||||||
@ -473,7 +473,7 @@ void tst_rcc::cleanupTestCase()
|
|||||||
QFileInfoList entries = dataDir.entryInfoList(QStringList() << QLatin1String("*.rcc"));
|
QFileInfoList entries = dataDir.entryInfoList(QStringList() << QLatin1String("*.rcc"));
|
||||||
QDir dataDepDir(m_dataPath + QLatin1String("/depfile"));
|
QDir dataDepDir(m_dataPath + QLatin1String("/depfile"));
|
||||||
entries += dataDepDir.entryInfoList({QLatin1String("*.d"), QLatin1String("*.qrc.cpp")});
|
entries += dataDepDir.entryInfoList({QLatin1String("*.d"), QLatin1String("*.qrc.cpp")});
|
||||||
foreach (const QFileInfo &entry, entries)
|
for (const QFileInfo &entry : std::as_const(entries))
|
||||||
QFile::remove(entry.absoluteFilePath());
|
QFile::remove(entry.absoluteFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user