Skip to content
Snippets Groups Projects
Commit 9fd38226 authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

CppEditor: Add basic test for skipping forward declarations on F2


Change-Id: I6f6982b2e07bb1277d805ce48160afb25f33c7ae
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 323be40b
No related branches found
No related tags found
No related merge requests found
......@@ -98,6 +98,9 @@ private slots:
void test_SwitchMethodDeclarationDefinition_data();
void test_SwitchMethodDeclarationDefinition();
void test_FollowSymbolUnderCursor_multipleDocuments_data();
void test_FollowSymbolUnderCursor_multipleDocuments();
void test_FollowSymbolUnderCursor_data();
void test_FollowSymbolUnderCursor();
......
......@@ -465,6 +465,8 @@ void TestCase::run()
} // anonymous namespace
Q_DECLARE_METATYPE(QList<TestDocumentPtr>)
void CppEditorPlugin::test_SwitchMethodDeclarationDefinition_data()
{
QTest::addColumn<QByteArray>("header");
......@@ -870,6 +872,12 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_data()
"}\n"
);
QTest::newRow("skipForwardDeclarationBasic") << _(
"class $Foo {};\n"
"class Foo;\n"
"@Foo foo;\n"
);
QTest::newRow("using_QTCREATORBUG7903_globalNamespace") << _(
"namespace NS {\n"
"class Foo {};\n"
......@@ -914,6 +922,27 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor()
test.run();
}
void CppEditorPlugin::test_FollowSymbolUnderCursor_multipleDocuments_data()
{
QTest::addColumn<QList<TestDocumentPtr> >("documents");
QTest::newRow("skipForwardDeclarationBasic") << (QList<TestDocumentPtr>()
<< TestDocument::create("class $Foo {};\n",
QLatin1String("defined.h"))
<< TestDocument::create("class Foo;\n"
"@Foo foo;\n",
QLatin1String("forwardDeclaredAndUsed.h"))
);
}
void CppEditorPlugin::test_FollowSymbolUnderCursor_multipleDocuments()
{
QFETCH(QList<TestDocumentPtr>, documents);
TestCase test(TestCase::FollowSymbolUnderCursorAction, documents);
test.run();
}
void CppEditorPlugin::test_FollowSymbolUnderCursor_QObject_connect_data()
{
#define TAG(str) secondQObjectParam ? str : str ", no 2nd QObject"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment