diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/cpptools/cppcompletion_test.cpp | 28 | ||||
-rw-r--r-- | src/plugins/cpptools/cpptoolsplugin.h | 1 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp index 3d2abd7095..d90d73d3ac 100644 --- a/src/plugins/cpptools/cppcompletion_test.cpp +++ b/src/plugins/cpptools/cppcompletion_test.cpp @@ -533,6 +533,34 @@ void CppToolsPlugin::test_completion_template_7() QVERIFY(completions.contains(QLatin1String("i"))); } +void CppToolsPlugin::test_completion_type_of_pointer_is_typedef() +{ + TestData data; + data.srcText = "\n" + "typedef struct Foo\n" + "{\n" + " int foo;\n" + "} Foo;\n" + "Foo *bar;\n" + "@\n" + ; + + setup(&data); + + Utils::ChangeSet change; + QString txt = QLatin1String("bar->"); + change.insert(data.pos, txt); + QTextCursor cursor(data.doc); + change.apply(&cursor); + data.pos += txt.length(); + + QStringList completions = getCompletions(data); + + QCOMPARE(completions.size(), 2); + QVERIFY(completions.contains(QLatin1String("Foo"))); + QVERIFY(completions.contains(QLatin1String("foo"))); +} + void CppToolsPlugin::test_completion() { QFETCH(QByteArray, code); diff --git a/src/plugins/cpptools/cpptoolsplugin.h b/src/plugins/cpptools/cpptoolsplugin.h index e6ad68cfb1..29dd1c8781 100644 --- a/src/plugins/cpptools/cpptoolsplugin.h +++ b/src/plugins/cpptools/cpptoolsplugin.h @@ -100,6 +100,7 @@ private slots: void test_completion_template_5(); void test_completion_template_6(); void test_completion_template_7(); + void test_completion_type_of_pointer_is_typedef(); void test_completion_template_as_base(); void test_completion_template_as_base_data(); void test_completion_use_global_identifier_as_base_class(); |