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
|
// Renaming the header
|
||||||
QVERIFY(Core::FileUtils::renameFile(oldHeader,
|
QVERIFY(ProjectExplorerPlugin::renameFile(oldHeader, newHeader));
|
||||||
newHeader,
|
|
||||||
Core::HandleIncludeGuards::Yes));
|
|
||||||
|
|
||||||
// Update the c++ model manager again and check for the new includes
|
// Update the c++ model manager again and check for the new includes
|
||||||
CppModelManager::updateSourceFiles(sourceFiles).waitForFinished();
|
CppModelManager::updateSourceFiles(sourceFiles).waitForFinished();
|
||||||
@@ -1070,15 +1068,12 @@ void ModelManagerTest::testRenameIncludesInEditor()
|
|||||||
QVERIFY(CppModelManager::workingCopy().get(mainFile));
|
QVERIFY(CppModelManager::workingCopy().get(mainFile));
|
||||||
|
|
||||||
// Test the renaming of a header file where a pragma once guard is present
|
// Test the renaming of a header file where a pragma once guard is present
|
||||||
QVERIFY(Core::FileUtils::renameFile(headerWithPragmaOnce,
|
QVERIFY(ProjectExplorerPlugin::renameFile(headerWithPragmaOnce, renamedHeaderWithPragmaOnce));
|
||||||
renamedHeaderWithPragmaOnce,
|
|
||||||
Core::HandleIncludeGuards::Yes));
|
|
||||||
|
|
||||||
// Test the renaming the header with include guard:
|
// Test the renaming the header with include guard:
|
||||||
// The contents should match the foobar2000.h in the testdata_project2 project
|
// The contents should match the foobar2000.h in the testdata_project2 project
|
||||||
QVERIFY(Core::FileUtils::renameFile(Utils::FilePath::fromString(headerWithNormalGuard),
|
QVERIFY(ProjectExplorerPlugin::renameFile(FilePath::fromString(headerWithNormalGuard),
|
||||||
Utils::FilePath::fromString(renamedHeaderWithNormalGuard),
|
FilePath::fromString(renamedHeaderWithNormalGuard)));
|
||||||
Core::HandleIncludeGuards::Yes));
|
|
||||||
|
|
||||||
const MyTestDataDir testDir2(_("testdata_project2"));
|
const MyTestDataDir testDir2(_("testdata_project2"));
|
||||||
QFile foobar2000Header(testDir2.file("foobar2000.h"));
|
QFile foobar2000Header(testDir2.file("foobar2000.h"));
|
||||||
|
@@ -2484,6 +2484,16 @@ QList<std::pair<FilePath, FilePath>> ProjectExplorerPlugin::renameFiles(
|
|||||||
return renamedFiles;
|
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)
|
void ProjectExplorerPluginPrivate::startRunControl(RunControl *runControl)
|
||||||
{
|
{
|
||||||
m_outputPane.createNewOutputWindow(runControl);
|
m_outputPane.createNewOutputWindow(runControl);
|
||||||
|
@@ -129,6 +129,10 @@ public:
|
|||||||
static QList<std::pair<Utils::FilePath, Utils::FilePath>>
|
static QList<std::pair<Utils::FilePath, Utils::FilePath>>
|
||||||
renameFiles(const QList<std::pair<Node *, Utils::FilePath>> &nodesAndNewFilePaths);
|
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 QStringList projectFilePatterns();
|
||||||
static bool isProjectFile(const Utils::FilePath &filePath);
|
static bool isProjectFile(const Utils::FilePath &filePath);
|
||||||
static RecentProjectsEntries recentProjects();
|
static RecentProjectsEntries recentProjects();
|
||||||
|
Reference in New Issue
Block a user