summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfilesystemwatcher
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-08-11 17:20:24 +0300
committerAhmad Samir <a.samirh78@gmail.com>2023-08-19 16:29:25 +0300
commit8e0281a8becc699ece53527c647b1ee72e50c3bd (patch)
treeec1ac57e37431ea2b46384c6834fa0057ced62e8 /tests/auto/corelib/io/qfilesystemwatcher
parente7b07b64c7b0536eccba6ff25e23badb88226813 (diff)
tests/auto/: port Q_FOREACH to ranged-for, local const containers
These are local containers that are either: - Already const and didn't need Q_FOREACH to begin with - Can be simply made const, just by adding const keyword In one case the unittest checked that the container's size is 1, so use list.first() instead of a for-loop. In files where Q_FOREACH isn't used any more, remove "#undef QT_NO_FOREACH". Also remove those files from NO_PCH_SOURCES. Drive-by changes: - Remove parenthesis from one-line for-loops - Make the for-loop variable a const& where a copy isn't needed Task-number: QTBUG-115839 Change-Id: Ide34122b9cda798b80c4ca9d2d5af76024bc7a92 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qfilesystemwatcher')
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index fc52ea6692..de10072491 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -1,8 +1,6 @@
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
-
#include <QTest>
#include <QCoreApplication>
@@ -780,9 +778,9 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
QVERIFY(watcher.addPath(movePath));
// add files to watcher
- QFileInfoList files = testDir.entryInfoList(QDir::Files | QDir::NoSymLinks);
+ const QFileInfoList files = testDir.entryInfoList(QDir::Files | QDir::NoSymLinks);
QCOMPARE(files.size(), fileCount);
- foreach (const QFileInfo &finfo, files)
+ for (const QFileInfo &finfo : files)
QVERIFY(watcher.addPath(finfo.absoluteFilePath()));
// create the signal receiver