Commit 02d26f92 authored by hjk's avatar hjk Committed by Nikolai Kosjar

CppEditor: Compile fix for clang after renaming

Change-Id: Iaabb45fb066afb600718d874a0461bc88fae92e5
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent c094592f
......@@ -48,17 +48,19 @@
*/
using namespace Core;
using namespace CPlusPlus;
using namespace CppEditor::Internal;
namespace {
typedef QByteArray _;
namespace { typedef QByteArray _; }
/**
* Encapsulates the whole process of setting up an editor,
* pressing ENTER and checking the result.
*/
class DoxygenTestCase : public CppEditor::Internal::Tests::TestCase
namespace CppEditor {
namespace Internal {
namespace Tests {
class DoxygenTestCase : public Internal::Tests::TestCase
{
public:
/// The '|' in the input denotes the cursor position.
......@@ -66,7 +68,7 @@ public:
{
QVERIFY(succeededSoFar());
CppEditor::Internal::Tests::TestDocument testDocument("file.cpp", original, '|');
TestDocument testDocument("file.cpp", original, '|');
QVERIFY(testDocument.hasCursorMarker());
testDocument.m_source.remove(testDocument.m_cursorPosition, 1);
QVERIFY(testDocument.writeToDisk());
......@@ -103,7 +105,7 @@ public:
}
};
} // anonymous namespace
} // namespace Tests
void CppEditorPlugin::test_doxygen_comments_data()
{
......@@ -248,5 +250,8 @@ void CppEditorPlugin::test_doxygen_comments()
{
QFETCH(QByteArray, given);
QFETCH(QByteArray, expected);
DoxygenTestCase(given, expected);
Tests::DoxygenTestCase(given, expected);
}
} // namespace Internal
} // namespace CppEditor
......@@ -57,9 +57,17 @@
#include <QTreeView>
#include <QVBoxLayout>
#ifdef WITH_TESTS
#include "cppeditorplugin.h"
#include "cppquickfix_test.h"
#include <QtTest>
#endif
using namespace CPlusPlus;
using namespace CppEditor;
using namespace CppEditor::Internal;
using namespace CppTools;
using namespace TextEditor;
......@@ -124,6 +132,8 @@ public:
} // namespace Internal
} // namespace CppEditor
Q_DECLARE_METATYPE(CppEditor::Internal::InsertVirtualMethodsDialog::ImplementationMode)
namespace {
class InsertVirtualMethodsItem
......@@ -419,10 +429,7 @@ private:
return static_cast<InsertVirtualMethodsItem *>(index.internalPointer());
}
};
}
}
namespace {
class InsertVirtualMethodsOp : public CppQuickFixOperation
{
public:
......@@ -859,8 +866,6 @@ private:
bool m_hideReimplemented;
};
} // anonymous namespace
InsertVirtualMethodsDialog::InsertVirtualMethodsDialog(QWidget *parent)
: QDialog(parent)
, m_view(0)
......@@ -1087,12 +1092,7 @@ void InsertVirtualMethods::match(const CppQuickFixInterface &interface, QuickFix
#ifdef WITH_TESTS
#include "cppeditorplugin.h"
#include "cppquickfix_test.h"
using namespace CppEditor::Internal::Tests;
#include <QtTest>
namespace Tests {
typedef QByteArray _;
......@@ -1113,14 +1113,14 @@ public:
bool insertKeywordVirtual() const { return m_insertKeywordVirtual; }
};
} // namespace Tests
InsertVirtualMethods *InsertVirtualMethods::createTestFactory()
{
return new InsertVirtualMethods(new InsertVirtualMethodsDialogTest(
return new InsertVirtualMethods(new Tests::InsertVirtualMethodsDialogTest(
InsertVirtualMethodsDialog::ModeOutsideClass, true));
}
Q_DECLARE_METATYPE(InsertVirtualMethodsDialog::ImplementationMode)
void CppEditorPlugin::test_quickfix_InsertVirtualMethods_data()
{
QTest::addColumn<InsertVirtualMethodsDialog::ImplementationMode>("implementationMode");
......@@ -1631,14 +1631,14 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods()
QFETCH(QByteArray, expected);
InsertVirtualMethods factory(
new InsertVirtualMethodsDialogTest(implementationMode, insertVirtualKeyword));
QuickFixTestCase(singleDocument(original, expected), &factory);
new Tests::InsertVirtualMethodsDialogTest(implementationMode, insertVirtualKeyword));
Tests::QuickFixTestCase(Tests::singleDocument(original, expected), &factory);
}
/// Check: Insert in implementation file
void CppEditorPlugin::test_quickfix_InsertVirtualMethods_implementationFile()
{
QList<QuickFixTestDocument::Ptr> testFiles;
QList<Tests::QuickFixTestDocument::Ptr> testFiles;
QByteArray original;
QByteArray expected;
......@@ -1665,7 +1665,7 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_implementationFile()
"public:\n"
" virtual int a();\n"
"};\n";
testFiles << QuickFixTestDocument::create("file.h", original, expected);
testFiles << Tests::QuickFixTestDocument::create("file.h", original, expected);
// Source File
original = "#include \"file.h\"\n";
......@@ -1674,17 +1674,17 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_implementationFile()
"\n\n"
"int Derived::a()\n"
"{\n}";
testFiles << QuickFixTestDocument::create("file.cpp", original, expected);
testFiles << Tests::QuickFixTestDocument::create("file.cpp", original, expected);
InsertVirtualMethods factory(new InsertVirtualMethodsDialogTest(
InsertVirtualMethods factory(new Tests::InsertVirtualMethodsDialogTest(
InsertVirtualMethodsDialog::ModeImplementationFile, true));
QuickFixTestCase(testFiles, &factory);
Tests::QuickFixTestCase(testFiles, &factory);
}
/// Check: Qualified names.
void CppEditorPlugin::test_quickfix_InsertVirtualMethods_BaseClassInNamespace()
{
QList<QuickFixTestDocument::Ptr> testFiles;
QList<Tests::QuickFixTestDocument::Ptr> testFiles;
QByteArray original;
QByteArray expected;
......@@ -1717,7 +1717,7 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_BaseClassInNamespace()
"public:\n"
" virtual BaseNS::BaseEnum a(BaseNS::BaseEnum e);\n"
"};\n";
testFiles << QuickFixTestDocument::create("file.h", original, expected);
testFiles << Tests::QuickFixTestDocument::create("file.h", original, expected);
// Source File
original = "#include \"file.h\"\n";
......@@ -1726,12 +1726,15 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_BaseClassInNamespace()
"\n\n"
"BaseNS::BaseEnum Derived::a(BaseNS::BaseEnum e)\n"
"{\n}";
testFiles << QuickFixTestDocument::create("file.cpp", original, expected);
testFiles << Tests::QuickFixTestDocument::create("file.cpp", original, expected);
InsertVirtualMethods factory(new InsertVirtualMethodsDialogTest(
InsertVirtualMethods factory(new Tests::InsertVirtualMethodsDialogTest(
InsertVirtualMethodsDialog::ModeImplementationFile, true));
QuickFixTestCase(testFiles, &factory);
Tests::QuickFixTestCase(testFiles, &factory);
}
#endif
#endif // WITH_TESTS
} // namespace Internal
} // namespace CppEditor
#include "cppinsertvirtualmethods.moc"
......@@ -49,10 +49,7 @@
*/
using namespace Core;
using namespace CPlusPlus;
using namespace CppEditor;
using namespace CppEditor::Internal;
using namespace CppEditor::Internal::Tests;
using namespace CppTools;
using namespace TextEditor;
using CppTools::Tests::TestIncludePaths;
......@@ -115,10 +112,6 @@ static QString &removeTrailingWhitespace(QString &input)
return input;
}
} // namespace Tests
} // namespace Internal
} // namespace CppEditor
/// The '@' in the originalSource is the position from where the quick-fix discovery is triggered.
/// Exactly one TestFile must contain the cursor position marker '@' in the originalSource.
QuickFixTestCase::QuickFixTestCase(const QList<QuickFixTestDocument::Ptr> &theTestFiles,
......@@ -259,9 +252,17 @@ QSharedPointer<TextEditor::QuickFixOperation> QuickFixTestCase::getFix(
return results.isEmpty() ? QuickFixOperation::Ptr() : results.at(resultIndex);
}
} // namespace Tests
} // namespace Internal
typedef QSharedPointer<CppQuickFixFactory> CppQuickFixFactoryPtr;
Q_DECLARE_METATYPE(CppQuickFixFactoryPtr)
} // namespace CppEditor
Q_DECLARE_METATYPE(CppEditor::CppQuickFixFactoryPtr)
namespace CppEditor {
namespace Internal {
void CppEditorPlugin::test_quickfix_data()
{
......@@ -1775,8 +1776,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_notTriggeringWhenDefinitio
const QByteArray expected = original;
InsertDefFromDecl factory;
QuickFixTestCase test(singleDocument(original, expected), &factory, ProjectPart::HeaderPaths(),
1);
QuickFixTestCase(singleDocument(original, expected), &factory, ProjectPart::HeaderPaths(), 1);
}
/// Find right implementation file.
......@@ -3827,3 +3827,6 @@ void CppEditorPlugin::test_quickfix_ExtractLiteralAsParameter_notTriggeringForIn
ExtractLiteralAsParameter factory;
QuickFixTestCase(testFiles, &factory);
}
} // namespace Internal
} // namespace CppEditor
......@@ -69,8 +69,6 @@
*/
using namespace CPlusPlus;
using namespace CppEditor;
using namespace CppEditor::Internal;
using namespace CppTools;
using namespace TextEditor;
using namespace Core;
......@@ -105,10 +103,11 @@ template<> char *toString(const OverrideItem &data)
}
QT_END_NAMESPACE
namespace {
typedef QByteArray _;
namespace CppEditor {
namespace Internal {
/// A fake virtual functions assist provider that runs processor->perform() already in configure()
class VirtualFunctionTestAssistProvider : public VirtualFunctionAssistProvider
{
......@@ -183,11 +182,11 @@ typedef QSharedPointer<TestDocument> TestDocumentPtr;
* - a '@' character denotes the initial text cursor position
* - a '$' character denotes the target text cursor position
*/
class TestDocument : public CppEditor::Internal::Tests::TestDocument
class TestDocument : public Tests::TestDocument
{
public:
TestDocument(const QByteArray &source, const QByteArray &fileName)
: CppEditor::Internal::Tests::TestDocument(fileName, source)
: Tests::TestDocument(fileName, source)
, m_targetCursorPosition(m_source.indexOf(QLatin1Char('$')))
{
if (m_cursorPosition != -1 || m_targetCursorPosition != -1)
......@@ -229,7 +228,7 @@ QList<TestDocumentPtr> singleDocument(const QByteArray &source)
* executing Follow Symbol Under Cursor or Switch Between Function Declaration/Definition
* and checking the result.
*/
class F2TestCase : public CppEditor::Internal::Tests::TestCase
class F2TestCase : public Tests::TestCase
{
public:
enum CppEditorAction {
......@@ -380,9 +379,13 @@ TestDocumentPtr F2TestCase::testFileWithTargetCursorMarker(const QList<TestDocum
return TestDocumentPtr();
}
} // anonymous namespace
} // namespace Internal
} // namespace CppEditor
Q_DECLARE_METATYPE(QList<TestDocumentPtr>)
Q_DECLARE_METATYPE(QList<CppEditor::Internal::TestDocumentPtr>)
namespace CppEditor {
namespace Internal {
void CppEditorPlugin::test_SwitchMethodDeclarationDefinition_data()
{
......@@ -1472,6 +1475,9 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall_multipleD
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, testFiles, finalResults);
}
} // namespace Internal
} // namespace CppEditor
/*
Potential test cases improving name lookup.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment