CppEditor: Use test objects to group related test functions

Change-Id: I65089f2a00d8d168f123becf160f82bfcca4c68c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-08-25 17:34:11 +02:00
parent a952500e90
commit 59d2f96cf8
21 changed files with 701 additions and 514 deletions

View File

@@ -46,11 +46,12 @@ extend_qtc_plugin(CppEditor
SOURCES SOURCES
cppdoxygen_test.cpp cppdoxygen_test.h cppdoxygen_test.cpp cppdoxygen_test.h
cppeditortestcase.cpp cppeditortestcase.h cppeditortestcase.cpp cppeditortestcase.h
cppincludehierarchy_test.cpp cppincludehierarchy_test.cpp cppincludehierarchy_test.h
cppquickfix_test.cpp cppquickfix_test.h cppquickfix_test.cpp cppquickfix_test.h
cppuseselections_test.cpp cppuseselections_test.cpp cppuseselections_test.h
fileandtokenactions_test.cpp fileandtokenactions_test.cpp fileandtokenactions_test.h
followsymbol_switchmethoddecldef_test.cpp followsymbol_switchmethoddecldef_test.cpp followsymbol_switchmethoddecldef_test.h
EXPLICIT_MOC EXPLICIT_MOC
cppdoxygen_test.h cppdoxygen_test.h
cppquickfix_test.h
) )

View File

@@ -32,8 +32,23 @@
#include <QTextBlock> #include <QTextBlock>
#include <QTextCursor> #include <QTextCursor>
using namespace CppEditor; #ifdef WITH_TESTS
using namespace Internal; #include "cppeditor.h"
#include "cppeditorconstants.h"
#include "cppeditorplugin.h"
#include "cppeditorwidget.h"
#include <coreplugin/editormanager/editormanager.h>
#include <texteditor/icodestylepreferences.h>
#include <texteditor/textdocument.h>
#include <texteditor/texteditorsettings.h>
#include <utils/executeondestruction.h>
#include <QtTest>
#endif // WITH_TESTS
namespace CppEditor::Internal {
bool CppAutoCompleter::contextAllowsAutoBrackets(const QTextCursor &cursor, bool CppAutoCompleter::contextAllowsAutoBrackets(const QTextCursor &cursor,
const QString &textToInsert) const const QString &textToInsert) const
@@ -84,22 +99,7 @@ QString CppAutoCompleter::insertParagraphSeparator(const QTextCursor &cursor) co
} }
#ifdef WITH_TESTS #ifdef WITH_TESTS
namespace Tests {
#include "cppeditor.h"
#include "cppeditorwidget.h"
#include "cppeditorconstants.h"
#include "cppeditorplugin.h"
#include <coreplugin/editormanager/editormanager.h>
#include <texteditor/icodestylepreferences.h>
#include <texteditor/textdocument.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/tabsettings.h>
#include <QtTest>
#include <utils/executeondestruction.h>
enum FileContent { enum FileContent {
EmptyFile, EmptyFile,
@@ -204,7 +204,6 @@ static QChar closingChar(QChar c)
return QChar(); return QChar();
} }
namespace CppEditor { // MSVC Workaround: error C2872: 'CppEditor': ambiguous symbol
static QTextCursor openEditor(const QString &text) static QTextCursor openEditor(const QString &text)
{ {
QTextCursor tc; QTextCursor tc;
@@ -232,9 +231,8 @@ static QTextCursor openEditor(const QString &text)
} }
return tc; return tc;
} }
} // namespace CppEditor
void CppEditorPlugin::test_autoComplete_data() void AutoCompleterTest::testAutoComplete_data()
{ {
QTest::addColumn<QString>("text"); QTest::addColumn<QString>("text");
QTest::addColumn<QString>("textToInsert"); QTest::addColumn<QString>("textToInsert");
@@ -282,7 +280,7 @@ void CppEditorPlugin::test_autoComplete_data()
} }
} }
void CppEditorPlugin::test_autoComplete() void AutoCompleterTest::testAutoComplete()
{ {
QFETCH(QString, text); QFETCH(QString, text);
QFETCH(QString, textToInsert); QFETCH(QString, textToInsert);
@@ -307,7 +305,7 @@ void CppEditorPlugin::test_autoComplete()
QCOMPARE(skippedChars, expectedSkippedChars); QCOMPARE(skippedChars, expectedSkippedChars);
} }
void CppEditorPlugin::test_surroundWithSelection_data() void AutoCompleterTest::testSurroundWithSelection_data()
{ {
QTest::addColumn<QString>("text"); QTest::addColumn<QString>("text");
QTest::addColumn<QString>("textToInsert"); QTest::addColumn<QString>("textToInsert");
@@ -344,7 +342,7 @@ void CppEditorPlugin::test_surroundWithSelection_data()
+ closingChar(c)); + closingChar(c));
} }
void CppEditorPlugin::test_surroundWithSelection() void AutoCompleterTest::testSurroundWithSelection()
{ {
QFETCH(QString, text); QFETCH(QString, text);
QFETCH(QString, textToInsert); QFETCH(QString, textToInsert);
@@ -365,7 +363,7 @@ void CppEditorPlugin::test_surroundWithSelection()
QCOMPARE(matchingText, expectedText); QCOMPARE(matchingText, expectedText);
} }
void CppEditorPlugin::test_autoBackspace_data() void AutoCompleterTest::testAutoBackspace_data()
{ {
QTest::addColumn<QString>("text"); QTest::addColumn<QString>("text");
QTest::addColumn<bool>("expectedStopHandling"); QTest::addColumn<bool>("expectedStopHandling");
@@ -380,7 +378,7 @@ void CppEditorPlugin::test_autoBackspace_data()
} }
} }
void CppEditorPlugin::test_autoBackspace() void AutoCompleterTest::testAutoBackspace()
{ {
QFETCH(QString, text); QFETCH(QString, text);
QFETCH(bool, expectedStopHandling); QFETCH(bool, expectedStopHandling);
@@ -399,7 +397,7 @@ void CppEditorPlugin::test_autoBackspace()
QCOMPARE(stopHandling, expectedStopHandling); QCOMPARE(stopHandling, expectedStopHandling);
} }
void CppEditorPlugin::test_insertParagraph_data() void AutoCompleterTest::testInsertParagraph_data()
{ {
QTest::addColumn<QString>("text"); QTest::addColumn<QString>("text");
QTest::addColumn<int>("expectedBlockCount"); QTest::addColumn<int>("expectedBlockCount");
@@ -422,7 +420,7 @@ void CppEditorPlugin::test_insertParagraph_data()
<< 1; << 1;
} }
void CppEditorPlugin::test_insertParagraph() void AutoCompleterTest::testInsertParagraph()
{ {
QFETCH(QString, text); QFETCH(QString, text);
QFETCH(int, expectedBlockCount); QFETCH(int, expectedBlockCount);
@@ -444,4 +442,7 @@ void CppEditorPlugin::test_insertParagraph()
QCOMPARE(blockCount, expectedBlockCount); QCOMPARE(blockCount, expectedBlockCount);
} }
#endif } // namespace Tests
#endif // WITH_TESTS
} // namespace CppEditor::Internal

View File

@@ -27,6 +27,8 @@
#include <texteditor/autocompleter.h> #include <texteditor/autocompleter.h>
#include <QObject>
namespace CppEditor { namespace CppEditor {
namespace Internal { namespace Internal {
@@ -53,5 +55,24 @@ public:
QString insertParagraphSeparator(const QTextCursor &cursor) const override; QString insertParagraphSeparator(const QTextCursor &cursor) const override;
}; };
#ifdef WITH_TESTS
namespace Tests {
class AutoCompleterTest : public QObject
{
Q_OBJECT
private slots:
void testAutoComplete_data();
void testAutoComplete();
void testSurroundWithSelection_data();
void testSurroundWithSelection();
void testAutoBackspace_data();
void testAutoBackspace();
void testInsertParagraph_data();
void testInsertParagraph();
};
} // namespace Tests
#endif // WITH_TESTS
} // Internal } // Internal
} // CppEditor } // CppEditor

View File

