Changeset View
Changeset View
Standalone View
Standalone View
autotests/syntaxrepository_test.cpp
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | 79 | { | |||
---|---|---|---|---|---|
89 | } | 89 | } | ||
90 | } | 90 | } | ||
91 | 91 | | |||
92 | void testLoadAll() | 92 | void testLoadAll() | ||
93 | { | 93 | { | ||
94 | foreach (const auto &def, m_repo.definitions()) { | 94 | foreach (const auto &def, m_repo.definitions()) { | ||
95 | QVERIFY(!def.name().isEmpty()); | 95 | QVERIFY(!def.name().isEmpty()); | ||
96 | QVERIFY(!def.translatedName().isEmpty()); | 96 | QVERIFY(!def.translatedName().isEmpty()); | ||
97 | QVERIFY(!def.section().isEmpty()); | 97 | QVERIFY(!def.isValid() || !def.section().isEmpty()); | ||
98 | QVERIFY(!def.translatedSection().isEmpty()); | 98 | QVERIFY(!def.isValid() || !def.translatedSection().isEmpty()); | ||
99 | // indirectly trigger loading, as we can't reach that from public API | 99 | // indirectly trigger loading, as we can't reach that from public API | ||
100 | // if the loading fails the highlighter will produce empty states | 100 | // if the loading fails the highlighter will produce empty states | ||
101 | NullHighlighter hl; | 101 | NullHighlighter hl; | ||
102 | State initialState; | 102 | State initialState; | ||
103 | hl.setDefinition(def); | 103 | hl.setDefinition(def); | ||
104 | const auto state = hl.highlightLine(QLatin1String("This should not crash } ] ) !"), initialState); | 104 | const auto state = hl.highlightLine(QLatin1String("This should not crash } ] ) !"), initialState); | ||
105 | QVERIFY(state != initialState); | 105 | QVERIFY(!def.isValid() || state != initialState); | ||
106 | } | 106 | } | ||
107 | } | 107 | } | ||
108 | 108 | | |||
109 | void testMetaData() | 109 | void testMetaData() | ||
110 | { | 110 | { | ||
111 | auto def = m_repo.definitionForName(QLatin1String("Alerts")); | 111 | auto def = m_repo.definitionForName(QLatin1String("Alerts")); | ||
112 | QVERIFY(def.isValid()); | 112 | QVERIFY(def.isValid()); | ||
113 | QVERIFY(def.extensions().isEmpty()); | 113 | QVERIFY(def.extensions().isEmpty()); | ||
▲ Show 20 Lines • Show All 145 Lines • ▼ Show 20 Line(s) | 247 | { | |||
259 | QVERIFY(customTheme.isValid()); | 259 | QVERIFY(customTheme.isValid()); | ||
260 | } | 260 | } | ||
261 | 261 | | |||
262 | void testInvalidDefinition() | 262 | void testInvalidDefinition() | ||
263 | { | 263 | { | ||
264 | Definition def; | 264 | Definition def; | ||
265 | QVERIFY(!def.isValid()); | 265 | QVERIFY(!def.isValid()); | ||
266 | QVERIFY(def.filePath().isEmpty()); | 266 | QVERIFY(def.filePath().isEmpty()); | ||
267 | QVERIFY(def.name().isEmpty()); | 267 | QCOMPARE(def.name(), QLatin1String("None")); | ||
268 | QVERIFY(def.translatedName().isEmpty()); | | |||
269 | QVERIFY(def.section().isEmpty()); | 268 | QVERIFY(def.section().isEmpty()); | ||
270 | QVERIFY(def.translatedSection().isEmpty()); | 269 | QVERIFY(def.translatedSection().isEmpty()); | ||
271 | QVERIFY(def.mimeTypes().isEmpty()); | 270 | QVERIFY(def.mimeTypes().isEmpty()); | ||
272 | QVERIFY(def.extensions().isEmpty()); | 271 | QVERIFY(def.extensions().isEmpty()); | ||
273 | QCOMPARE(def.version(), 0); | 272 | QCOMPARE(def.version(), 0); | ||
274 | QCOMPARE(def.priority(), 0); | 273 | QCOMPARE(def.priority(), 0); | ||
275 | QVERIFY(!def.isHidden()); | 274 | QVERIFY(!def.isHidden()); | ||
276 | QVERIFY(def.style().isEmpty()); | 275 | QVERIFY(def.style().isEmpty()); | ||
Show All 40 Lines |