MCPcopy Create free account
hub / github.com/KDE/kdevelop / generateProblems

Method generateProblems

kdevplatform/shell/tests/test_problemmodel.cpp:422–469  ·  view source on GitHub ↗

Generate 3 problems, all with different paths, different severity Also generates a problem with diagnostics

Source from the content-addressed store, hash-verified

420// Generate 3 problems, all with different paths, different severity
421// Also generates a problem with diagnostics
422void TestProblemModel::generateProblems()
423{
424 IProblem::Ptr p1(new DetectedProblem());
425 IProblem::Ptr p2(new DetectedProblem());
426 IProblem::Ptr p3(new DetectedProblem());
427
428 DocumentRange r1;
429 r1.document = IndexedString( prependPathRoot("just/a/random/path") );
430
431 p1->setDescription(QStringLiteral("PROBLEM1"));
432 p1->setSeverity(IProblem::Error);
433 p1->setFinalLocation(r1);
434
435 DocumentRange r2;
436 r2.document = IndexedString( prependPathRoot("just/another/path") );
437
438 p2->setDescription(QStringLiteral("PROBLEM2"));
439 p2->setSeverity(IProblem::Warning);
440 p2->setFinalLocation(r2);
441
442 DocumentRange r3;
443 r3.document = IndexedString( prependPathRoot("yet/another/test/path") );
444
445 p2->setDescription(QStringLiteral("PROBLEM3"));
446 p3->setSeverity(IProblem::Hint);
447 p3->setFinalLocation(r3);
448
449 m_problems.push_back(p1);
450 m_problems.push_back(p2);
451 m_problems.push_back(p3);
452
453 // Problem for diagnostic testing
454 IProblem::Ptr p(new DetectedProblem());
455 DocumentRange r;
456 r.document = IndexedString("DIAGTEST");
457 p->setFinalLocation(r);
458 p->setDescription(QStringLiteral("PROBLEM"));
459 p->setSeverity(IProblem::Error);
460
461 IProblem::Ptr d(new DetectedProblem());
462 d->setDescription(QStringLiteral("DIAG"));
463
464 IProblem::Ptr dd(new DetectedProblem());
465 dd->setDescription(QStringLiteral("DIAGDIAG"));
466 d->addDiagnostic(dd);
467 p->addDiagnostic(d);
468 m_diagnosticTestProblem = p;
469}
470
471bool TestProblemModel::checkIsSame(int row, const QModelIndex &parent, const IProblem::Ptr &problem)
472{

Callers

nothing calls this directly

Calls 6

IndexedStringClass · 0.50
setDescriptionMethod · 0.45
setSeverityMethod · 0.45
setFinalLocationMethod · 0.45
push_backMethod · 0.45
addDiagnosticMethod · 0.45

Tested by

no test coverage detected