Changeset View
Changeset View
Standalone View
Standalone View
languages/clang/tests/test_problems.cpp
Show All 34 Lines | |||||
35 | #include <tests/testfile.h> | 35 | #include <tests/testfile.h> | ||
36 | #include <tests/testhelpers.h> | 36 | #include <tests/testhelpers.h> | ||
37 | #include <tests/testproject.h> | 37 | #include <tests/testproject.h> | ||
38 | #include <interfaces/ilanguagecontroller.h> | 38 | #include <interfaces/ilanguagecontroller.h> | ||
39 | 39 | | |||
40 | #include <QtTest/QTest> | 40 | #include <QtTest/QTest> | ||
41 | #include <QLoggingCategory> | 41 | #include <QLoggingCategory> | ||
42 | 42 | | |||
43 | #include <ktexteditor_version.h> | | |||
44 | #if KTEXTEDITOR_VERSION < QT_VERSION_CHECK(5, 10, 0) | | |||
45 | Q_DECLARE_METATYPE(KTextEditor::Cursor); | | |||
46 | Q_DECLARE_METATYPE(KTextEditor::Range); | | |||
47 | #endif | | |||
48 | | ||||
49 | Q_DECLARE_METATYPE(KDevelop::IProblem::Severity); | 43 | Q_DECLARE_METATYPE(KDevelop::IProblem::Severity); | ||
50 | 44 | | |||
51 | using namespace KDevelop; | 45 | using namespace KDevelop; | ||
52 | 46 | | |||
53 | namespace { | 47 | namespace { | ||
54 | 48 | | |||
55 | const QString FileName = | 49 | const QString FileName = | ||
56 | #ifdef Q_OS_WIN | 50 | #ifdef Q_OS_WIN | ||
▲ Show 20 Lines • Show All 192 Lines • ▼ Show 20 Line(s) | 223 | { | |||
249 | QCOMPARE(top->problems().size(), 1); | 243 | QCOMPARE(top->problems().size(), 1); | ||
250 | 244 | | |||
251 | auto problem = dynamic_cast<UnknownDeclarationProblem*>(top->problems().first().data()); | 245 | auto problem = dynamic_cast<UnknownDeclarationProblem*>(top->problems().first().data()); | ||
252 | auto assistant = problem->solutionAssistant(); | 246 | auto assistant = problem->solutionAssistant(); | ||
253 | auto clangFixitAssistant = qobject_cast<ClangFixitAssistant*>(assistant.data()); | 247 | auto clangFixitAssistant = qobject_cast<ClangFixitAssistant*>(assistant.data()); | ||
254 | QVERIFY(clangFixitAssistant); | 248 | QVERIFY(clangFixitAssistant); | ||
255 | 249 | | |||
256 | auto fixits = clangFixitAssistant->fixits(); | 250 | auto fixits = clangFixitAssistant->fixits(); | ||
257 | QCOMPARE(fixits.size(), 3); | 251 | QCOMPARE(fixits.size(), 2); | ||
258 | QCOMPARE(fixits[0].replacementText, QString("class A;\n")); | 252 | QCOMPARE(fixits[0].replacementText, QString("class A;\n")); | ||
259 | QCOMPARE(fixits[1].replacementText, QString("struct A;\n")); // TODO: We shouldn't show this | 253 | QCOMPARE(fixits[1].replacementText, QString("#include \"%1\"\n").arg(include.url().toUrl().fileName())); | ||
260 | QCOMPARE(fixits[2].replacementText, QString("#include \"%1\"\n").arg(include.url().toUrl().fileName())); | | |||
261 | } | 254 | } | ||
262 | 255 | | |||
263 | struct ExpectedTodo | 256 | struct ExpectedTodo | ||
264 | { | 257 | { | ||
265 | QString description; | 258 | QString description; | ||
266 | KTextEditor::Cursor start; | 259 | KTextEditor::Cursor start; | ||
267 | KTextEditor::Cursor end; | 260 | KTextEditor::Cursor end; | ||
268 | }; | 261 | }; | ||
▲ Show 20 Lines • Show All 156 Lines • Show Last 20 Lines |