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

Method testSeverityGrouping

kdevplatform/shell/tests/test_filteredproblemstore.cpp:444–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442}
443
444void TestFilteredProblemStore::testSeverityGrouping()
445{
446 m_store->clear();
447 m_store->setGrouping(SeverityGrouping);
448 QCOMPARE(m_store->count(), 3);
449 const ProblemStoreNode *errorNode = m_store->findNode(0);
450 const ProblemStoreNode *warningNode = m_store->findNode(1);
451 const ProblemStoreNode *hintNode = m_store->findNode(2);
452
453 // Add problems
454 for (int i=0;i<ProblemsCount;i++)
455 {
456 m_store->addProblem(m_problems[i]);
457 int severityType = 0; //error
458 int addedCountOfCurrentSeverityType = i + 1;
459 if (i>=ErrorCount)
460 {
461 severityType = 1; //warning
462 addedCountOfCurrentSeverityType = i - ErrorCount + 1;
463 }
464 if (i>=ErrorCount+WarningCount)
465 {
466 severityType = 2; //hint
467 addedCountOfCurrentSeverityType = i - (ErrorCount + WarningCount) + 1;
468 }
469 QCOMPARE(m_store->findNode(severityType)->count(), addedCountOfCurrentSeverityType);
470 }
471
472 QVERIFY(checkNodeLabels());
473 QVERIFY(checkCounts(ErrorCount, WarningCount, HintCount));
474 checkNodeDescription(errorNode->child(0), m_problems[0]->description());
475 checkNodeDescription(warningNode->child(0), m_problems[1]->description());
476 checkNodeDescription(hintNode->child(0), m_problems[3]->description());
477
478 // Clear
479 m_store->clear();
480 QCOMPARE(m_store->count(), 3);
481 QVERIFY(checkCounts(0,0,0));
482
483 // Set problems
484 m_store->setProblems(m_problems);
485 QCOMPARE(m_store->count(), 3);
486 QVERIFY(checkNodeLabels());
487 QVERIFY(checkCounts(ErrorCount, WarningCount, HintCount));
488 checkNodeDescription(errorNode->child(0), m_problems[0]->description());
489 checkNodeDescription(warningNode->child(0), m_problems[1]->description());
490 checkNodeDescription(hintNode->child(0), m_problems[3]->description());
491
492 // Check severity filter
493 // old-style setSeverity
494 // Error filter
495 m_store->setSeverity(IProblem::Error);
496 QCOMPARE(m_store->count(), 3);
497 QVERIFY(checkNodeLabels());
498 QVERIFY(checkCounts(ErrorCount, 0, 0));
499 checkNodeDescription(errorNode->child(0), m_problems[0]->description());
500
501 // Warning filter

Callers

nothing calls this directly

Calls 12

checkNodeDescriptionFunction · 0.85
checkDiagnodesFunction · 0.85
clearMethod · 0.45
setGroupingMethod · 0.45
countMethod · 0.45
findNodeMethod · 0.45
addProblemMethod · 0.45
childMethod · 0.45
descriptionMethod · 0.45
setProblemsMethod · 0.45
setSeverityMethod · 0.45
setSeveritiesMethod · 0.45

Tested by

no test coverage detected