| 302 | } |
| 303 | |
| 304 | void 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 | { |
nothing calls this directly
no test coverage detected