summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpptoolstestcase.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2021-08-18 13:27:26 +0200
committerhjk <hjk@qt.io>2021-08-19 08:33:12 +0000
commit6e8c4aa835273d4bf4d5c35f54e3c613a3542420 (patch)
tree31641e6e6b198ebc56c895cd4b2fe7648e2622d9 /src/plugins/cpptools/cpptoolstestcase.cpp
parent9966cc4bcc6d3859f28454c3b53a1d1525803cfa (diff)
downloadqt-creator-6e8c4aa835273d4bf4d5c35f54e3c613a3542420.tar.gz
Use new FilePath::setPermissions in a few cases
Change-Id: Ic7122c86c273a87134ea8cd1a00b1bbdf5035971 Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cpptoolstestcase.cpp')
-rw-r--r--src/plugins/cpptools/cpptoolstestcase.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/plugins/cpptools/cpptoolstestcase.cpp b/src/plugins/cpptools/cpptoolstestcase.cpp
index 9f02461958..fca2d11eed 100644
--- a/src/plugins/cpptools/cpptoolstestcase.cpp
+++ b/src/plugins/cpptools/cpptoolstestcase.cpp
@@ -52,17 +52,20 @@
using namespace ProjectExplorer;
using namespace Utils;
+namespace CppTools {
+namespace Tests {
+
static bool closeEditorsWithoutGarbageCollectorInvocation(const QList<Core::IEditor *> &editors)
{
- CppTools::CppModelManager::instance()->enableGarbageCollector(false);
+ CppModelManager::instance()->enableGarbageCollector(false);
const bool closeEditorsSucceeded = Core::EditorManager::closeEditors(editors, false);
- CppTools::CppModelManager::instance()->enableGarbageCollector(true);
+ CppModelManager::instance()->enableGarbageCollector(true);
return closeEditorsSucceeded;
}
static bool snapshotContains(const CPlusPlus::Snapshot &snapshot, const QSet<QString> &filePaths)
{
- foreach (const QString &filePath, filePaths) {
+ for (const QString &filePath : filePaths) {
if (!snapshot.contains(filePath)) {
qWarning() << "Missing file in snapshot:" << qPrintable(filePath);
return false;
@@ -71,9 +74,6 @@ static bool snapshotContains(const CPlusPlus::Snapshot &snapshot, const QSet<QSt
return true;
}
-namespace CppTools {
-namespace Tests {
-
TestDocument::TestDocument(const QByteArray &fileName, const QByteArray &source, char cursorMarker)
: m_fileName(QString::fromUtf8(fileName))
, m_source(QString::fromUtf8(source))
@@ -214,7 +214,7 @@ QList<CPlusPlus::Document::Ptr> TestCase::waitForFilesInGlobalSnapshot(const QSt
t.start();
QList<CPlusPlus::Document::Ptr> result;
- foreach (const QString &filePath, filePaths) {
+ for (const QString &filePath : filePaths) {
forever {
if (CPlusPlus::Document::Ptr document = globalSnapshot().document(filePath)) {
result.append(document);
@@ -333,8 +333,7 @@ static bool copyRecursively(const QString &sourceDirPath,
// Copied files from Qt resources are read-only. Make them writable
// so that their parent directory can be removed without warnings.
- QFile file(targetPath.toString());
- return file.setPermissions(file.permissions() | QFile::WriteUser);
+ return targetPath.setPermissions(targetPath.permissions() | QFile::WriteUser);
};
return Utils::FileUtils::copyRecursively(Utils::FilePath::fromString(sourceDirPath),