FilePathify some testing code

Change-Id: I3739a6eb3c2172078e9519e8186daf94ec74d99a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2023-01-12 15:30:01 +01:00
parent 2ce413112b
commit 33cdb052ba
13 changed files with 63 additions and 68 deletions

View File

@@ -81,7 +81,7 @@ void AutoTestUnitTests::cleanupTestCase()
void AutoTestUnitTests::testCodeParser() void AutoTestUnitTests::testCodeParser()
{ {
QFETCH(QString, projectFilePath); QFETCH(FilePath, projectFilePath);
QFETCH(int, expectedAutoTestsCount); QFETCH(int, expectedAutoTestsCount);
QFETCH(int, expectedNamedQuickTestsCount); QFETCH(int, expectedNamedQuickTestsCount);
QFETCH(int, expectedUnnamedQuickTestsCount); QFETCH(int, expectedUnnamedQuickTestsCount);
@@ -106,30 +106,30 @@ void AutoTestUnitTests::testCodeParser()
void AutoTestUnitTests::testCodeParser_data() void AutoTestUnitTests::testCodeParser_data()
{ {
QTest::addColumn<QString>("projectFilePath"); QTest::addColumn<FilePath>("projectFilePath");
QTest::addColumn<int>("expectedAutoTestsCount"); QTest::addColumn<int>("expectedAutoTestsCount");
QTest::addColumn<int>("expectedNamedQuickTestsCount"); QTest::addColumn<int>("expectedNamedQuickTestsCount");
QTest::addColumn<int>("expectedUnnamedQuickTestsCount"); QTest::addColumn<int>("expectedUnnamedQuickTestsCount");
QTest::addColumn<int>("expectedDataTagsCount"); QTest::addColumn<int>("expectedDataTagsCount");
const FilePath base = m_tmpDir->filePath();
QTest::newRow("plainAutoTest") QTest::newRow("plainAutoTest")
<< QString(m_tmpDir->path() + "/plain/plain.pro") << base / "plain/plain.pro"
<< 1 << 0 << 0 << 0; << 1 << 0 << 0 << 0;
QTest::newRow("mixedAutoTestAndQuickTests") QTest::newRow("mixedAutoTestAndQuickTests")
<< QString(m_tmpDir->path() + "/mixed_atp/mixed_atp.pro") << base / "mixed_atp/mixed_atp.pro"
<< 4 << 10 << 5 << 10; << 4 << 10 << 5 << 10;
QTest::newRow("plainAutoTestQbs") QTest::newRow("plainAutoTestQbs")
<< QString(m_tmpDir->path() + "/plain/plain.qbs") << base / "plain/plain.qbs"
<< 1 << 0 << 0 << 0; << 1 << 0 << 0 << 0;
QTest::newRow("mixedAutoTestAndQuickTestsQbs") QTest::newRow("mixedAutoTestAndQuickTestsQbs")
<< QString(m_tmpDir->path() + "/mixed_atp/mixed_atp.qbs") << base / "mixed_atp/mixed_atp.qbs"
<< 4 << 10 << 5 << 10; << 4 << 10 << 5 << 10;
} }
void AutoTestUnitTests::testCodeParserSwitchStartup() void AutoTestUnitTests::testCodeParserSwitchStartup()
{ {
QFETCH(QStringList, projectFilePaths); QFETCH(FilePaths, projectFilePaths);
QFETCH(QList<int>, expectedAutoTestsCount); QFETCH(QList<int>, expectedAutoTestsCount);
QFETCH(QList<int>, expectedNamedQuickTestsCount); QFETCH(QList<int>, expectedNamedQuickTestsCount);
QFETCH(QList<int>, expectedUnnamedQuickTestsCount); QFETCH(QList<int>, expectedUnnamedQuickTestsCount);
@@ -157,16 +157,19 @@ void AutoTestUnitTests::testCodeParserSwitchStartup()
void AutoTestUnitTests::testCodeParserSwitchStartup_data() void AutoTestUnitTests::testCodeParserSwitchStartup_data()
{ {
QTest::addColumn<QStringList>("projectFilePaths"); QTest::addColumn<FilePaths>("projectFilePaths");
QTest::addColumn<QList<int> >("expectedAutoTestsCount"); QTest::addColumn<QList<int> >("expectedAutoTestsCount");
QTest::addColumn<QList<int> >("expectedNamedQuickTestsCount"); QTest::addColumn<QList<int> >("expectedNamedQuickTestsCount");
QTest::addColumn<QList<int> >("expectedUnnamedQuickTestsCount"); QTest::addColumn<QList<int> >("expectedUnnamedQuickTestsCount");
QTest::addColumn<QList<int> >("expectedDataTagsCount"); QTest::addColumn<QList<int> >("expectedDataTagsCount");
QStringList projects = QStringList({m_tmpDir->path() + "/plain/plain.pro", const FilePath base = m_tmpDir->filePath();
m_tmpDir->path() + "/mixed_atp/mixed_atp.pro", FilePaths projects {
m_tmpDir->path() + "/plain/plain.qbs", base / "plain/plain.pro",
m_tmpDir->path() + "/mixed_atp/mixed_atp.qbs"}); base / "mixed_atp/mixed_atp.pro",
base / "plain/plain.qbs",
base / "mixed_atp/mixed_atp.qbs"
};
QList<int> expectedAutoTests = QList<int>() << 1 << 4 << 1 << 4; QList<int> expectedAutoTests = QList<int>() << 1 << 4 << 1 << 4;
QList<int> expectedNamedQuickTests = QList<int>() << 0 << 10 << 0 << 10; QList<int> expectedNamedQuickTests = QList<int>() << 0 << 10 << 0 << 10;
@@ -183,7 +186,7 @@ void AutoTestUnitTests::testCodeParserGTest()
if (qtcEnvironmentVariableIsEmpty("GOOGLETEST_DIR")) if (qtcEnvironmentVariableIsEmpty("GOOGLETEST_DIR"))
QSKIP("This test needs googletest - set GOOGLETEST_DIR (point to googletest repository)"); QSKIP("This test needs googletest - set GOOGLETEST_DIR (point to googletest repository)");
QFETCH(QString, projectFilePath); QFETCH(FilePath, projectFilePath);
CppEditor::Tests::ProjectOpenerAndCloser projectManager; CppEditor::Tests::ProjectOpenerAndCloser projectManager;
QVERIFY(projectManager.open(projectFilePath, true, m_kit)); QVERIFY(projectManager.open(projectFilePath, true, m_kit));
@@ -219,11 +222,11 @@ void AutoTestUnitTests::testCodeParserGTest()
void AutoTestUnitTests::testCodeParserGTest_data() void AutoTestUnitTests::testCodeParserGTest_data()
{ {
QTest::addColumn<QString>("projectFilePath"); QTest::addColumn<FilePath>("projectFilePath");
QTest::newRow("simpleGoogletest") QTest::newRow("simpleGoogletest")
<< QString(m_tmpDir->path() + "/simple_gt/simple_gt.pro"); << m_tmpDir->filePath() / "simple_gt/simple_gt.pro";
QTest::newRow("simpleGoogletestQbs") QTest::newRow("simpleGoogletestQbs")
<< QString(m_tmpDir->path() + "/simple_gt/simple_gt.qbs"); << m_tmpDir->filePath() / "simple_gt/simple_gt.qbs";
} }
void AutoTestUnitTests::testCodeParserBoostTest() void AutoTestUnitTests::testCodeParserBoostTest()
@@ -231,7 +234,7 @@ void AutoTestUnitTests::testCodeParserBoostTest()
if (!m_checkBoost) if (!m_checkBoost)
QSKIP("This test needs boost - set BOOST_INCLUDE_DIR (or have it installed)"); QSKIP("This test needs boost - set BOOST_INCLUDE_DIR (or have it installed)");
QFETCH(QString, projectFilePath); QFETCH(FilePath, projectFilePath);
QFETCH(QString, extension); QFETCH(QString, extension);
CppEditor::Tests::ProjectOpenerAndCloser projectManager; CppEditor::Tests::ProjectOpenerAndCloser projectManager;
const CppEditor::ProjectInfo::ConstPtr projectInfo const CppEditor::ProjectInfo::ConstPtr projectInfo

View File

@@ -68,7 +68,7 @@ bool LoadProjectScenario::init()
bool LoadProjectScenario::loadProject() bool LoadProjectScenario::loadProject()
{ {
const QString projectFilePath = m_tmpDir->path() + "/plain/plain.pro"; const FilePath projectFilePath = m_tmpDir->filePath() / "/plain/plain.pro";
CppEditor::Tests::ProjectOpenerAndCloser projectManager; CppEditor::Tests::ProjectOpenerAndCloser projectManager;
// This code must trigger a call to PluginManager::finishScenario() at some later point. // This code must trigger a call to PluginManager::finishScenario() at some later point.

View File

@@ -64,9 +64,9 @@ namespace Tests {
const Usage::Tags Initialization{Usage::Tag::Declaration, Usage::Tag::Write}; const Usage::Tags Initialization{Usage::Tag::Declaration, Usage::Tag::Write};
static QString qrcPath(const QByteArray &relativeFilePath) static QString qrcPath(const QString &relativeFilePath)
{ {
return QLatin1String(":/unittests/ClangCodeModel/") + QString::fromUtf8(relativeFilePath); return ":/unittests/ClangCodeModel/" + relativeFilePath;
} }
ClangdTest::~ClangdTest() ClangdTest::~ClangdTest()
@@ -79,7 +79,7 @@ ClangdTest::~ClangdTest()
Utils::FilePath ClangdTest::filePath(const QString &fileName) const Utils::FilePath ClangdTest::filePath(const QString &fileName) const
{ {
return Utils::FilePath::fromString(m_projectDir->absolutePath(fileName.toLocal8Bit())); return m_projectDir->absolutePath(fileName);
} }
void ClangdTest::waitForNewClient(bool withIndex) void ClangdTest::waitForNewClient(bool withIndex)
@@ -133,11 +133,10 @@ void ClangdTest::initTestCase()
QSKIP("The test requires at least one valid kit with a valid Qt"); QSKIP("The test requires at least one valid kit with a valid Qt");
// Copy project out of qrc file, open it, and set up target. // Copy project out of qrc file, open it, and set up target.
m_projectDir = new TemporaryCopiedDir(qrcPath(QFileInfo(m_projectFileName) m_projectDir = new TemporaryCopiedDir(qrcPath(QFileInfo(m_projectFileName).baseName()));
.baseName().toLocal8Bit()));
QVERIFY(m_projectDir->isValid()); QVERIFY(m_projectDir->isValid());
const auto openProjectResult = ProjectExplorerPlugin::openProject( const auto openProjectResult = ProjectExplorerPlugin::openProject(
Utils::FilePath::fromString(m_projectDir->absolutePath(m_projectFileName.toUtf8()))); m_projectDir->absolutePath(m_projectFileName));
QVERIFY2(openProjectResult, qPrintable(openProjectResult.errorMessage())); QVERIFY2(openProjectResult, qPrintable(openProjectResult.errorMessage()));
m_project = openProjectResult.project(); m_project = openProjectResult.project();
m_project->configureAsExampleProject(m_kit); m_project->configureAsExampleProject(m_kit);
@@ -147,8 +146,7 @@ void ClangdTest::initTestCase()
// Open cpp documents. // Open cpp documents.
for (const QString &sourceFileName : std::as_const(m_sourceFileNames)) { for (const QString &sourceFileName : std::as_const(m_sourceFileNames)) {
const auto sourceFilePath = Utils::FilePath::fromString( const auto sourceFilePath = m_projectDir->absolutePath(sourceFileName);
m_projectDir->absolutePath(sourceFileName.toLocal8Bit()));
QVERIFY2(sourceFilePath.exists(), qPrintable(sourceFilePath.toUserOutput())); QVERIFY2(sourceFilePath.exists(), qPrintable(sourceFilePath.toUserOutput()));
IEditor * const editor = EditorManager::openEditor(sourceFilePath); IEditor * const editor = EditorManager::openEditor(sourceFilePath);
QVERIFY(editor); QVERIFY(editor);

View File

@@ -29,21 +29,20 @@ void ClangFixItTest::testDescription()
Utils::FilePath ClangFixItTest::semicolonFilePath() const Utils::FilePath ClangFixItTest::semicolonFilePath() const
{ {
return Utils::FilePath::fromString(m_dataDir->absolutePath("diagnostic_semicolon_fixit.cpp")); return m_dataDir->absolutePath("diagnostic_semicolon_fixit.cpp");
} }
Utils::FilePath ClangFixItTest::compareFilePath() const Utils::FilePath ClangFixItTest::compareFilePath() const
{ {
return Utils::FilePath::fromString(m_dataDir->absolutePath("diagnostic_comparison_fixit.cpp")); return m_dataDir->absolutePath("diagnostic_comparison_fixit.cpp");
} }
QString ClangFixItTest::fileContent(const QByteArray &relFilePath) const QString ClangFixItTest::fileContent(const QString &relFilePath) const
{ {
QFile file(m_dataDir->absolutePath(relFilePath)); Utils::expected_str<QByteArray> data = m_dataDir->absolutePath(relFilePath).fileContents();
const bool isOpen = file.open(QFile::ReadOnly | QFile::Text); if (!data)
if (!isOpen) qDebug() << "File with the unsaved content cannot be opened!" << data.error();
qDebug() << "File with the unsaved content cannot be opened!"; return QString::fromUtf8(*data);
return QString::fromUtf8(file.readAll());
} }
ClangFixIt ClangFixItTest::semicolonFixIt() const ClangFixIt ClangFixItTest::semicolonFixIt() const

View File

@@ -30,7 +30,7 @@ private slots:
private: private:
Utils::FilePath semicolonFilePath() const; Utils::FilePath semicolonFilePath() const;
Utils::FilePath compareFilePath() const; Utils::FilePath compareFilePath() const;
QString fileContent(const QByteArray &relFilePath) const; QString fileContent(const QString &relFilePath) const;
ClangFixIt semicolonFixIt() const; ClangFixIt semicolonFixIt() const;

View File

@@ -84,7 +84,7 @@ static ClangDiagnosticConfig configFor(const QString &tidyChecks, const QString
void ClangToolsUnitTests::testProject() void ClangToolsUnitTests::testProject()
{ {
QFETCH(QString, projectFilePath); QFETCH(FilePath, projectFilePath);
QFETCH(int, expectedDiagCountClangTidy); QFETCH(int, expectedDiagCountClangTidy);
QFETCH(int, expectedDiagCountClazy); QFETCH(int, expectedDiagCountClazy);
QFETCH(ClangDiagnosticConfig, diagnosticConfig); QFETCH(ClangDiagnosticConfig, diagnosticConfig);
@@ -119,7 +119,7 @@ void ClangToolsUnitTests::testProject()
void ClangToolsUnitTests::testProject_data() void ClangToolsUnitTests::testProject_data()
{ {
QTest::addColumn<QString>("projectFilePath"); QTest::addColumn<FilePath>("projectFilePath");
QTest::addColumn<int>("expectedDiagCountClangTidy"); QTest::addColumn<int>("expectedDiagCountClangTidy");
QTest::addColumn<int>("expectedDiagCountClazy"); QTest::addColumn<int>("expectedDiagCountClazy");
QTest::addColumn<ClangDiagnosticConfig>("diagnosticConfig"); QTest::addColumn<ClangDiagnosticConfig>("diagnosticConfig");
@@ -161,8 +161,8 @@ void ClangToolsUnitTests::addTestRow(const QByteArray &relativeFilePath,
int expectedDiagCountClazy, int expectedDiagCountClazy,
const ClangDiagnosticConfig &diagnosticConfig) const ClangDiagnosticConfig &diagnosticConfig)
{ {
const QString absoluteFilePath = m_tmpDir->absolutePath(relativeFilePath); const FilePath absoluteFilePath = m_tmpDir->absolutePath(QString::fromUtf8(relativeFilePath));
const QString fileName = QFileInfo(absoluteFilePath).fileName(); const QString fileName = absoluteFilePath.fileName();
QTest::newRow(fileName.toUtf8().constData()) QTest::newRow(fileName.toUtf8().constData())
<< absoluteFilePath << expectedDiagCountClangTidy << expectedDiagCountClazy << absoluteFilePath << expectedDiagCountClangTidy << expectedDiagCountClazy

View File

@@ -267,8 +267,8 @@ QString ReadExportedDiagnosticsTest::createFile(const QString &yamlFilePath,
const QString &filePathToInject) const const QString &filePathToInject) const
{ {
QTC_ASSERT(QDir::isAbsolutePath(filePathToInject), return QString()); QTC_ASSERT(QDir::isAbsolutePath(filePathToInject), return QString());
const Utils::FilePath newFileName = FilePath::fromString(m_baseDir->absolutePath( const Utils::FilePath newFileName = m_baseDir->absolutePath(
QFileInfo(yamlFilePath).fileName().toLocal8Bit())); QFileInfo(yamlFilePath).fileName());
Utils::FileReader reader; Utils::FileReader reader;
if (QTC_GUARD(reader.fetch(Utils::FilePath::fromString(yamlFilePath), if (QTC_GUARD(reader.fetch(Utils::FilePath::fromString(yamlFilePath),
@@ -286,7 +286,7 @@ QString ReadExportedDiagnosticsTest::createFile(const QString &yamlFilePath,
FilePath ReadExportedDiagnosticsTest::filePath(const QString &fileName) const FilePath ReadExportedDiagnosticsTest::filePath(const QString &fileName) const
{ {
return FilePath::fromString(m_baseDir->absolutePath(fileName.toUtf8())); return m_baseDir->absolutePath(fileName);
} }
} // namespace ClangTools::Internal } // namespace ClangTools::Internal

View File

@@ -25,8 +25,7 @@ using namespace CppEditor;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
namespace CompilationDatabaseProjectManager { namespace CompilationDatabaseProjectManager::Internal {
namespace Internal {
CompilationDatabaseTests::CompilationDatabaseTests(QObject *parent) CompilationDatabaseTests::CompilationDatabaseTests(QObject *parent)
: QObject(parent) : QObject(parent)
@@ -57,7 +56,7 @@ void CompilationDatabaseTests::cleanupTestCase()
void CompilationDatabaseTests::testProject() void CompilationDatabaseTests::testProject()
{ {
QFETCH(QString, projectFilePath); QFETCH(FilePath, projectFilePath);
CppEditor::Tests::ProjectOpenerAndCloser projectManager; CppEditor::Tests::ProjectOpenerAndCloser projectManager;
const CppEditor::ProjectInfo::ConstPtr projectInfo = projectManager.open(projectFilePath, true); const CppEditor::ProjectInfo::ConstPtr projectInfo = projectManager.open(projectFilePath, true);
@@ -263,12 +262,11 @@ void CompilationDatabaseTests::testSkipOutputFiles()
QVERIFY(testData.getFilteredFlags().isEmpty()); QVERIFY(testData.getFilteredFlags().isEmpty());
} }
void CompilationDatabaseTests::addTestRow(const QByteArray &relativeFilePath) void CompilationDatabaseTests::addTestRow(const QString &relativeFilePath)
{ {
const QString absoluteFilePath = m_tmpDir->absolutePath(relativeFilePath); const FilePath absoluteFilePath = m_tmpDir->absolutePath(relativeFilePath);
QTest::newRow(relativeFilePath.constData()) << absoluteFilePath; QTest::newRow(qPrintable(relativeFilePath)) << absoluteFilePath;
} }
} // namespace Internal } // CompilationDatabaseProjectManager::Internal
} // namespace CompilationDatabaseProjectManager

View File

@@ -8,8 +8,7 @@
namespace CppEditor { namespace Tests { class TemporaryCopiedDir; } } namespace CppEditor { namespace Tests { class TemporaryCopiedDir; } }
namespace CompilationDatabaseProjectManager { namespace CompilationDatabaseProjectManager::Internal {
namespace Internal {
class CompilationDatabaseTests : public QObject class CompilationDatabaseTests : public QObject
{ {
@@ -34,10 +33,9 @@ private slots:
void testSkipOutputFiles(); void testSkipOutputFiles();
private: private:
void addTestRow(const QByteArray &relativeFilePath); void addTestRow(const QString &relativeFilePath);
std::unique_ptr<CppEditor::Tests::TemporaryCopiedDir> m_tmpDir; std::unique_ptr<CppEditor::Tests::TemporaryCopiedDir> m_tmpDir;
}; };
} // namespace Internal } // CompilationDatabaseProjectManager::Internal
} // namespace CompilationDatabaseProjectManager

View File

@@ -80,7 +80,7 @@ FilePaths toAbsolutePaths(const QStringList &relativePathList,
{ {
FilePaths result; FilePaths result;
for (const QString &file : relativePathList) for (const QString &file : relativePathList)
result << FilePath::fromString(temporaryDir.absolutePath(file.toUtf8())); result << temporaryDir.absolutePath(file);
return result; return result;
} }
@@ -456,7 +456,7 @@ void ModelManagerTest::testRefreshTimeStampModifiedIfSourcefilesChange()
QFETCH(QStringList, finalProjectFiles); QFETCH(QStringList, finalProjectFiles);
TemporaryCopiedDir temporaryDir(MyTestDataDir(QLatin1String("testdata_refresh2")).path()); TemporaryCopiedDir temporaryDir(MyTestDataDir(QLatin1String("testdata_refresh2")).path());
const FilePath filePath = FilePath::fromString(temporaryDir.absolutePath(fileToChange.toUtf8())); const FilePath filePath = temporaryDir.absolutePath(fileToChange);
const FilePaths initialProjectFilePaths = toAbsolutePaths(initialProjectFiles, temporaryDir); const FilePaths initialProjectFilePaths = toAbsolutePaths(initialProjectFiles, temporaryDir);
const FilePaths finalProjectFilePaths = toAbsolutePaths(finalProjectFiles, temporaryDir); const FilePaths finalProjectFilePaths = toAbsolutePaths(finalProjectFiles, temporaryDir);
@@ -594,7 +594,7 @@ void ModelManagerTest::testExtraeditorsupportUiFiles()
TemporaryCopiedDir temporaryDir(MyTestDataDir(QLatin1String("testdata_guiproject1")).path()); TemporaryCopiedDir temporaryDir(MyTestDataDir(QLatin1String("testdata_guiproject1")).path());
QVERIFY(temporaryDir.isValid()); QVERIFY(temporaryDir.isValid());
const QString projectFile = temporaryDir.absolutePath("testdata_guiproject1.pro"); const FilePath projectFile = temporaryDir.absolutePath("testdata_guiproject1.pro");
ProjectOpenerAndCloser projects; ProjectOpenerAndCloser projects;
QVERIFY(projects.open(projectFile, /*configureAsExampleProject=*/ true)); QVERIFY(projects.open(projectFile, /*configureAsExampleProject=*/ true));
@@ -618,8 +618,7 @@ void ModelManagerTest::testExtraeditorsupportUiFiles()
// Check CppSourceProcessor / includes. // Check CppSourceProcessor / includes.
// The CppSourceProcessor is expected to find the ui_* file in the working copy. // The CppSourceProcessor is expected to find the ui_* file in the working copy.
const FilePath fileIncludingTheUiFile = const FilePath fileIncludingTheUiFile = temporaryDir.absolutePath("mainwindow.cpp");
FilePath::fromString(temporaryDir.absolutePath("mainwindow.cpp"));
while (!mm->snapshot().document(fileIncludingTheUiFile)) while (!mm->snapshot().document(fileIncludingTheUiFile))
QCoreApplication::processEvents(); QCoreApplication::processEvents();

View File

@@ -391,11 +391,11 @@ ProjectOpenerAndCloser::~ProjectOpenerAndCloser()
QCoreApplication::processEvents(); QCoreApplication::processEvents();
} }
ProjectInfo::ConstPtr ProjectOpenerAndCloser::open(const QString &projectFile, ProjectInfo::ConstPtr ProjectOpenerAndCloser::open(const FilePath &projectFile,
bool configureAsExampleProject, Kit *kit) bool configureAsExampleProject, Kit *kit)
{ {
ProjectExplorerPlugin::OpenProjectResult result = ProjectExplorerPlugin::OpenProjectResult result =
ProjectExplorerPlugin::openProject(FilePath::fromString(projectFile)); ProjectExplorerPlugin::openProject(projectFile);
if (!result) { if (!result) {
qWarning() << result.errorMessage() << result.alreadyOpen(); qWarning() << result.errorMessage() << result.alreadyOpen();
return {}; return {};
@@ -476,9 +476,9 @@ TemporaryCopiedDir::TemporaryCopiedDir(const QString &sourceDirPath)
} }
} }
QString TemporaryCopiedDir::absolutePath(const QByteArray &relativePath) const FilePath TemporaryCopiedDir::absolutePath(const QString &relativePath) const
{ {
return m_temporaryDir.filePath(QString::fromUtf8(relativePath)).path(); return m_temporaryDir.filePath(relativePath);
} }
int clangdIndexingTimeout() int clangdIndexingTimeout()

View File

@@ -167,7 +167,7 @@ public:
~ProjectOpenerAndCloser(); // Closes opened projects ~ProjectOpenerAndCloser(); // Closes opened projects
ProjectInfo::ConstPtr open( ProjectInfo::ConstPtr open(
const QString &projectFile, const Utils::FilePath &projectFile,
bool configureAsExampleProject = false, bool configureAsExampleProject = false,
ProjectExplorer::Kit *kit = nullptr); ProjectExplorer::Kit *kit = nullptr);
@@ -197,7 +197,7 @@ class CPPEDITOR_EXPORT TemporaryCopiedDir : public TemporaryDir
{ {
public: public:
explicit TemporaryCopiedDir(const QString &sourceDirPath); explicit TemporaryCopiedDir(const QString &sourceDirPath);
QString absolutePath(const QByteArray &relativePath) const; Utils::FilePath absolutePath(const QString &relativePath) const;
private: private:
TemporaryCopiedDir(); TemporaryCopiedDir();

View File

@@ -2351,7 +2351,7 @@ void DebuggerUnitTests::cleanupTestCase()
void DebuggerUnitTests::testStateMachine() void DebuggerUnitTests::testStateMachine()
{ {
QString proFile = m_tmpDir->absolutePath("simple/simple.pro"); FilePath proFile = m_tmpDir->absolutePath("simple/simple.pro");
CppEditor::Tests::ProjectOpenerAndCloser projectManager; CppEditor::Tests::ProjectOpenerAndCloser projectManager;
QVERIFY(projectManager.open(proFile, true)); QVERIFY(projectManager.open(proFile, true));