forked from qt-creator/qt-creator
CppEditor: Fix quickfix for adding include for static functions
Task-number: QTCREATORBUG-14499 Change-Id: Id3e962ed310f43c33b91c7834a1f9ca074519a38 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -236,7 +236,6 @@ QuickFixOperationTest::QuickFixOperationTest(const QList<QuickFixTestDocument::P
|
||||
QuickFixOperations operations;
|
||||
factory->match(quickFixInterface, operations);
|
||||
if (operations.isEmpty()) {
|
||||
QEXPECT_FAIL("onBaseOfQualifiedClassName", "QTCREATORBUG-14499", Continue);
|
||||
QVERIFY(testDocuments.first()->m_expectedSource.isEmpty());
|
||||
return;
|
||||
}
|
||||
@@ -3031,6 +3030,37 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_data()
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
// Header File
|
||||
original = "template <typename T> class Foo { static void bar() {} };\n";
|
||||
expected = original;
|
||||
testDocuments << QuickFixTestDocument::create("afile.h", original, expected);
|
||||
|
||||
// Source File
|
||||
original =
|
||||
"#include \"header.h\"\n"
|
||||
"\n"
|
||||
"void f()\n"
|
||||
"{\n"
|
||||
" @Foo<int>::bar();\n"
|
||||
"}\n"
|
||||
;
|
||||
expected =
|
||||
"#include \"afile.h\"\n"
|
||||
"#include \"header.h\"\n"
|
||||
"\n"
|
||||
"void f()\n"
|
||||
"{\n"
|
||||
" Foo<int>::bar();\n"
|
||||
"}\n"
|
||||
;
|
||||
testDocuments << QuickFixTestDocument::create("afile.cpp", original, expected);
|
||||
QTest::newRow("onBaseOfQualifiedTemplateClassName")
|
||||
<< TestIncludePaths::globalIncludePath()
|
||||
<< testDocuments << firstRefactoringOperation << "";
|
||||
testDocuments.clear();
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
// Header File
|
||||
original = "namespace N { template <typename T> class Foo {}; }\n";
|
||||
expected = original;
|
||||
|
||||
Reference in New Issue
Block a user