Changeset View
Changeset View
Standalone View
Standalone View
autotests/syntaxrepository_test.cpp
Show First 20 Lines • Show All 216 Lines • ▼ Show 20 Line(s) | 200 | { | |||
---|---|---|---|---|---|
217 | QStringList definitionNames; | 217 | QStringList definitionNames; | ||
218 | for (auto d : defs) { | 218 | for (auto d : defs) { | ||
219 | QVERIFY(d.isValid()); | 219 | QVERIFY(d.isValid()); | ||
220 | definitionNames.push_back(d.name()); | 220 | definitionNames.push_back(d.name()); | ||
221 | } | 221 | } | ||
222 | QCOMPARE(definitionNames, expectedDefinitionNames); | 222 | QCOMPARE(definitionNames, expectedDefinitionNames); | ||
223 | } | 223 | } | ||
224 | 224 | | |||
225 | void testIncludedFormats() | ||||
226 | { | ||||
227 | QStringList definitionNames; | ||||
228 | foreach (const auto &def, m_repo.definitions()) { | ||||
229 | definitionNames.push_back(def.name()); | ||||
230 | } | ||||
231 | | ||||
232 | foreach (const QString & name, definitionNames) { | ||||
233 | Repository repo; | ||||
234 | auto def = repo.definitionForName(name); | ||||
235 | auto includedDefs = def.includedDefinitions(); | ||||
236 | includedDefs.push_front(def); | ||||
237 | | ||||
238 | // collect all formats, shall be numbered from 1.. | ||||
239 | QSet<int> formatIds; | ||||
240 | for (auto d : qAsConst(includedDefs)) { | ||||
241 | const auto formats = d.formats(); | ||||
242 | for (const auto format : formats) { | ||||
243 | // no duplicates | ||||
244 | QVERIFY(!formatIds.contains(format.id())); | ||||
245 | formatIds.insert(format.id()); | ||||
246 | } | ||||
247 | } | ||||
248 | | ||||
249 | // ensure all ids are there from 1..size | ||||
250 | for (int i = 1; i <= formatIds.size(); ++i) { | ||||
251 | qDebug() << "id" << i; | ||||
252 | QVERIFY(formatIds.contains(i)); | ||||
253 | } | ||||
254 | } | ||||
255 | } | ||||
256 | | ||||
225 | void testReload() | 257 | void testReload() | ||
226 | { | 258 | { | ||
227 | auto def = m_repo.definitionForName(QLatin1String("QML")); | 259 | auto def = m_repo.definitionForName(QLatin1String("QML")); | ||
228 | QVERIFY(!m_repo.definitions().isEmpty()); | 260 | QVERIFY(!m_repo.definitions().isEmpty()); | ||
229 | QVERIFY(def.isValid()); | 261 | QVERIFY(def.isValid()); | ||
230 | 262 | | |||
231 | NullHighlighter hl; | 263 | NullHighlighter hl; | ||
232 | hl.setDefinition(def); | 264 | hl.setDefinition(def); | ||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |