C++: Add support for prefixes in switch header/source

Task-number: QTCREATORBUG-11031

Change-Id: I93cce0ebf46984eb06094e1f1519717be2bbaa79
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Orgad Shaneh
2014-01-20 09:15:50 +02:00
committed by Petar Perisin
parent 4eff289e03
commit 1fd576c1f6
6 changed files with 115 additions and 10 deletions

View File

@@ -29,6 +29,7 @@
#include "cpptoolsplugin.h"
#include "cpptoolsreuse.h"
#include "cppfilesettingspage.h"
#include <utils/fileutils.h>
@@ -81,16 +82,31 @@ void CppToolsPlugin::test_headersource_data()
QTest::addColumn<QString>("headerFileName");
QTest::newRow("samedir") << _("foo.cpp") << _("foo.h");
QTest::newRow("includesub") << _("foo.cpp") << _("include/foo.h");
QTest::newRow("headerprefix") << _("foo.cpp") << _("testh_foo.h");
QTest::newRow("sourceprefixwsub") << _("testc_foo.cpp") << _("include/foo.h");
QTest::newRow("sourceAndHeaderPrefixWithBothsub") << _("src/testc_foo.cpp") << _("include/testh_foo.h");
}
void CppToolsPlugin::initTestCase()
{
QDir(baseTestDir()).mkpath(_("."));
m_fileSettings->headerSearchPaths.append(QLatin1String("include"));
m_fileSettings->headerSearchPaths.append(QLatin1String("../include"));
m_fileSettings->sourceSearchPaths.append(QLatin1String("src"));
m_fileSettings->sourceSearchPaths.append(QLatin1String("../src"));
m_fileSettings->headerPrefixes.append(QLatin1String("testh_"));
m_fileSettings->sourcePrefixes.append(QLatin1String("testc_"));
}
void CppToolsPlugin::cleanupTestCase()
{
Utils::FileUtils::removeRecursively(Utils::FileName::fromString(baseTestDir()));
m_fileSettings->headerSearchPaths.removeLast();
m_fileSettings->headerSearchPaths.removeLast();
m_fileSettings->sourceSearchPaths.removeLast();
m_fileSettings->sourceSearchPaths.removeLast();
m_fileSettings->headerPrefixes.removeLast();
m_fileSettings->sourcePrefixes.removeLast();
}
} // namespace Internal