| 1066 | } |
| 1067 | |
| 1068 | void TestCodeCompletion::testImplementAfterEdit() |
| 1069 | { |
| 1070 | TestFile header1(QStringLiteral("void foo();"), QStringLiteral("h")); |
| 1071 | QVERIFY(header1.parseAndWait()); |
| 1072 | TestFile impl(QString("#include \"%1\"\n" |
| 1073 | "void asdf() {}\nvoid bar() {}") |
| 1074 | .arg(header1.url().str()), |
| 1075 | QStringLiteral("cpp"), &header1); |
| 1076 | |
| 1077 | auto document = ICore::self()->documentController()->openDocument(impl.url().toUrl()); |
| 1078 | |
| 1079 | QVERIFY(impl.parseAndWait(TopDUContext::AllDeclarationsContextsUsesAndAST)); |
| 1080 | |
| 1081 | CompletionItems expectedItems{{2,0}, {"foo()"}}; |
| 1082 | executeCompletionTest(impl.topContext(), expectedItems); |
| 1083 | |
| 1084 | document->textDocument()->insertText(expectedItems.position, QStringLiteral("\n")); |
| 1085 | expectedItems.position.setLine(3); |
| 1086 | |
| 1087 | executeCompletionTest(impl.topContext(), expectedItems); |
| 1088 | |
| 1089 | document->close(IDocument::Discard); |
| 1090 | } |
| 1091 | |
| 1092 | void TestCodeCompletion::testInvalidCompletions() |
| 1093 | { |
nothing calls this directly
no test coverage detected