forked from qt-creator/qt-creator
CppEditor: Fix ModelManagerTest
Amends 69571427a3
.
Change-Id: I07fa0acb34b8277a6790bbd529a7d39190ce846f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1000,9 +1000,7 @@ void ModelManagerTest::testRenameIncludes()
|
||||
}
|
||||
|
||||
// Renaming the header
|
||||
QVERIFY(Core::FileUtils::renameFile(oldHeader,
|
||||
newHeader,
|
||||
Core::HandleIncludeGuards::Yes));
|
||||
QVERIFY(ProjectExplorerPlugin::renameFile(oldHeader, newHeader));
|
||||
|
||||
// Update the c++ model manager again and check for the new includes
|
||||
CppModelManager::updateSourceFiles(sourceFiles).waitForFinished();
|
||||
@@ -1070,15 +1068,12 @@ void ModelManagerTest::testRenameIncludesInEditor()
|
||||
QVERIFY(CppModelManager::workingCopy().get(mainFile));
|
||||
|
||||
// Test the renaming of a header file where a pragma once guard is present
|
||||
QVERIFY(Core::FileUtils::renameFile(headerWithPragmaOnce,
|
||||
renamedHeaderWithPragmaOnce,
|
||||
Core::HandleIncludeGuards::Yes));
|
||||
QVERIFY(ProjectExplorerPlugin::renameFile(headerWithPragmaOnce, renamedHeaderWithPragmaOnce));
|
||||
|
||||
// Test the renaming the header with include guard:
|
||||
// The contents should match the foobar2000.h in the testdata_project2 project
|
||||
QVERIFY(Core::FileUtils::renameFile(Utils::FilePath::fromString(headerWithNormalGuard),
|
||||
Utils::FilePath::fromString(renamedHeaderWithNormalGuard),
|
||||
Core::HandleIncludeGuards::Yes));
|
||||
QVERIFY(ProjectExplorerPlugin::renameFile(FilePath::fromString(headerWithNormalGuard),
|
||||
FilePath::fromString(renamedHeaderWithNormalGuard)));
|
||||
|
||||
const MyTestDataDir testDir2(_("testdata_project2"));
|
||||
QFile foobar2000Header(testDir2.file("foobar2000.h"));
|
||||
|
@@ -2484,6 +2484,16 @@ QList<std::pair<FilePath, FilePath>> ProjectExplorerPlugin::renameFiles(
|
||||
return renamedFiles;
|
||||
}
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
bool ProjectExplorerPlugin::renameFile(const Utils::FilePath &source, const Utils::FilePath &target)
|
||||
{
|
||||
const bool success = Core::FileUtils::renameFile(source, target, HandleIncludeGuards::Yes);
|
||||
if (success)
|
||||
emit instance()->filesRenamed({std::make_pair(source, target)});
|
||||
return success;
|
||||
}
|
||||
#endif // WITH_TESTS
|
||||
|
||||
void ProjectExplorerPluginPrivate::startRunControl(RunControl *runControl)
|
||||
{
|
||||
m_outputPane.createNewOutputWindow(runControl);
|
||||
|
@@ -129,6 +129,10 @@ public:
|
||||
static QList<std::pair<Utils::FilePath, Utils::FilePath>>
|
||||
renameFiles(const QList<std::pair<Node *, Utils::FilePath>> &nodesAndNewFilePaths);
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
static bool renameFile(const Utils::FilePath &source, const Utils::FilePath &target);
|
||||
#endif
|
||||
|
||||
static QStringList projectFilePatterns();
|
||||
static bool isProjectFile(const Utils::FilePath &filePath);
|
||||
static RecentProjectsEntries recentProjects();
|
||||
|
Reference in New Issue
Block a user