@@ -75,7 +75,12 @@ equals(TEST, 1) {
HEADERS += \ HEADERS += \
cppeditortestcase.h \ cppeditortestcase.h \
cppdoxygen_test.h \ cppdoxygen_test.h \
cppquickfix_test.h cppincludehierarchy_test.h \
cppquickfix_test.h \
cppuseselections_test.h \
fileandtokenactions_test.h \
followsymbol_switchmethoddecldef_test.h
SOURCES += \ SOURCES += \
cppdoxygen_test.cpp \ cppdoxygen_test.cpp \
cppeditortestcase.cpp \ cppeditortestcase.cpp \

View File

@@ -95,11 +95,15 @@ QtcPlugin {
"cppeditortestcase.cpp", "cppeditortestcase.cpp",
"cppeditortestcase.h", "cppeditortestcase.h",
"cppincludehierarchy_test.cpp", "cppincludehierarchy_test.cpp",
"cppincludehierarchy_test.h",
"cppquickfix_test.cpp", "cppquickfix_test.cpp",
"cppquickfix_test.h", "cppquickfix_test.h",
"cppuseselections_test.cpp", "cppuseselections_test.cpp",
"cppuseselections_test.h",
"fileandtokenactions_test.cpp", "fileandtokenactions_test.cpp",
"fileandtokenactions_test.h",
"followsymbol_switchmethoddecldef_test.cpp", "followsymbol_switchmethoddecldef_test.cpp",
"followsymbol_switchmethoddecldef_test.h",
] ]
cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"']) cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])

View File

