diff options
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcompletion_test.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp index 3eed35b507..d749a7d554 100644 --- a/src/plugins/cpptools/cppcompletion_test.cpp +++ b/src/plugins/cpptools/cppcompletion_test.cpp @@ -2821,3 +2821,46 @@ void CppToolsPlugin::test_completion_signals_hide_QPrivateSignal() QCOMPARE(completions.size(), 1); QVERIFY(completions.contains(QLatin1String("timeout()"))); } + +void CppToolsPlugin::test_completion_member_of_class_accessed_by_using_QTCREATORBUG9037_1() +{ + const QByteArray source = + "namespace NS { struct S { int member; void fun(); }; }\n" + "using NS::S;\n" + "void S::fun()\n" + "{\n" + " @\n" + " // padding so we get the scope right\n" + "}\n" + ; + CompletionTestCase test(source, "mem"); + + QStringList completions = test.getCompletions(); + QCOMPARE(completions.size(), 1); + QVERIFY(completions.contains(QLatin1String("member"))); +} + +void CppToolsPlugin::test_completion_member_of_class_accessed_by_using_QTCREATORBUG9037_2() +{ + const QByteArray source = + "namespace NS \n" + "{\n" + " namespace Internal\n" + " {\n" + " struct S { int member; void fun(); };\n" + " }\n" + " using Internal::S;\n" + "}\n" + "using NS::S;\n" + "void S::fun()\n" + "{\n" + " @\n" + " // padding so we get the scope right\n" + "}\n" + ; + CompletionTestCase test(source, "mem"); + + QStringList completions = test.getCompletions(); + QCOMPARE(completions.size(), 1); + QVERIFY(completions.contains(QLatin1String("member"))); +} |