aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2022-11-21 16:48:50 +0100
committerhjk <hjk@qt.io>2022-11-22 15:30:00 +0000
commitfa1adf4d4001207902a5572b39da4f1cbc8752f1 (patch)
treeff9cbc1c951ab862f03902d38fc4495c3e1a3ae9 /src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
parent822e2a224a283581b38948d4626f873c6b38c044 (diff)
CPlusPlus: Proliferate FilePath use
The starts with CppDocument::filePath(), plus a bit of the fallout This is one patch of potentially many. It is hard to draw the line where to stop this kind of chunk, this here converts a few additional functions for which including it in the patch looked like less churn than without. Converting is mostly fromString/toString, with a few exceptions for "already seem" like caches, that use cheaper "path()" to avoid likely performance regressions (on Windows FilePath comparison is currently case-insenstive, and more expensive). There should be no difference for local operation with this patch. Change-Id: I7b35f98a0a6f0bfed4ea0f8f987faf586f7a8f2b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp')
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index 38cd0cdebc..c15995504e 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -62,6 +62,7 @@ using namespace CPlusPlus;
using namespace TextEditor;
using namespace Core;
using namespace ProjectExplorer;
+using namespace Utils;
class OverrideItem
{
@@ -256,7 +257,8 @@ F2TestCase::F2TestCase(CppEditorAction action,
QVERIFY(testFile->baseDirectory().isEmpty());
testFile->setBaseDirectory(temporaryDir.path());
QVERIFY(testFile->writeToDisk());
- projectFileContent += QString::fromLatin1("\"%1\",").arg(testFile->filePath());
+ projectFileContent += QString::fromLatin1("\"%1\",")
+ .arg(testFile->filePath().toString());
}
projectFileContent += "]}\n";
@@ -272,9 +274,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
CppTestDocument projectFile("project.qbs", projectFileContent.toUtf8());
projectFile.setBaseDirectory(temporaryDir.path());
QVERIFY(projectFile.writeToDisk());
- const auto openProjectResult =
- ProjectExplorerPlugin::openProject(
- Utils::FilePath::fromString(projectFile.filePath()));
+ const auto openProjectResult = ProjectExplorerPlugin::openProject(projectFile.filePath());
QVERIFY2(openProjectResult && openProjectResult.project(),
qPrintable(openProjectResult.errorMessage()));
projectCloser.setProject(openProjectResult.project());
@@ -286,7 +286,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
}
// Update Code Model
- QSet<QString> filePaths;
+ QSet<FilePath> filePaths;
for (const TestDocumentPtr &testFile : testFiles)
filePaths << testFile->filePath();
QVERIFY(parseFiles(filePaths));
@@ -302,7 +302,8 @@ F2TestCase::F2TestCase(CppEditorAction action,
// The file is "Full Checked" since it is in the working copy now,
// that is the function bodies are processed.
forever {
- const Document::Ptr document = waitForFileInGlobalSnapshot(testFile->filePath());
+ const Document::Ptr document =
+ waitForFileInGlobalSnapshot(testFile->filePath().toString());
QVERIFY(document);
if (document->checkMode() == Document::FullCheck) {
if (!document->diagnosticMessages().isEmpty())
@@ -405,7 +406,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
BaseTextEditor *currentTextEditor = dynamic_cast<BaseTextEditor*>(currentEditor);
QVERIFY(currentTextEditor);
- QCOMPARE(currentTextEditor->document()->filePath().toString(), targetTestFile->filePath());
+ QCOMPARE(currentTextEditor->document()->filePath(), targetTestFile->filePath());
int expectedLine, expectedColumn;
if (useClangd && expectedVirtualFunctionProposal.size() == 1) {
expectedLine = expectedVirtualFunctionProposal.first().line;