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 Pick-to: 6.6 6.5 Change-Id: I188a78ea67a63be2d50a81fea431e5ea9f2783cb Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
27a9ce0a16
commit
961717d372
@ -211,8 +211,8 @@ static QStringMap readExpectedFiles(const QString &fileName)
|
||||
{
|
||||
QStringMap expectedFiles;
|
||||
|
||||
QStringList lines = readLinesFromFile(fileName, Qt::SkipEmptyParts);
|
||||
foreach (const QString &line, lines) {
|
||||
const QStringList lines = readLinesFromFile(fileName, Qt::SkipEmptyParts);
|
||||
for (const QString &line : lines) {
|
||||
QString resourceFileName = line.section(QLatin1Char(' '), 0, 0, QString::SectionSkipEmpty);
|
||||
QString actualFileName = line.section(QLatin1Char(' '), 1, 1, QString::SectionSkipEmpty);
|
||||
expectedFiles[resourceFileName] = actualFileName;
|
||||
@ -276,8 +276,8 @@ void tst_rcc::binary_data()
|
||||
QString localeFileName = absoluteBaseName + QLatin1String(".locale");
|
||||
QFile localeFile(localeFileName);
|
||||
if (localeFile.exists()) {
|
||||
QStringList locales = readLinesFromFile(localeFileName, Qt::SkipEmptyParts);
|
||||
foreach (const QString &locale, locales) {
|
||||
const QStringList locales = readLinesFromFile(localeFileName, Qt::SkipEmptyParts);
|
||||
for (const QString &locale : locales) {
|
||||
QString expectedFileName = QString::fromLatin1("%1.%2.%3").arg(absoluteBaseName, locale, QLatin1String("expected"));
|
||||
QStringMap expectedFiles = readExpectedFiles(expectedFileName);
|
||||
QTest::newRow(qPrintable(qrcFileInfo.baseName() + QLatin1Char('_') + locale)) << rccFileName
|
||||
@ -473,7 +473,7 @@ void tst_rcc::cleanupTestCase()
|
||||
QFileInfoList entries = dataDir.entryInfoList(QStringList() << QLatin1String("*.rcc"));
|
||||
QDir dataDepDir(m_dataPath + QLatin1String("/depfile"));
|
||||
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());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user