aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/manual/qmlplugindump/tst_qmlplugindump.cpp11
-rw-r--r--tests/manual/scenegraph_lancelot/scenegrabber/main.cpp4
-rw-r--r--tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp6
3 files changed, 12 insertions, 9 deletions
diff --git a/tests/manual/qmlplugindump/tst_qmlplugindump.cpp b/tests/manual/qmlplugindump/tst_qmlplugindump.cpp
index ed00682a83..1bedd4427b 100644
--- a/tests/manual/qmlplugindump/tst_qmlplugindump.cpp
+++ b/tests/manual/qmlplugindump/tst_qmlplugindump.cpp
@@ -92,7 +92,7 @@ public:
{
QRegularExpression re;
QRegularExpressionMatch m;
- Q_FOREACH (const QString &e, m_expected) {
+ for (const QString &e : m_expected) {
re.setPattern(e);
m = re.match(QString::fromLatin1(buffer));
if (!m.hasMatch()) {
@@ -187,7 +187,8 @@ Test createTest(const QString &id, const QJsonObject &def)
return Test(id);
}
QStringList patterns;
- Q_FOREACH (const QJsonValue &x, expected.toArray()) {
+ const auto expectedArray = expected.toArray();
+ for (const QJsonValue &x : expectedArray) {
if (!x.isString()) {
qWarning() << "Wrong definition for test: " << id << ".";
return Test(id);
@@ -331,7 +332,7 @@ void tst_qmlplugindump::plugin_data()
QTest::addColumn<QString>("version");
QTest::addColumn<QStringList>("expected");
- Q_FOREACH (const Test &t, tests) {
+ for (const Test &t : qAsConst(tests)) {
if (t.isNull())
QSKIP("Errors in test definition.");
QTest::newRow(t.id.toLatin1().data()) << t.project << t.version << t.expected;
@@ -357,9 +358,9 @@ void tst_qmlplugindump::plugin()
void tst_qmlplugindump::cleanupTestCase()
{
QSet<const QString> projects;
- Q_FOREACH (const Test &t, tests)
+ for (const Test &t : qAsConst(tests))
projects.insert(t.project);
- Q_FOREACH (const QString &p, projects) {
+ for (const QString &p : qAsConst(projects)) {
if (!cleanUpSample(p))
qWarning() << "Error in cleaning up project" << p << ".";
}
diff --git a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp
index 5098d51134..886cfc6599 100644
--- a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp
+++ b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp
@@ -183,8 +183,8 @@ int main(int argc, char *argv[])
v.setSource(QUrl::fromLocalFile(ifile));
if (noText) {
- QList<QQuickItem*> items = v.rootObject()->findChildren<QQuickItem*>();
- foreach (QQuickItem *item, items) {
+ const QList<QQuickItem*> items = v.rootObject()->findChildren<QQuickItem*>();
+ for (QQuickItem *item : items) {
if (QByteArray(item->metaObject()->className()).contains("Text"))
item->setVisible(false);
}
diff --git a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp
index 426e06ccc2..3f28d90e7b 100644
--- a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp
+++ b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp
@@ -156,7 +156,7 @@ void tst_Scenegraph::setupTestSuite(const QByteArray& filter)
}
std::sort(itemFiles.begin(), itemFiles.end());
- foreach (const QString &filePath, itemFiles) {
+ for (const QString &filePath : qAsConst(itemFiles)) {
QByteArray itemName = filePath.mid(testSuitePath.length() + 1).toLatin1();
QBaselineTest::newRow(itemName, checksumFileOrDir(filePath)) << filePath;
numItems++;
@@ -238,7 +238,9 @@ quint16 tst_Scenegraph::checksumFileOrDir(const QString &path)
if (fi.isDir()) {
static const QStringList nameFilters = QStringList() << "*.qml" << "*.cpp" << "*.png" << "*.jpg";
quint16 cs = 0;
- foreach (QString item, QDir(fi.filePath()).entryList(nameFilters, QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot))
+ const auto entryList = QDir(fi.filePath()).entryList(nameFilters,
+ QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
+ for (const QString &item : entryList)
cs ^= checksumFileOrDir(path + QLatin1Char('/') + item);
return cs;
}