@@ -45,7 +45,13 @@
#include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/editormanager/ieditorfactory.h>
#ifdef WITH_TESTS #ifdef WITH_TESTS
# include "cppdoxygen_test.h" #include "cppdoxygen_test.h"
#include "cppincludehierarchy_test.h"
#include "cppinsertvirtualmethods.h"
#include "cppquickfix_test.h"
#include "cppuseselections_test.h"
#include "fileandtokenactions_test.h"
#include "followsymbol_switchmethoddecldef_test.h"
#endif #endif
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
@@ -392,12 +398,21 @@ void CppEditorPluginPrivate::inspectCppCodeModel()
} }
} }
#ifdef WITH_TESTS
QVector<QObject *> CppEditorPlugin::createTestObjects() const QVector<QObject *> CppEditorPlugin::createTestObjects() const
{ {
return {new Tests::DoxygenTest}; return {
} #ifdef WITH_TESTS
new FollowSymbolTest,
new Tests::AutoCompleterTest,
new Tests::DoxygenTest,
new Tests::FileAndTokenActionsTest,
new Tests::IncludeHierarchyTest,
new Tests::InsertVirtualMethodsTest,
new Tests::QuickfixTest,
new Tests::SelectionsTest,
#endif #endif
};
}
void CppEditorPlugin::openTypeHierarchy() void CppEditorPlugin::openTypeHierarchy()
{ {

View File

@@ -27,10 +27,6 @@
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#ifdef WITH_TESTS
namespace ProjectExplorer { class Kit; }
#endif
namespace CppEditor { namespace CppEditor {
namespace Internal { namespace Internal {
@@ -53,10 +49,6 @@ public:
CppQuickFixAssistProvider *quickFixProvider() const; CppQuickFixAssistProvider *quickFixProvider() const;
#ifdef WITH_TESTS
ProjectExplorer::Kit *m_testKit = nullptr;
#endif
signals: signals:
void outlineSortingChanged(bool sort); void outlineSortingChanged(bool sort);
void typeHierarchyRequested(); void typeHierarchyRequested();
@@ -70,236 +62,9 @@ public:
void renameSymbolUnderCursor(); void renameSymbolUnderCursor();
void switchDeclarationDefinition(); void switchDeclarationDefinition();
#ifdef WITH_TESTS
private: private:
QVector<QObject *> createTestObjects() const override; QVector<QObject *> createTestObjects() const override;
private slots:
void initTestCase();
// The following tests expect that no projects are loaded on start-up.
void test_SwitchMethodDeclarationDefinition_data();
void test_SwitchMethodDeclarationDefinition();
void test_FollowSymbolUnderCursor_multipleDocuments_data();
void test_FollowSymbolUnderCursor_multipleDocuments();
void test_FollowSymbolUnderCursor_data();
void test_FollowSymbolUnderCursor();
void test_FollowSymbolUnderCursor_QTCREATORBUG7903_data();
void test_FollowSymbolUnderCursor_QTCREATORBUG7903();
void test_FollowSymbolUnderCursor_followCall_data();
void test_FollowSymbolUnderCursor_followCall();
void test_FollowSymbolUnderCursor_QObject_connect_data();
void test_FollowSymbolUnderCursor_QObject_connect();
void test_FollowSymbolUnderCursor_QObject_oldStyleConnect();
void test_FollowSymbolUnderCursor_classOperator_onOperatorToken_data();
void test_FollowSymbolUnderCursor_classOperator_onOperatorToken();
void test_FollowSymbolUnderCursor_classOperator_data();
void test_FollowSymbolUnderCursor_classOperator();
void test_FollowSymbolUnderCursor_classOperator_inOp_data();
void test_FollowSymbolUnderCursor_classOperator_inOp();
void test_FollowSymbolUnderCursor_virtualFunctionCall_data();
void test_FollowSymbolUnderCursor_virtualFunctionCall();
void test_FollowSymbolUnderCursor_virtualFunctionCall_multipleDocuments();
void test_quickfix_data();
void test_quickfix();
void test_quickfix_GenerateGetterSetter_namespaceHandlingCreate_data();
void test_quickfix_GenerateGetterSetter_namespaceHandlingCreate();
void test_quickfix_GenerateGetterSetter_namespaceHandlingAddUsing_data();
void test_quickfix_GenerateGetterSetter_namespaceHandlingAddUsing();
void test_quickfix_GenerateGetterSetter_namespaceHandlingFullyQualify_data();
void test_quickfix_GenerateGetterSetter_namespaceHandlingFullyQualify();
void test_quickfix_GenerateGetterSetter_customNames_data();
void test_quickfix_GenerateGetterSetter_customNames();
void test_quickfix_GenerateGetterSetter_valueTypes_data();
void test_quickfix_GenerateGetterSetter_valueTypes();
void test_quickfix_GenerateGetterSetter_customTemplate();
void test_quickfix_GenerateGetterSetter_needThis();
void test_quickfix_GenerateGetterSetter_offeredFixes_data();
void test_quickfix_GenerateGetterSetter_offeredFixes();
void test_quickfix_GenerateGetterSetter_generalTests_data();
void test_quickfix_GenerateGetterSetter_generalTests();
void test_quickfix_GenerateGetterSetter_onlyGetter();
void test_quickfix_GenerateGetterSetter_onlySetter();
void test_quickfix_GenerateGetterSetter_inlineInHeaderFile();
void test_quickfix_GenerateGetterSetter_onlySetterHeaderFileWithIncludeGuard();
void test_quickfix_GenerateGettersSetters_data();
void test_quickfix_GenerateGettersSetters();
void test_quickfix_InsertQtPropertyMembers_data();
void test_quickfix_InsertQtPropertyMembers();
void test_quickfix_InsertMemberFromInitialization_data();
void test_quickfix_InsertMemberFromInitialization();
void test_quickfix_ConvertQt4Connect_connectOutOfClass();
void test_quickfix_ConvertQt4Connect_connectWithinClass_data();
void test_quickfix_ConvertQt4Connect_connectWithinClass();
void test_quickfix_ConvertQt4Connect_differentNamespace();
void test_quickfix_InsertDefFromDecl_afterClass();
void test_quickfix_InsertDefFromDecl_headerSource_basic1();
void test_quickfix_InsertDefFromDecl_headerSource_basic2();
void test_quickfix_InsertDefFromDecl_headerSource_basic3();
void test_quickfix_InsertDefFromDecl_headerSource_namespace1();
void test_quickfix_InsertDefFromDecl_headerSource_namespace2();
void test_quickfix_InsertDefFromDecl_insideClass();
void test_quickfix_InsertDefFromDecl_notTriggeringWhenDefinitionExists();
void test_quickfix_InsertDefFromDecl_findRightImplementationFile();
void test_quickfix_InsertDefFromDecl_ignoreSurroundingGeneratedDeclarations();
void test_quickfix_InsertDefFromDecl_respectWsInOperatorNames1();
void test_quickfix_InsertDefFromDecl_respectWsInOperatorNames2();
void test_quickfix_InsertDefFromDecl_noexcept_specifier();
void test_quickfix_InsertDefFromDecl_macroUsesAtEndOfFile1();
void test_quickfix_InsertDefFromDecl_macroUsesAtEndOfFile2();
void test_quickfix_InsertDefFromDecl_erroneousStatementAtEndOfFile();
void test_quickfix_InsertDefFromDecl_rvalueReference();
void test_quickfix_InsertDefFromDecl_functionTryBlock();
void test_quickfix_InsertDefFromDecl_usingDecl();
void test_quickfix_InsertDefFromDecl_findImplementationFile();
void test_quickfix_InsertDefFromDecl_unicodeIdentifier();
void test_quickfix_InsertDefFromDecl_templateClass();
void test_quickfix_InsertDefFromDecl_templateClassWithValueParam();
void test_quickfix_InsertDefFromDecl_templateFunction();
void test_quickfix_InsertDefFromDecl_notTriggeredForFriendFunc();
void test_quickfix_InsertDefFromDecl_minimalFunctionParameterType();
void test_quickfix_InsertDefsFromDecls_data();
void test_quickfix_InsertDefsFromDecls();
void test_quickfix_InsertDeclFromDef();
void test_quickfix_InsertDeclFromDef_templateFuncTypename();
void test_quickfix_InsertDeclFromDef_templateFuncInt();
void test_quickfix_InsertDeclFromDef_notTriggeredForTemplateFunc();
void test_quickfix_AddIncludeForUndefinedIdentifier_data();
void test_quickfix_AddIncludeForUndefinedIdentifier();
void test_quickfix_AddIncludeForUndefinedIdentifier_noDoubleQtHeaderInclude();
void test_quickfix_AddForwardDeclForUndefinedIdentifier_data();
void test_quickfix_AddForwardDeclForUndefinedIdentifier();
void test_quickfix_MoveFuncDefOutside_MemberFuncToCpp();
void test_quickfix_MoveFuncDefOutside_MemberFuncToCppInsideNS();
void test_quickfix_MoveFuncDefOutside_MemberFuncOutside1();
void test_quickfix_MoveFuncDefOutside_MemberFuncOutside2();
void test_quickfix_MoveFuncDefOutside_MemberFuncToCppNS();
void test_quickfix_MoveFuncDefOutside_MemberFuncToCppNSUsing();
void test_quickfix_MoveFuncDefOutside_MemberFuncOutsideWithNs();
void test_quickfix_MoveFuncDefOutside_FreeFuncToCpp();
void test_quickfix_MoveFuncDefOutside_FreeFuncToCppNS();
void test_quickfix_MoveFuncDefOutside_CtorWithInitialization1();
void test_quickfix_MoveFuncDefOutside_CtorWithInitialization2();
void test_quickfix_MoveFuncDefOutside_afterClass();
void test_quickfix_MoveFuncDefOutside_respectWsInOperatorNames1();
void test_quickfix_MoveFuncDefOutside_respectWsInOperatorNames2();
void test_quickfix_MoveFuncDefOutside_macroUses();
void test_quickfix_MoveFuncDefOutside_template();
void test_quickfix_MoveFuncDefOutside_template_specializedClass();
void test_quickfix_MoveFuncDefOutside_unnamedTemplate();
void test_quickfix_MoveFuncDefOutside_MemberFuncToCpp_Static();
void test_quickfix_MoveFuncDefOutside_MemberFuncToCpp_WithInlinePartOfName();
void test_quickfix_MoveAllFuncDefOutside_MemberFuncToCpp();
void test_quickfix_MoveAllFuncDefOutside_MemberFuncOutside();
void test_quickfix_MoveAllFuncDefOutside_DoNotTriggerOnBaseClass();
void test_quickfix_MoveAllFuncDefOutside_classWithBaseClass();
void test_quickfix_MoveAllFuncDefOutside_ignoreMacroCode();
void test_quickfix_MoveFuncDefToDecl_MemberFunc();
void test_quickfix_MoveFuncDefToDecl_MemberFuncOutside();
void test_quickfix_MoveFuncDefToDecl_MemberFuncToCppNS();
void test_quickfix_MoveFuncDefToDecl_MemberFuncToCppNSUsing();
void test_quickfix_MoveFuncDefToDecl_MemberFuncOutsideWithNs();
void test_quickfix_MoveFuncDefToDecl_FreeFuncToCpp();
void test_quickfix_MoveFuncDefToDecl_FreeFuncToCppNS();
void test_quickfix_MoveFuncDefToDecl_CtorWithInitialization();
void test_quickfix_MoveFuncDefToDecl_structWithAssignedVariable();
void test_quickfix_MoveFuncDefToDecl_macroUses();
void test_quickfix_MoveFuncDefToDecl_override();
void test_quickfix_MoveFuncDefToDecl_template();
void test_quickfix_MoveFuncDefToDecl_templateFunction();
void test_quickfix_AssignToLocalVariable_templates();
void test_quickfix_ExtractFunction_data();
void test_quickfix_ExtractFunction();
void test_quickfix_ExtractLiteralAsParameter_typeDeduction_data();
void test_quickfix_ExtractLiteralAsParameter_typeDeduction();
void test_quickfix_ExtractLiteralAsParameter_freeFunction_separateFiles();
void test_quickfix_ExtractLiteralAsParameter_memberFunction_separateFiles();
void test_quickfix_ExtractLiteralAsParameter_notTriggeringForInvalidCode();
void test_quickfix_addCurlyBraces();
void test_quickfix_removeUsingNamespace_data();
void test_quickfix_removeUsingNamespace();
void test_quickfix_removeUsingNamespace_simple_data();
void test_quickfix_removeUsingNamespace_simple();
void test_quickfix_removeUsingNamespace_differentSymbols();
void test_quickfix_generateConstructor_data();
void test_quickfix_generateConstructor();
void test_quickfix_InsertVirtualMethods_data();
void test_quickfix_InsertVirtualMethods();
void test_quickfix_InsertVirtualMethods_implementationFile();
void test_quickfix_InsertVirtualMethods_BaseClassInNamespace();
void test_useSelections_data();
void test_useSelections();
void test_selectionFiltering_data();
void test_selectionFiltering();
// tests for "Include Hierarchy"
void test_includehierarchy_data();
void test_includehierarchy();
// The following tests operate on a project and require special invocation:
//
// Ensure that the project is properly configured for a given settings path:
// $ ./qtcreator -settingspath /your/settings/path /path/to/project
//
// ...and that it builds, which might prevent blocking dialogs for not
// existing files (e.g. ui_*.h).
//
// Run a test:
// $ export QTC_TEST_WAIT_FOR_LOADED_PROJECT=1
// $ ./qtcreator -settingspath /your/settings/path -test CppEditor,test_openEachFile /path/to/project
void test_openEachFile();
void test_switchHeaderSourceOnEachFile();
void test_moveTokenWiseThroughEveryFile();
void test_moveTokenWiseThroughEveryFileAndFollowSymbol();
void test_moveTokenWiseThroughEveryFileAndSwitchDeclarationDefinition();
void test_moveTokenWiseThroughEveryFileAndFindUsages();
void test_moveTokenWiseThroughEveryFileAndRenameUsages();
void test_moveTokenWiseThroughEveryFileAndOpenTypeHierarchy();
void test_moveTokenWiseThroughEveryFileAndInvokeCompletion();
void test_moveTokenWiseThroughEveryFileAndTriggerQuickFixes();
// CppAutoCompleter tests
void test_autoComplete_data();
void test_autoComplete();
void test_surroundWithSelection_data();
void test_surroundWithSelection();
void test_autoBackspace_data();
void test_autoBackspace();
void test_insertParagraph_data();
void test_insertParagraph();
#endif // WITH_TESTS
private:
CppEditorPluginPrivate *d = nullptr; CppEditorPluginPrivate *d = nullptr;
}; };

View File

@@ -78,22 +78,10 @@ bool TestDocument::hasCursorMarker() const { return m_cursorPosition != -1; }
bool TestDocument::hasAnchorMarker() const { return m_anchorPosition != -1; } bool TestDocument::hasAnchorMarker() const { return m_anchorPosition != -1; }
TestCase::TestCase(bool runGarbageCollector) TestCase::TestCase(bool runGarbageCollector)
: CppTools::Tests::TestCase(runGarbageCollector), : CppTools::Tests::TestCase(runGarbageCollector)
m_prevUseClangd(CppTools::ClangdSettings::instance().useClangd())
{ {
} }
TestCase::~TestCase()
{
CppTools::ClangdSettings::setUseClangd(m_prevUseClangd);
}
void TestCase::setUseClangd()
{
if (CppEditorPlugin::instance()->m_testKit)
CppTools::ClangdSettings::setUseClangd(true);
}
bool TestCase::openCppEditor(const QString &fileName, CppEditor **editor, CppEditorWidget **editorWidget) bool TestCase::openCppEditor(const QString &fileName, CppEditor **editor, CppEditorWidget **editorWidget)
{ {
if (CppEditor *e = dynamic_cast<CppEditor *>(Core::EditorManager::openEditor(fileName))) { if (CppEditor *e = dynamic_cast<CppEditor *>(Core::EditorManager::openEditor(fileName))) {

View File

@@ -60,9 +60,6 @@ class TestCase : public CppTools::Tests::TestCase
{ {
public: public:
TestCase(bool runGarbageCollector = true); TestCase(bool runGarbageCollector = true);
~TestCase();
void setUseClangd();
static bool openCppEditor(const QString &fileName, static bool openCppEditor(const QString &fileName,
CppEditor **editor, CppEditor **editor,
@@ -70,9 +67,6 @@ public:
static CPlusPlus::Document::Ptr waitForRehighlightedSemanticDocument( static CPlusPlus::Document::Ptr waitForRehighlightedSemanticDocument(
CppEditorWidget *editorWidget); CppEditorWidget *editorWidget);
private:
const bool m_prevUseClangd;
}; };
} // namespace Tests } // namespace Tests

View File

@@ -23,9 +23,10 @@
** **
****************************************************************************/ ****************************************************************************/
#include "cppincludehierarchy_test.h"
#include "cppeditor.h" #include "cppeditor.h"
#include "cppeditorwidget.h" #include "cppeditorwidget.h"
#include "cppeditorplugin.h"
#include "cppeditortestcase.h" #include "cppeditortestcase.h"
#include "cppincludehierarchy.h" #include "cppincludehierarchy.h"
@@ -40,8 +41,7 @@
using namespace CPlusPlus; using namespace CPlusPlus;
using namespace CppTools; using namespace CppTools;
namespace CppEditor { namespace CppEditor::Internal::Tests {
namespace Internal {
namespace { namespace {
@@ -111,7 +111,7 @@ public:
} // anonymous namespace } // anonymous namespace
void CppEditorPlugin::test_includehierarchy_data() void IncludeHierarchyTest::test_data()
{ {
QTest::addColumn<QList<QByteArray> >("documents"); QTest::addColumn<QList<QByteArray> >("documents");
QTest::addColumn<QString>("expectedHierarchy"); QTest::addColumn<QString>("expectedHierarchy");
@@ -177,7 +177,7 @@ void CppEditorPlugin::test_includehierarchy_data()
); );
} }
void CppEditorPlugin::test_includehierarchy() void IncludeHierarchyTest::test()
{ {
QFETCH(QList<QByteArray>, documents); QFETCH(QList<QByteArray>, documents);
QFETCH(QString, expectedHierarchy); QFETCH(QString, expectedHierarchy);
@@ -185,5 +185,4 @@ void CppEditorPlugin::test_includehierarchy()
IncludeHierarchyTestCase(documents, expectedHierarchy); IncludeHierarchyTestCase(documents, expectedHierarchy);
} }
} // namespace CppEditor } // namespace CppEditor::Internal::Tests
} // namespace Internal

View File

@@ -0,0 +1,41 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QObject>
namespace CppEditor::Internal::Tests {
class IncludeHierarchyTest : public QObject
{
Q_OBJECT
private slots:
void test_data();
void test();
};
} // namespace CppEditor::Internal::Tests

View File

@@ -1299,15 +1299,7 @@ public:
void saveSettings() { } void saveSettings() { }
}; };
} // namespace Tests void InsertVirtualMethodsTest::test_data()
InsertVirtualMethods *InsertVirtualMethods::createTestFactory()
{
return new InsertVirtualMethods(new Tests::InsertVirtualMethodsDialogTest(
InsertVirtualMethodsDialog::ModeOutsideClass, true, false));
}
void CppEditorPlugin::test_quickfix_InsertVirtualMethods_data()
{ {
QTest::addColumn<InsertVirtualMethodsDialog::ImplementationMode>("implementationMode"); QTest::addColumn<InsertVirtualMethodsDialog::ImplementationMode>("implementationMode");
QTest::addColumn<bool>("insertVirtualKeyword"); QTest::addColumn<bool>("insertVirtualKeyword");
@@ -1882,7 +1874,7 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_data()
"};\n"); "};\n");
} }
void CppEditorPlugin::test_quickfix_InsertVirtualMethods() void InsertVirtualMethodsTest::test()
{ {
QFETCH(InsertVirtualMethodsDialog::ImplementationMode, implementationMode); QFETCH(InsertVirtualMethodsDialog::ImplementationMode, implementationMode);
QFETCH(bool, insertVirtualKeyword); QFETCH(bool, insertVirtualKeyword);
@@ -1898,7 +1890,7 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods()
} }
/// Check: Insert in implementation file /// Check: Insert in implementation file
void CppEditorPlugin::test_quickfix_InsertVirtualMethods_implementationFile() void InsertVirtualMethodsTest::testImplementationFile()
{ {
QList<Tests::QuickFixTestDocument::Ptr> testFiles; QList<Tests::QuickFixTestDocument::Ptr> testFiles;
QByteArray original; QByteArray original;
@@ -1946,7 +1938,7 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_implementationFile()
} }
/// Check: Qualified names. /// Check: Qualified names.
void CppEditorPlugin::test_quickfix_InsertVirtualMethods_BaseClassInNamespace() void InsertVirtualMethodsTest::testBaseClassInNamespace()
{ {
QList<Tests::QuickFixTestDocument::Ptr> testFiles; QList<Tests::QuickFixTestDocument::Ptr> testFiles;
QByteArray original; QByteArray original;
@@ -1998,6 +1990,15 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_BaseClassInNamespace()
false)); false));
Tests::QuickFixOperationTest(testFiles, &factory); Tests::QuickFixOperationTest(testFiles, &factory);
} }
} // namespace Tests
InsertVirtualMethods *InsertVirtualMethods::createTestFactory()
{
return new InsertVirtualMethods(new Tests::InsertVirtualMethodsDialogTest(
InsertVirtualMethodsDialog::ModeOutsideClass, true, false));
}
#endif // WITH_TESTS #endif // WITH_TESTS
} // namespace Internal } // namespace Internal

