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

Method testPathGrouping

kdevplatform/shell/tests/test_filteredproblemstore.cpp:304–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304void TestFilteredProblemStore::testPathGrouping()
305{
306 m_store->clear();
307
308 // Rebuild the problem list with grouping
309 m_store->setGrouping(PathGrouping);
310
311 // Add problems
312 for (const IProblem::Ptr& p : std::as_const(m_problems)) {
313 m_store->addProblem(p);
314 }
315
316 QCOMPARE(m_store->count(), ProblemsCount);
317
318 for (int i = 0; i < 3; i++) {
319 const ProblemStoreNode *node = m_store->findNode(i);
320 checkNodeLabel(node, m_problems[i]->finalLocation().document.str());
321 QCOMPARE(node->count(), 1);
322
323 checkNodeDescription(node->child(0), m_problems[i]->description());
324 }
325
326
327 // Now add a new problem
328 IProblem::Ptr p(new DetectedProblem());
329 p->setDescription(QStringLiteral("PROBLEM4"));
330 p->setFinalLocation(m_problems[2]->finalLocation());
331 m_store->addProblem(p);
332
333 QCOMPARE(m_store->count(), ProblemsCount);
334
335 // Check the first 2 top-nodes
336 for (int i = 0; i < 2; i++) {
337 const ProblemStoreNode *node = m_store->findNode(i);
338 checkNodeLabel(node, m_problems[i]->finalLocation().document.str());
339 QCOMPARE(node->count(), 1);
340
341 checkNodeDescription(node->child(0), m_problems[i]->description());
342 }
343
344 // check the last one, and check the added problem is at the right place
345 {
346 const ProblemStoreNode *node = m_store->findNode(2);
347 checkNodeLabel(node, m_problems[2]->finalLocation().document.str());
348 QCOMPARE(node->count(), 2);
349
350 checkNodeDescription(node->child(1), p->description());
351 }
352
353 m_store->clear();
354 m_store->setProblems(m_problems);
355
356 // Check filters
357 // old-style setSeverity
358 // Error filter
359 m_store->setSeverity(IProblem::Error);
360 QCOMPARE(m_store->count(), ErrorFilterProblemCount);
361 {

Callers

nothing calls this directly

Calls 15

checkNodeLabelFunction · 0.85
checkNodeDescriptionFunction · 0.85
checkDiagnodesFunction · 0.85
strMethod · 0.80
clearMethod · 0.45
setGroupingMethod · 0.45
addProblemMethod · 0.45
countMethod · 0.45
findNodeMethod · 0.45
finalLocationMethod · 0.45
childMethod · 0.45
descriptionMethod · 0.45

Tested by

no test coverage detected