| 165 | } |
| 166 | |
| 167 | void TestFilteredProblemStore::testNoGrouping() |
| 168 | { |
| 169 | // Add problems |
| 170 | int c = 0; |
| 171 | for (const IProblem::Ptr& p : std::as_const(m_problems)) { |
| 172 | m_store->addProblem(p); |
| 173 | |
| 174 | c++; |
| 175 | QCOMPARE(m_store->count(), c); |
| 176 | } |
| 177 | for (int i = 0; i < c; i++) { |
| 178 | const auto *node = dynamic_cast<const ProblemNode*>(m_store->findNode(i)); |
| 179 | QVERIFY(node); |
| 180 | |
| 181 | QCOMPARE(node->problem()->description(), m_problems[i]->description()); |
| 182 | } |
| 183 | |
| 184 | // Check if clear works |
| 185 | m_store->clear(); |
| 186 | QCOMPARE(m_store->count(), 0); |
| 187 | |
| 188 | // Set problems |
| 189 | m_store->setProblems(m_problems); |
| 190 | QCOMPARE(m_problems.count(), m_store->count()); |
| 191 | for (int i = 0; i < c; i++) { |
| 192 | const auto *node = dynamic_cast<const ProblemNode*>(m_store->findNode(i)); |
| 193 | QVERIFY(node); |
| 194 | QCOMPARE(node->problem()->description(), m_problems[i]->description()); |
| 195 | } |
| 196 | |
| 197 | // Check old style severity filtering |
| 198 | // old-style setSeverity |
| 199 | // Error filter |
| 200 | m_store->setSeverity(IProblem::Error); |
| 201 | QCOMPARE(m_store->count(), ErrorFilterProblemCount); |
| 202 | for (int i = 0; i < ErrorFilterProblemCount; i++) { |
| 203 | const auto *node = dynamic_cast<const ProblemNode*>(m_store->findNode(0)); |
| 204 | QVERIFY(node); |
| 205 | QCOMPARE(node->problem()->description(), m_problems[i]->description()); |
| 206 | } |
| 207 | |
| 208 | // Warning filter |
| 209 | m_store->setSeverity(IProblem::Warning); |
| 210 | QCOMPARE(m_store->count(), WarningFilterProblemCount); |
| 211 | for (int i = 0; i < WarningFilterProblemCount; i++) { |
| 212 | const auto *node = dynamic_cast<const ProblemNode*>(m_store->findNode(i)); |
| 213 | QVERIFY(node); |
| 214 | |
| 215 | QCOMPARE(node->problem()->description(), m_problems[i]->description()); |
| 216 | } |
| 217 | |
| 218 | // Hint filter |
| 219 | m_store->setSeverity(IProblem::Hint); |
| 220 | QCOMPARE(m_store->count(), HintFilterProblemCount); |
| 221 | for (int i = 0; i < HintFilterProblemCount; i++) { |
| 222 | const auto *node = dynamic_cast<const ProblemNode*>(m_store->findNode(i)); |
| 223 | QVERIFY(node); |
| 224 |
nothing calls this directly
no test coverage detected