View File

@@ -47,5 +47,20 @@ private:
InsertVirtualMethodsDialog *m_dialog; InsertVirtualMethodsDialog *m_dialog;
}; };
#ifdef WITH_TESTS
namespace Tests {
class InsertVirtualMethodsTest : public QObject
{
Q_OBJECT
private slots:
void test_data();
void test();
void testImplementationFile();
void testBaseClassInNamespace();
};
} // namespace Tests
#endif // WITH_TESTS
} // namespace Internal } // namespace Internal
} // namespace CppEditor } // namespace CppEditor

File diff suppressed because it is too large Load Diff

View File

@@ -30,11 +30,10 @@
#include <QByteArray> #include <QByteArray>
#include <QList> #include <QList>
#include <QObject>
#include <QSharedPointer> #include <QSharedPointer>
#include <QStringList> #include <QStringList>
typedef QByteArray _;
namespace CppTools { class CppCodeStylePreferences; } namespace CppTools { class CppCodeStylePreferences; }
namespace TextEditor { class QuickFixOperation; } namespace TextEditor { class QuickFixOperation; }
@@ -69,8 +68,6 @@ public:
QString m_expectedSource; QString m_expectedSource;
}; };
typedef QList<QuickFixTestDocument::Ptr> QuickFixTestDocuments;
class BaseQuickFixTestCase : public TestCase class BaseQuickFixTestCase : public TestCase
{ {
public: public:
@@ -113,22 +110,156 @@ public:
int operationIndex = 0); int operationIndex = 0);
}; };
/// Tests the offered operations provided by a given CppQuickFixFactory
class QuickFixOfferedOperationsTest : public BaseQuickFixTestCase
{
public:
QuickFixOfferedOperationsTest(const QList<QuickFixTestDocument::Ptr> &testDocuments,
CppQuickFixFactory *factory,
const ProjectExplorer::HeaderPaths &headerPaths
= ProjectExplorer::HeaderPaths(),
const QStringList &expectedOperations = QStringList());
};
QList<QuickFixTestDocument::Ptr> singleDocument(const QByteArray &original, QList<QuickFixTestDocument::Ptr> singleDocument(const QByteArray &original,
const QByteArray &expected); const QByteArray &expected);
class QuickfixTest : public QObject
{
Q_OBJECT
private slots:
void testGeneric_data();
void testGeneric();
void testGenerateGetterSetterNamespaceHandlingCreate_data();
void testGenerateGetterSetterNamespaceHandlingCreate();
void testGenerateGetterSetterNamespaceHandlingAddUsing_data();
void testGenerateGetterSetterNamespaceHandlingAddUsing();
void testGenerateGetterSetterNamespaceHandlingFullyQualify_data();
void testGenerateGetterSetterNamespaceHandlingFullyQualify();
void testGenerateGetterSetterCustomNames_data();
void testGenerateGetterSetterCustomNames();
void testGenerateGetterSetterValueTypes_data();
void testGenerateGetterSetterValueTypes();
void testGenerateGetterSetterCustomTemplate();
void testGenerateGetterSetterNeedThis();
void testGenerateGetterSetterOfferedFixes_data();
void testGenerateGetterSetterOfferedFixes();
void testGenerateGetterSetterGeneralTests_data();
void testGenerateGetterSetterGeneralTests();
void testGenerateGetterSetterOnlyGetter();
void testGenerateGetterSetterOnlySetter();
void testGenerateGetterSetterInlineInHeaderFile();
void testGenerateGetterSetterOnlySetterHeaderFileWithIncludeGuard();
void testGenerateGettersSetters_data();
void testGenerateGettersSetters();
void testInsertQtPropertyMembers_data();
void testInsertQtPropertyMembers();
void testInsertMemberFromInitialization_data();
void testInsertMemberFromInitialization();
void testConvertQt4ConnectConnectOutOfClass();
void testConvertQt4ConnectConnectWithinClass_data();
void testConvertQt4ConnectConnectWithinClass();
void testConvertQt4ConnectDifferentNamespace();
void testInsertDefFromDeclAfterClass();
void testInsertDefFromDeclHeaderSourceBasic1();
void testInsertDefFromDeclHeaderSourceBasic2();
void testInsertDefFromDeclHeaderSourceBasic3();
void testInsertDefFromDeclHeaderSourceNamespace1();
void testInsertDefFromDeclHeaderSourceNamespace2();
void testInsertDefFromDeclInsideClass();
void testInsertDefFromDeclNotTriggeringWhenDefinitionExists();
void testInsertDefFromDeclFindRightImplementationFile();
void testInsertDefFromDeclIgnoreSurroundingGeneratedDeclarations();
void testInsertDefFromDeclRespectWsInOperatorNames1();
void testInsertDefFromDeclRespectWsInOperatorNames2();
void testInsertDefFromDeclNoexceptSpecifier();
void testInsertDefFromDeclMacroUsesAtEndOfFile1();
void testInsertDefFromDeclMacroUsesAtEndOfFile2();
void testInsertDefFromDeclErroneousStatementAtEndOfFile();
void testInsertDefFromDeclRvalueReference();
void testInsertDefFromDeclFunctionTryBlock();
void testInsertDefFromDeclUsingDecl();
void testInsertDefFromDeclFindImplementationFile();
void testInsertDefFromDeclUnicodeIdentifier();
void testInsertDefFromDeclTemplateClass();
void testInsertDefFromDeclTemplateClassWithValueParam();
void testInsertDefFromDeclTemplateFunction();
void testInsertDefFromDeclNotTriggeredForFriendFunc();
void testInsertDefFromDeclMinimalFunctionParameterType();
void testInsertDefsFromDecls_data();
void testInsertDefsFromDecls();
void testInsertDeclFromDef();
void testInsertDeclFromDefTemplateFuncTypename();
void testInsertDeclFromDefTemplateFuncInt();
void testInsertDeclFromDefNotTriggeredForTemplateFunc();
void testAddIncludeForUndefinedIdentifier_data();
void testAddIncludeForUndefinedIdentifier();
void testAddIncludeForUndefinedIdentifierNoDoubleQtHeaderInclude();
void testAddForwardDeclForUndefinedIdentifier_data();
void testAddForwardDeclForUndefinedIdentifier();
void testMoveFuncDefOutsideMemberFuncToCpp();
void testMoveFuncDefOutsideMemberFuncToCppInsideNS();
void testMoveFuncDefOutsideMemberFuncOutside1();
void testMoveFuncDefOutsideMemberFuncOutside2();
void testMoveFuncDefOutsideMemberFuncToCppNS();
void testMoveFuncDefOutsideMemberFuncToCppNSUsing();
void testMoveFuncDefOutsideMemberFuncOutsideWithNs();
void testMoveFuncDefOutsideFreeFuncToCpp();
void testMoveFuncDefOutsideFreeFuncToCppNS();
void testMoveFuncDefOutsideCtorWithInitialization1();
void testMoveFuncDefOutsideCtorWithInitialization2();
void testMoveFuncDefOutsideAfterClass();
void testMoveFuncDefOutsideRespectWsInOperatorNames1();
void testMoveFuncDefOutsideRespectWsInOperatorNames2();
void testMoveFuncDefOutsideMacroUses();
void testMoveFuncDefOutsideTemplate();
void testMoveFuncDefOutsideTemplateSpecializedClass();
void testMoveFuncDefOutsideUnnamedTemplate();
void testMoveFuncDefOutsideMemberFuncToCppStatic();
void testMoveFuncDefOutsideMemberFuncToCppWithInlinePartOfName();
void testMoveAllFuncDefOutsideMemberFuncToCpp();
void testMoveAllFuncDefOutsideMemberFuncOutside();
void testMoveAllFuncDefOutsideDoNotTriggerOnBaseClass();
void testMoveAllFuncDefOutsideClassWithBaseClass();
void testMoveAllFuncDefOutsideIgnoreMacroCode();
void testMoveFuncDefToDeclMemberFunc();
void testMoveFuncDefToDeclMemberFuncOutside();
void testMoveFuncDefToDeclMemberFuncToCppNS();
void testMoveFuncDefToDeclMemberFuncToCppNSUsing();
void testMoveFuncDefToDeclMemberFuncOutsideWithNs();
void testMoveFuncDefToDeclFreeFuncToCpp();
void testMoveFuncDefToDeclFreeFuncToCppNS();
void testMoveFuncDefToDeclCtorWithInitialization();
void testMoveFuncDefToDeclStructWithAssignedVariable();
void testMoveFuncDefToDeclMacroUses();
void testMoveFuncDefToDeclOverride();
void testMoveFuncDefToDeclTemplate();
void testMoveFuncDefToDeclTemplateFunction();
void testAssignToLocalVariableTemplates();
void testExtractFunction_data();
void testExtractFunction();
void testExtractLiteralAsParameterTypeDeduction_data();
void testExtractLiteralAsParameterTypeDeduction();
void testExtractLiteralAsParameterFreeFunctionSeparateFiles();
void testExtractLiteralAsParameterMemberFunctionSeparateFiles();
void testExtractLiteralAsParameterNotTriggeringForInvalidCode();
void testAddCurlyBraces();
void testRemoveUsingNamespace_data();
void testRemoveUsingNamespace();
void testRemoveUsingNamespaceSimple_data();
void testRemoveUsingNamespaceSimple();
void testRemoveUsingNamespaceDifferentSymbols();
void testGenerateConstructor_data();
void testGenerateConstructor();
};
} // namespace Tests } // namespace Tests
} // namespace Internal } // namespace Internal
} // namespace CppEditor } // namespace CppEditor
Q_DECLARE_METATYPE(CppEditor::Internal::Tests::QuickFixTestDocuments)

