summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppmodelmanager_test.cpp
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2021-06-11 14:34:34 +0200
committerDavid Schulz <david.schulz@qt.io>2021-06-17 11:13:51 +0000
commitf66df921d74c323d899f996d9ca520c224355a90 (patch)
tree42ef20fe9de0b55b756d9ba56b731d1a474c9c08 /src/plugins/cpptools/cppmodelmanager_test.cpp
parent55b91a76172a3235b4879daf0b675519d5b02db7 (diff)
downloadqt-creator-f66df921d74c323d899f996d9ca520c224355a90.tar.gz
Core: filepathify file renaming
Change-Id: I3d4f39e34e65cde3df7b7c19570e3a54d0625d53 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cppmodelmanager_test.cpp')
-rw-r--r--src/plugins/cpptools/cppmodelmanager_test.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp
index c4a3637986..8e2700c2a2 100644
--- a/src/plugins/cpptools/cppmodelmanager_test.cpp
+++ b/src/plugins/cpptools/cppmodelmanager_test.cpp
@@ -1035,7 +1035,9 @@ void CppToolsPlugin::test_modelmanager_renameIncludes()
QCOMPARE(snapshot.allIncludesForDocument(sourceFile), QSet<QString>() << oldHeader);
// Renaming the header
- QVERIFY(Core::FileUtils::renameFile(oldHeader, newHeader, Core::HandleIncludeGuards::Yes));
+ QVERIFY(Core::FileUtils::renameFile(Utils::FilePath::fromString(oldHeader),
+ Utils::FilePath::fromString(newHeader),
+ Core::HandleIncludeGuards::Yes));
// Update the c++ model manager again and check for the new includes
modelManager->updateSourceFiles(sourceFiles).waitForFinished();
@@ -1103,12 +1105,14 @@ void CppToolsPlugin::test_modelmanager_renameIncludesInEditor()
QVERIFY(modelManager->workingCopy().contains(mainFile));
// Test the renaming of a header file where a pragma once guard is present
- QVERIFY(Core::FileUtils::renameFile(headerWithPragmaOnce, renamedHeaderWithPragmaOnce,
+ QVERIFY(Core::FileUtils::renameFile(Utils::FilePath::fromString(headerWithPragmaOnce),
+ Utils::FilePath::fromString(renamedHeaderWithPragmaOnce),
Core::HandleIncludeGuards::Yes));
// Test the renaming the header with include guard:
// The contents should match the foobar2000.h in the testdata_project2 project
- QVERIFY(Core::FileUtils::renameFile(headerWithNormalGuard, renamedHeaderWithNormalGuard,
+ QVERIFY(Core::FileUtils::renameFile(Utils::FilePath::fromString(headerWithNormalGuard),
+ Utils::FilePath::fromString(renamedHeaderWithNormalGuard),
Core::HandleIncludeGuards::Yes));
const MyTestDataDir testDir2(_("testdata_project2"));
@@ -1125,8 +1129,10 @@ void CppToolsPlugin::test_modelmanager_renameIncludesInEditor()
// Test the renaming the header with underscore pre/suffixed include guard:
// The contents should match the foobar2000.h in the testdata_project2 project
- QVERIFY(Core::FileUtils::renameFile(headerWithUnderscoredGuard, renamedHeaderWithUnderscoredGuard,
- Core::HandleIncludeGuards::Yes));
+ QVERIFY(
+ Core::FileUtils::renameFile(Utils::FilePath::fromString(headerWithUnderscoredGuard),
+ Utils::FilePath::fromString(renamedHeaderWithUnderscoredGuard),
+ Core::HandleIncludeGuards::Yes));
QFile foobar4000Header(testDir2.file("foobar4000.h"));
QVERIFY(foobar4000Header.open(QFile::ReadOnly | QFile::Text));
@@ -1146,7 +1152,8 @@ void CppToolsPlugin::test_modelmanager_renameIncludesInEditor()
auto originalMalformedGuardContents = renamedHeader.readAll();
renamedHeader.close();
- QVERIFY(Core::FileUtils::renameFile(headerWithMalformedGuard, renamedHeaderWithMalformedGuard,
+ QVERIFY(Core::FileUtils::renameFile(Utils::FilePath::fromString(headerWithMalformedGuard),
+ Utils::FilePath::fromString(renamedHeaderWithMalformedGuard),
Core::HandleIncludeGuards::Yes));
renamedHeader.setFileName(renamedHeaderWithMalformedGuard);