diff options
author | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2015-04-23 12:01:54 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2015-04-24 08:30:51 +0000 |
commit | cea5d886d8ab5bae7a8601d84222d3fa7d6541ef (patch) | |
tree | c036fdec3185ee359269c65020c7b7d2cbe6f06b /src/plugins/cpptools/cppcompletion_test.cpp | |
parent | 7697bd4b6f0eaceb8d3aee96b8a49fb024ef1b66 (diff) | |
download | qt-creator-cea5d886d8ab5bae7a8601d84222d3fa7d6541ef.tar.gz |
CppTools: Fix global completion after "/// text."
Like for other comments, don't try member completion if the doxygen
comment ends with a dot.
Task-number: QTCREATORBUG-8597
Change-Id: I2d5204ba8f45fc9ee94e285a907364cc722e62c7
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcompletion_test.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp index f15950bc71..baa0f784d7 100644 --- a/src/plugins/cpptools/cppcompletion_test.cpp +++ b/src/plugins/cpptools/cppcompletion_test.cpp @@ -341,25 +341,48 @@ void CppToolsPlugin::test_global_completion_data() { QTest::addColumn<QByteArray>("code"); QTest::addColumn<QByteArray>("prefix"); + QTest::addColumn<QStringList>("requiredCompletionItems"); // Check that special completion after '&' for Qt5 signal/slots does not // interfere global completion after '&' QTest::newRow("global completion after & in return expression") << _("void f() { foo(myObject, @); }\n") - << _("&"); + << _("&") + << QStringList(); QTest::newRow("global completion after & in function argument") << _("int f() { return @; }\n") - << _("&"); + << _("&") + << QStringList(); + + // Check global completion after one line comments + const QByteArray codeTemplate = "int myGlobal;\n" + "<REPLACEMENT>\n" + "@\n"; + const QStringList replacements = QStringList() + << QLatin1String("// text") + << QLatin1String("// text.") + << QLatin1String("/// text") + << QLatin1String("/// text.") + ; + foreach (const QString &replacement, replacements) { + QByteArray code = codeTemplate; + code.replace("<REPLACEMENT>", replacement.toUtf8()); + const QByteArray tag = _("completion after comment: ") + replacement.toUtf8(); + QTest::newRow(tag) << code << QByteArray() << QStringList(QLatin1String("myGlobal")); + } } void CppToolsPlugin::test_global_completion() { QFETCH(QByteArray, code); QFETCH(QByteArray, prefix); + QFETCH(QStringList, requiredCompletionItems); CompletionTestCase test(code, prefix); QVERIFY(test.succeededSoFar()); - QVERIFY(isProbablyGlobalCompletion(test.getCompletions())); + const QStringList completions = test.getCompletions(); + QVERIFY(isProbablyGlobalCompletion(completions)); + QVERIFY(completions.toSet().contains(requiredCompletionItems.toSet())); } static void enumTestCase(const QByteArray &tag, const QByteArray &source, |