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

Method testNoGrouping

kdevplatform/shell/tests/test_problemmodel.cpp:72–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72void TestProblemModel::testNoGrouping()
73{
74 m_model->setGrouping(NoGrouping);
75 m_model->setSeverity(IProblem::Hint);
76
77 QCOMPARE(m_model->rowCount(), 0);
78
79 // Check if setting the problems works
80 m_model->setProblems(m_problems);
81 QCOMPARE(m_model->rowCount(), 3);
82
83 for (int i = 0; i < m_model->rowCount(); i++) {
84 QVERIFY(checkIsSame(i, QModelIndex(), m_problems[i]));
85 }
86
87 // Check if displaying various data parts works
88 QVERIFY(checkDisplay(0, QModelIndex(), m_problems[0]));
89
90 // Check if clearing the problems works
91 m_model->clearProblems();
92 QCOMPARE(m_model->rowCount(), 0);
93
94 // Check if adding the problems works
95 int c = 0;
96 for (const IProblem::Ptr& p : std::as_const(m_problems)) {
97 m_model->addProblem(p);
98 c++;
99
100 QCOMPARE(m_model->rowCount(), c);
101 }
102
103 for (int i = 0; i < m_model->rowCount(); i++) {
104 QVERIFY(checkIsSame(i, QModelIndex(), m_problems[i]));
105 }
106
107
108 // Check if filtering works
109 // old-style setSeverity
110 // Error filter
111 m_model->setSeverity(IProblem::Error);
112 QCOMPARE(m_model->rowCount(), 1);
113 QVERIFY(checkIsSame(0, QModelIndex(), m_problems[0]));
114
115 // Warning filter
116 m_model->setSeverity(IProblem::Warning);
117 QCOMPARE(m_model->rowCount(), 2);
118 QVERIFY(checkIsSame(0, QModelIndex(), m_problems[0]));
119 QVERIFY(checkIsSame(1, QModelIndex(), m_problems[1]));
120
121 // Hint filter
122 m_model->setSeverity(IProblem::Hint);
123 QCOMPARE(m_model->rowCount(), 3);
124 QVERIFY(checkIsSame(0, QModelIndex(), m_problems[0]));
125 QVERIFY(checkIsSame(1, QModelIndex(), m_problems[1]));
126 QVERIFY(checkIsSame(2, QModelIndex(), m_problems[2]));
127
128 // Check if filtering works
129 // new style

Callers

nothing calls this directly

Calls 8

QModelIndexClass · 0.50
setGroupingMethod · 0.45
setSeverityMethod · 0.45
rowCountMethod · 0.45
setProblemsMethod · 0.45
clearProblemsMethod · 0.45
addProblemMethod · 0.45
setSeveritiesMethod · 0.45

Tested by

no test coverage detected