View File

@@ -23,9 +23,10 @@
** **
****************************************************************************/ ****************************************************************************/
#include "cppuseselections_test.h"
#include "cppeditor.h" #include "cppeditor.h"
#include "cppeditorwidget.h" #include "cppeditorwidget.h"
#include "cppeditorplugin.h"
#include "cppeditortestcase.h" #include "cppeditortestcase.h"
#include <cpptools/cppmodelmanager.h> #include <cpptools/cppmodelmanager.h>
@@ -157,9 +158,7 @@ SelectionList UseSelectionsTestCase::waitForUseSelections(bool *hasTimedOut) con
return toSelectionList(extraSelections); return toSelectionList(extraSelections);
} }
} // namespace Tests void SelectionsTest::testUseSelections_data()
void CppEditorPlugin::test_useSelections_data()
{ {
QTest::addColumn<QByteArray>("source"); QTest::addColumn<QByteArray>("source");
QTest::addColumn<SelectionList>("expectedSelections"); QTest::addColumn<SelectionList>("expectedSelections");
@@ -249,7 +248,7 @@ void CppEditorPlugin::test_useSelections_data()
<< macroUseSelections; << macroUseSelections;
} }
void CppEditorPlugin::test_useSelections() void SelectionsTest::testUseSelections()
{ {
QFETCH(QByteArray, source); QFETCH(QByteArray, source);
QFETCH(SelectionList, expectedSelections); QFETCH(SelectionList, expectedSelections);
@@ -258,7 +257,7 @@ void CppEditorPlugin::test_useSelections()
Tests::UseSelectionsTestCase(testDocument, expectedSelections); Tests::UseSelectionsTestCase(testDocument, expectedSelections);
} }
void CppEditorPlugin::test_selectionFiltering_data() void SelectionsTest::testSelectionFiltering_data()
{ {
QTest::addColumn<QString>("source"); QTest::addColumn<QString>("source");
QTest::addColumn<SelectionList>("original"); QTest::addColumn<SelectionList>("original");
@@ -284,7 +283,7 @@ void CppEditorPlugin::test_selectionFiltering_data()
<< SelectionList{{3, 4, 27}, {4, 8, 11}, {5, 4, 1}}; << SelectionList{{3, 4, 27}, {4, 8, 11}, {5, 4, 1}};
} }
void CppEditorPlugin::test_selectionFiltering() void SelectionsTest::testSelectionFiltering()
{ {
QFETCH(QString, source); QFETCH(QString, source);
QFETCH(SelectionList, original); QFETCH(SelectionList, original);
@@ -323,5 +322,6 @@ void CppEditorPlugin::test_selectionFiltering()
} }
} }
} // namespace Tests
} // namespace Internal } // namespace Internal
} // namespace CppEditor } // namespace CppEditor

