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

Method testSeverityGrouping

kdevplatform/shell/tests/test_problemmodel.cpp:264–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264void TestProblemModel::testSeverityGrouping()
265{
266 m_model->setGrouping(SeverityGrouping);
267 m_model->setSeverity(IProblem::Hint);
268 QCOMPARE(m_model->rowCount(), 3);
269
270 // Check if setting problems works
271 m_model->setProblems(m_problems);
272 QCOMPARE(m_model->rowCount(), 3);
273 for (int i = 0; i < m_model->rowCount(); i++) {
274 QVERIFY(checkSeverityGroup(i, m_problems[i]));
275 }
276
277 // Check if displaying works
278 for (int i = 0; i < m_model->rowCount(); i++) {
279 QModelIndex parent = m_model->index(i, 0);
280 QVERIFY(parent.isValid());
281
282 QVERIFY(checkDisplay(0, parent, m_problems[i]));
283 }
284
285 // Check if clearing works
286 m_model->clearProblems();
287 QCOMPARE(m_model->rowCount(), 3);
288
289 // Check if adding problems works
290 int c = 0;
291 for (const IProblem::Ptr& p : std::as_const(m_problems)) {
292 m_model->addProblem(p);
293 QVERIFY(checkSeverityGroup(c, m_problems[c]));
294 c++;
295 }
296
297 // Check if filtering works
298 // old-style setSeverity
299 // Error filtering
300 m_model->setSeverity(IProblem::Error);
301 QCOMPARE(m_model->rowCount(), 3);
302 checkSeverityGroup(0, m_problems[0]);
303
304 // Warning filtering
305 m_model->setSeverity(IProblem::Warning);
306 QCOMPARE(m_model->rowCount(), 3);
307 checkSeverityGroup(0, m_problems[0]);
308 checkSeverityGroup(1, m_problems[1]);
309
310 // Hint filtering
311 m_model->setSeverity(IProblem::Hint);
312 QCOMPARE(m_model->rowCount(), 3);
313 checkSeverityGroup(0, m_problems[0]);
314 checkSeverityGroup(1, m_problems[1]);
315 checkSeverityGroup(2, m_problems[2]);
316
317 // Check if filtering works
318 // Error filtering
319 m_model->setSeverities(IProblem::Error);
320 QCOMPARE(m_model->rowCount(), 3);
321 checkSeverityGroup(0, m_problems[0]);

Callers

nothing calls this directly

Calls 9

setGroupingMethod · 0.45
setSeverityMethod · 0.45
rowCountMethod · 0.45
setProblemsMethod · 0.45
indexMethod · 0.45
isValidMethod · 0.45
clearProblemsMethod · 0.45
addProblemMethod · 0.45
setSeveritiesMethod · 0.45

Tested by

no test coverage detected