View File

@@ -0,0 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QObject>
namespace CppEditor::Internal::Tests {
class SelectionsTest : public QObject
{
Q_OBJECT
private slots:
void testUseSelections_data();
void testUseSelections();
void testSelectionFiltering_data();
void testSelectionFiltering();
};
} // namespace CppEditor::Internal::Tests

View File

@@ -23,10 +23,12 @@
** **
****************************************************************************/ ****************************************************************************/
#include "fileandtokenactions_test.h"
#include "cppeditor.h" #include "cppeditor.h"
#include "cppeditorwidget.h"
#include "cppeditorplugin.h" #include "cppeditorplugin.h"
#include "cppeditortestcase.h" #include "cppeditortestcase.h"
#include "cppeditorwidget.h"
#include "cppquickfix.h" #include "cppquickfix.h"
#include "cppquickfixassistant.h" #include "cppquickfixassistant.h"
#include "cppquickfixes.h" #include "cppquickfixes.h"
@@ -72,8 +74,7 @@ using namespace CPlusPlus;
using namespace CppTools; using namespace CppTools;
using namespace TextEditor; using namespace TextEditor;
namespace CppEditor { namespace CppEditor::Internal::Tests {
namespace Internal {
namespace { namespace {
@@ -493,56 +494,55 @@ void SwitchHeaderSourceFileAction::run(CppEditorWidget *)
} // anonymous namespace } // anonymous namespace
void CppEditorPlugin::test_openEachFile() void FileAndTokenActionsTest::testOpenEachFile()
{ {
TestActionsTestCase(); TestActionsTestCase();
} }
void CppEditorPlugin::test_switchHeaderSourceOnEachFile() void FileAndTokenActionsTest::testSwitchHeaderSourceOnEachFile()
{ {
TestActionsTestCase(Actions(), singleAction(ActionPointer(new SwitchHeaderSourceFileAction))); TestActionsTestCase(Actions(), singleAction(ActionPointer(new SwitchHeaderSourceFileAction)));
} }
void CppEditorPlugin::test_moveTokenWiseThroughEveryFile() void FileAndTokenActionsTest::testMoveTokenWiseThroughEveryFile()
{ {
TestActionsTestCase(singleAction(ActionPointer(new NoOpTokenAction))); TestActionsTestCase(singleAction(ActionPointer(new NoOpTokenAction)));
} }
/// May block if file does not exist (e.g. a not generated ui_* file). /// May block if file does not exist (e.g. a not generated ui_* file).
void CppEditorPlugin::test_moveTokenWiseThroughEveryFileAndFollowSymbol() void FileAndTokenActionsTest::testMoveTokenWiseThroughEveryFileAndFollowSymbol()
{ {
TestActionsTestCase(singleAction(ActionPointer(new FollowSymbolUnderCursorTokenAction))); TestActionsTestCase(singleAction(ActionPointer(new FollowSymbolUnderCursorTokenAction)));
} }
void CppEditorPlugin::test_moveTokenWiseThroughEveryFileAndSwitchDeclarationDefinition() void FileAndTokenActionsTest::testMoveTokenWiseThroughEveryFileAndSwitchDeclarationDefinition()
{ {
TestActionsTestCase(singleAction(ActionPointer(new SwitchDeclarationDefinitionTokenAction))); TestActionsTestCase(singleAction(ActionPointer(new SwitchDeclarationDefinitionTokenAction)));
} }
void CppEditorPlugin::test_moveTokenWiseThroughEveryFileAndFindUsages() void FileAndTokenActionsTest::testMoveTokenWiseThroughEveryFileAndFindUsages()
{ {
TestActionsTestCase(singleAction(ActionPointer(new FindUsagesTokenAction))); TestActionsTestCase(singleAction(ActionPointer(new FindUsagesTokenAction)));
} }
void CppEditorPlugin::test_moveTokenWiseThroughEveryFileAndRenameUsages() void FileAndTokenActionsTest::testMoveTokenWiseThroughEveryFileAndRenameUsages()
{ {
TestActionsTestCase(singleAction(ActionPointer(new RenameSymbolUnderCursorTokenAction))); TestActionsTestCase(singleAction(ActionPointer(new RenameSymbolUnderCursorTokenAction)));
} }
void CppEditorPlugin::test_moveTokenWiseThroughEveryFileAndOpenTypeHierarchy() void FileAndTokenActionsTest::testMoveTokenWiseThroughEveryFileAndOpenTypeHierarchy()
{ {
TestActionsTestCase(singleAction(ActionPointer(new OpenTypeHierarchyTokenAction))); TestActionsTestCase(singleAction(ActionPointer(new OpenTypeHierarchyTokenAction)));
} }
void CppEditorPlugin::test_moveTokenWiseThroughEveryFileAndInvokeCompletion() void FileAndTokenActionsTest::testMoveTokenWiseThroughEveryFileAndInvokeCompletion()
{ {
TestActionsTestCase(singleAction(ActionPointer(new InvokeCompletionTokenAction))); TestActionsTestCase(singleAction(ActionPointer(new InvokeCompletionTokenAction)));
} }
void CppEditorPlugin::test_moveTokenWiseThroughEveryFileAndTriggerQuickFixes() void FileAndTokenActionsTest::testMoveTokenWiseThroughEveryFileAndTriggerQuickFixes()
{ {
TestActionsTestCase(singleAction(ActionPointer(new RunAllQuickFixesTokenAction))); TestActionsTestCase(singleAction(ActionPointer(new RunAllQuickFixesTokenAction)));
} }
} // namespace Internal } // namespace CppEditor::Internal::Tests
} // namespace CppEditor

View File

@@ -0,0 +1,60 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QObject>
namespace CppEditor::Internal::Tests {
// These tests operate on a project and require special invocation:
//
// Ensure that the project is properly configured for a given settings path:
// $ ./qtcreator -settingspath /your/settings/path /path/to/project
//
// ...and that it builds, which might prevent blocking dialogs for not
// existing files (e.g. ui_*.h).
//
// Run the tests:
// $ export QTC_TEST_WAIT_FOR_LOADED_PROJECT=1
// $ ./qtcreator -settingspath /your/settings/path -test CppEditor,FileAndTokenActionsTest /path/to/project
class FileAndTokenActionsTest : public QObject
{
Q_OBJECT
private slots:
void testOpenEachFile();
void testSwitchHeaderSourceOnEachFile();
void testMoveTokenWiseThroughEveryFile();
void testMoveTokenWiseThroughEveryFileAndFollowSymbol();
void testMoveTokenWiseThroughEveryFileAndSwitchDeclarationDefinition();
void testMoveTokenWiseThroughEveryFileAndFindUsages();
void testMoveTokenWiseThroughEveryFileAndRenameUsages();
void testMoveTokenWiseThroughEveryFileAndOpenTypeHierarchy();
void testMoveTokenWiseThroughEveryFileAndInvokeCompletion();
void testMoveTokenWiseThroughEveryFileAndTriggerQuickFixes();
};
} // namespace CppEditor::Internal::Tests

View File

@@ -23,10 +23,12 @@
** **
****************************************************************************/ ****************************************************************************/
#include "followsymbol_switchmethoddecldef_test.h"
#include "cppeditor.h" #include "cppeditor.h"
#include "cppeditorwidget.h"
#include "cppeditorplugin.h" #include "cppeditorplugin.h"
#include "cppeditortestcase.h" #include "cppeditortestcase.h"
#include "cppeditorwidget.h"
#include <cpptools/cppcodemodelsettings.h> #include <cpptools/cppcodemodelsettings.h>
#include <cpptools/cppelementevaluator.h> #include <cpptools/cppelementevaluator.h>
@@ -258,11 +260,21 @@ public:
const QList<TestDocumentPtr> &testFiles, const QList<TestDocumentPtr> &testFiles,
OverrideItemList expectedVirtualFunctionProposal = OverrideItemList()); OverrideItemList expectedVirtualFunctionProposal = OverrideItemList());
~F2TestCase()
{
CppTools::ClangdSettings::setUseClangd(m_prevUseClangd);
}
static ProjectExplorer::Kit *m_testKit;
private: private:
static TestDocumentPtr testFileWithInitialCursorMarker(const QList<TestDocumentPtr> &testFiles); static TestDocumentPtr testFileWithInitialCursorMarker(const QList<TestDocumentPtr> &testFiles);
static TestDocumentPtr testFileWithTargetCursorMarker(const QList<TestDocumentPtr> &testFiles); static TestDocumentPtr testFileWithTargetCursorMarker(const QList<TestDocumentPtr> &testFiles);
const bool m_prevUseClangd;
}; };
ProjectExplorer::Kit *F2TestCase::m_testKit = nullptr;
/// Creates a test case with multiple test files. /// Creates a test case with multiple test files.
/// Exactly one test document must be provided that contains '@', the initial position marker. /// Exactly one test document must be provided that contains '@', the initial position marker.
/// Exactly one test document must be provided that contains '$', the target position marker. /// Exactly one test document must be provided that contains '$', the target position marker.
@@ -270,10 +282,12 @@ private:
F2TestCase::F2TestCase(CppEditorAction action, F2TestCase::F2TestCase(CppEditorAction action,
const QList<TestDocumentPtr> &testFiles, const QList<TestDocumentPtr> &testFiles,
OverrideItemList expectedVirtualFunctionProposal) OverrideItemList expectedVirtualFunctionProposal)
: m_prevUseClangd(CppTools::ClangdSettings::instance().useClangd())
{ {
QVERIFY(succeededSoFar()); QVERIFY(succeededSoFar());
setUseClangd(); if (m_testKit)
CppTools::ClangdSettings::setUseClangd(true);
// Check if there are initial and target position markers // Check if there are initial and target position markers
TestDocumentPtr initialTestFile = testFileWithInitialCursorMarker(testFiles); TestDocumentPtr initialTestFile = testFileWithInitialCursorMarker(testFiles);
@@ -287,11 +301,11 @@ F2TestCase::F2TestCase(CppEditorAction action,
const QString tag = QLatin1String(QTest::currentDataTag()); const QString tag = QLatin1String(QTest::currentDataTag());
const bool useClangd = CppTools::ClangdSettings::instance().useClangd(); const bool useClangd = CppTools::ClangdSettings::instance().useClangd();
if (useClangd) { if (useClangd) {
if (curTestName == "test_FollowSymbolUnderCursor_QObject_connect" if (curTestName == "testFollowSymbolQObjectConnect"
|| curTestName == "test_FollowSymbolUnderCursor_QObject_oldStyleConnect") { || curTestName == "testFollowSymbolQObjectOldStyleConnect") {
QSKIP("TODO: Implement fall-back"); QSKIP("TODO: Implement fall-back");
} }
if (curTestName == "test_FollowSymbolUnderCursor_classOperator" && tag == "backward") if (curTestName == "testFollowClassOperator" && tag == "backward")
QSKIP("clangd goes to operator name first"); QSKIP("clangd goes to operator name first");
if (tag.toLower().contains("fuzzy")) if (tag.toLower().contains("fuzzy"))
QSKIP("fuzzy matching is not supposed to work with clangd"); // TODO: Implement fallback as we do with libclang QSKIP("fuzzy matching is not supposed to work with clangd"); // TODO: Implement fallback as we do with libclang
@@ -301,7 +315,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
|| tag == "fromDestructorBody") { || tag == "fromDestructorBody") {
QSKIP("clangd wants the cursor before the ~ character"); QSKIP("clangd wants the cursor before the ~ character");
} }
if (curTestName == "test_FollowSymbolUnderCursor_classOperator_inOp") if (curTestName == "testFollowClassOperatorInOp")
QSKIP("clangd goes to operator name first"); QSKIP("clangd goes to operator name first");
} }
@@ -335,8 +349,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
QVERIFY2(openProjectResult && openProjectResult.project(), QVERIFY2(openProjectResult && openProjectResult.project(),
qPrintable(openProjectResult.errorMessage())); qPrintable(openProjectResult.errorMessage()));
projectCloser.setProject(openProjectResult.project()); projectCloser.setProject(openProjectResult.project());
openProjectResult.project()->configureAsExampleProject( openProjectResult.project()->configureAsExampleProject(m_testKit);
CppEditorPlugin::instance()->m_testKit);
// Wait until project is fully indexed. // Wait until project is fully indexed.
QVERIFY(CppTools::Tests::waitForSignalOrTimeout(openProjectResult.project(), QVERIFY(CppTools::Tests::waitForSignalOrTimeout(openProjectResult.project(),
@@ -392,7 +405,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
FollowSymbolInterface &delegate = CppModelManager::instance()->followSymbolInterface(); FollowSymbolInterface &delegate = CppModelManager::instance()->followSymbolInterface();
auto* builtinFollowSymbol = dynamic_cast<FollowSymbolUnderCursor *>(&delegate); auto* builtinFollowSymbol = dynamic_cast<FollowSymbolUnderCursor *>(&delegate);
if (!builtinFollowSymbol) { if (!builtinFollowSymbol) {
if (curTestName == "test_FollowSymbolUnderCursor_QTCREATORBUG7903") if (curTestName == "testFollowSymbolQTCREATORBUG7903")
QSKIP((curTestName + " is not supported by Clang FollowSymbol").toLatin1()); QSKIP((curTestName + " is not supported by Clang FollowSymbol").toLatin1());
widget->inTestMode = true; widget->inTestMode = true;
widget->openLinkUnderCursor(); widget->openLinkUnderCursor();
@@ -541,7 +554,7 @@ Q_DECLARE_METATYPE(QList<CppEditor::Internal::TestDocumentPtr>)
namespace CppEditor { namespace CppEditor {
namespace Internal { namespace Internal {
void CppEditorPlugin::initTestCase() void FollowSymbolTest::initTestCase()
{ {
const QString clangdFromEnv = qEnvironmentVariable("QTC_CLANGD"); const QString clangdFromEnv = qEnvironmentVariable("QTC_CLANGD");
if (clangdFromEnv.isEmpty()) if (clangdFromEnv.isEmpty())
@@ -552,14 +565,14 @@ void CppEditorPlugin::initTestCase()
return; return;
// Find suitable kit. // Find suitable kit.
m_testKit = Utils::findOr(KitManager::kits(), nullptr, [](const Kit *k) { F2TestCase::m_testKit = Utils::findOr(KitManager::kits(), nullptr, [](const Kit *k) {
return k->isValid(); return k->isValid();
}); });
if (!m_testKit) if (!F2TestCase::m_testKit)
QSKIP("This test requires at least one kit to be present"); QSKIP("This test requires at least one kit to be present");
} }
void CppEditorPlugin::test_SwitchMethodDeclarationDefinition_data() void FollowSymbolTest::testSwitchMethodDeclDef_data()
{ {
QTest::addColumn<QByteArray>("header"); QTest::addColumn<QByteArray>("header");
QTest::addColumn<QByteArray>("source"); QTest::addColumn<QByteArray>("source");
@@ -851,7 +864,7 @@ void CppEditorPlugin::test_SwitchMethodDeclarationDefinition_data()
"Foo::@operator int() const { return {}; }\n"); "Foo::@operator int() const { return {}; }\n");
} }
void CppEditorPlugin::test_SwitchMethodDeclarationDefinition() void FollowSymbolTest::testSwitchMethodDeclDef()
{ {
QFETCH(QByteArray, header); QFETCH(QByteArray, header);
QFETCH(QByteArray, source); QFETCH(QByteArray, source);
@@ -863,7 +876,7 @@ void CppEditorPlugin::test_SwitchMethodDeclarationDefinition()
F2TestCase(F2TestCase::SwitchBetweenMethodDeclarationDefinitionAction, testFiles); F2TestCase(F2TestCase::SwitchBetweenMethodDeclarationDefinitionAction, testFiles);
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_data() void FollowSymbolTest::testFollowSymbol_data()
{ {
QTest::addColumn<QByteArray>("source"); QTest::addColumn<QByteArray>("source");
@@ -1308,13 +1321,13 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_data()
); );
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor() void FollowSymbolTest::testFollowSymbol()
{ {
QFETCH(QByteArray, source); QFETCH(QByteArray, source);
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source)); F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source));
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_QTCREATORBUG7903_data() void FollowSymbolTest::testFollowSymbolQTCREATORBUG7903_data()
{ {
QTest::addColumn<QByteArray>("source"); QTest::addColumn<QByteArray>("source");
QTest::newRow("using_QTCREATORBUG7903_globalNamespace") << _( QTest::newRow("using_QTCREATORBUG7903_globalNamespace") << _(
@@ -1353,13 +1366,13 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_QTCREATORBUG7903_data()
); );
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_QTCREATORBUG7903() void FollowSymbolTest::testFollowSymbolQTCREATORBUG7903()
{ {
QFETCH(QByteArray, source); QFETCH(QByteArray, source);
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source)); F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source));
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_followCall_data() void FollowSymbolTest::testFollowCall_data()
{ {
QTest::addColumn<QByteArray>("variableDeclaration"); // without semicolon, can be "" QTest::addColumn<QByteArray>("variableDeclaration"); // without semicolon, can be ""
QTest::addColumn<QByteArray>("callArgument"); QTest::addColumn<QByteArray>("callArgument");
@@ -1398,7 +1411,7 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_followCall_data()
<< _("const Bar &"); << _("const Bar &");
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_followCall() void FollowSymbolTest::testFollowCall()
{ {
QFETCH(QByteArray, variableDeclaration); QFETCH(QByteArray, variableDeclaration);
QFETCH(QByteArray, callArgument); QFETCH(QByteArray, callArgument);
@@ -1426,7 +1439,7 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_followCall()
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source)); F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source));
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_multipleDocuments_data() void FollowSymbolTest::testFollowSymbolMultipleDocuments_data()
{ {
QTest::addColumn<QList<TestDocumentPtr> >("documents"); QTest::addColumn<QList<TestDocumentPtr> >("documents");
@@ -1537,13 +1550,13 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_multipleDocuments_data()
"}\n", "file.cpp")}; "}\n", "file.cpp")};
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_multipleDocuments() void FollowSymbolTest::testFollowSymbolMultipleDocuments()
{ {
QFETCH(QList<TestDocumentPtr>, documents); QFETCH(QList<TestDocumentPtr>, documents);
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, documents); F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, documents);
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_QObject_connect_data() void FollowSymbolTest::testFollowSymbolQObjectConnect_data()
{ {
#define TAG(str) secondQObjectParam ? str : str ", no 2nd QObject" #define TAG(str) secondQObjectParam ? str : str ", no 2nd QObject"
QTest::addColumn<char>("start"); QTest::addColumn<char>("start");
@@ -1595,7 +1608,7 @@ static void selectMarker(QByteArray *source, char marker, char number)
} }
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_QObject_connect() void FollowSymbolTest::testFollowSymbolQObjectConnect()
{ {
QFETCH(char, start); QFETCH(char, start);
QFETCH(char, target); QFETCH(char, target);
@@ -1646,7 +1659,7 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_QObject_connect()
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source)); F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source));
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_QObject_oldStyleConnect() void FollowSymbolTest::testFollowSymbolQObjectOldStyleConnect()
{ {
const QByteArray source = const QByteArray source =
"class O : public QObject {\n" "class O : public QObject {\n"
@@ -1666,14 +1679,14 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_QObject_oldStyleConnect()
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source)); F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source));
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_classOperator_onOperatorToken_data() void FollowSymbolTest::testFollowClassOperatorOnOperatorToken_data()
{ {
QTest::addColumn<bool>("toDeclaration"); QTest::addColumn<bool>("toDeclaration");
QTest::newRow("forward") << false; QTest::newRow("forward") << false;
QTest::newRow("backward") << true; QTest::newRow("backward") << true;
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_classOperator_onOperatorToken() void FollowSymbolTest::testFollowClassOperatorOnOperatorToken()
{ {
QFETCH(bool, toDeclaration); QFETCH(bool, toDeclaration);
@@ -1689,12 +1702,12 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_classOperator_onOperatorToken
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source)); F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source));
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_classOperator_data() void FollowSymbolTest::testFollowClassOperator_data()
{ {
test_FollowSymbolUnderCursor_classOperator_onOperatorToken_data(); testFollowClassOperatorOnOperatorToken_data();
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_classOperator() void FollowSymbolTest::testFollowClassOperator()
{ {
QFETCH(bool, toDeclaration); QFETCH(bool, toDeclaration);
@@ -1714,12 +1727,12 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_classOperator()
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source)); F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source));
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_classOperator_inOp_data() void FollowSymbolTest::testFollowClassOperatorInOp_data()
{ {
test_FollowSymbolUnderCursor_classOperator_onOperatorToken_data(); testFollowClassOperatorOnOperatorToken_data();
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_classOperator_inOp() void FollowSymbolTest::testFollowClassOperatorInOp()
{ {
QFETCH(bool, toDeclaration); QFETCH(bool, toDeclaration);
@@ -1739,7 +1752,7 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_classOperator_inOp()
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source)); F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source));
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall_data() void FollowSymbolTest::testFollowVirtualFunctionCall_data()
{ {
QTest::addColumn<QByteArray>("source"); QTest::addColumn<QByteArray>("source");
QTest::addColumn<OverrideItemList>("results"); QTest::addColumn<OverrideItemList>("results");
@@ -2038,7 +2051,7 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall_data()
<< OverrideItem(QLatin1String("Derived::virt"), 2)); << OverrideItem(QLatin1String("Derived::virt"), 2));
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall() void FollowSymbolTest::testFollowVirtualFunctionCall()
{ {
QFETCH(QByteArray, source); QFETCH(QByteArray, source);
QFETCH(OverrideItemList, results); QFETCH(OverrideItemList, results);
@@ -2047,7 +2060,7 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall()
} }
/// Check: Base classes can be found although these might be defined in distinct documents. /// Check: Base classes can be found although these might be defined in distinct documents.
void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall_multipleDocuments() void FollowSymbolTest::testFollowVirtualFunctionCallMultipleDocuments()
{ {
QList<TestDocumentPtr> testFiles = QList<TestDocumentPtr>() QList<TestDocumentPtr> testFiles = QList<TestDocumentPtr>()
<< TestDocument::create("struct A { virtual void virt(int) = 0; };\n", << TestDocument::create("struct A { virtual void virt(int) = 0; };\n",

View File

@@ -0,0 +1,74 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QObject>
// Can't use Tests namespace because someone had the clever idea to create two
// non-local TestDocument classes in this plugin.
namespace CppEditor::Internal {
class FollowSymbolTest : public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void testSwitchMethodDeclDef_data();
void testSwitchMethodDeclDef();
void testFollowSymbolMultipleDocuments_data();
void testFollowSymbolMultipleDocuments();
void testFollowSymbol_data();
void testFollowSymbol();
void testFollowSymbolQTCREATORBUG7903_data();
void testFollowSymbolQTCREATORBUG7903();
void testFollowCall_data();
void testFollowCall();
void testFollowSymbolQObjectConnect_data();
void testFollowSymbolQObjectConnect();
void testFollowSymbolQObjectOldStyleConnect();
void testFollowClassOperatorOnOperatorToken_data();
void testFollowClassOperatorOnOperatorToken();
void testFollowClassOperator_data();
void testFollowClassOperator();
void testFollowClassOperatorInOp_data();
void testFollowClassOperatorInOp();
void testFollowVirtualFunctionCall_data();
void testFollowVirtualFunctionCall();
void testFollowVirtualFunctionCallMultipleDocuments();
};
} // namespace CppEditor::Internal