Changeset View
Changeset View
Standalone View
Standalone View
autotests/src/vimode/base.cpp
Show First 20 Lines • Show All 248 Lines • ▼ Show 20 Line(s) | |||||
249 | { | 249 | { | ||
250 | BeginTest(original); | 250 | BeginTest(original); | ||
251 | TestPressKey(command); | 251 | TestPressKey(command); | ||
252 | FinishTest_(line, file, expected, expectation, failureReason); | 252 | FinishTest_(line, file, expected, expectation, failureReason); | ||
253 | } | 253 | } | ||
254 | 254 | | |||
255 | Qt::KeyboardModifier BaseTest::parseCodedModifier(const QString &string, int startPos, int *destEndOfCodedModifier) | 255 | Qt::KeyboardModifier BaseTest::parseCodedModifier(const QString &string, int startPos, int *destEndOfCodedModifier) | ||
256 | { | 256 | { | ||
257 | foreach (const QString &modifierCode, m_codesToModifiers.keys()) { | 257 | for (auto it = m_codesToModifiers.constBegin(), end = m_codesToModifiers.constEnd(); it != end; ++it) { | ||
258 | const QString &modifierCode = it.key(); | ||||
258 | // The "+2" is from the leading '\' and the trailing '-' | 259 | // The "+2" is from the leading '\' and the trailing '-' | ||
259 | if (string.mid(startPos, modifierCode.length() + 2) == QString("\\") + modifierCode + "-") { | 260 | if (string.mid(startPos, modifierCode.length() + 2) == QString("\\") + modifierCode + "-") { | ||
260 | if (destEndOfCodedModifier) { | 261 | if (destEndOfCodedModifier) { | ||
261 | // destEndOfCodeModifier lies on the trailing '-'. | 262 | // destEndOfCodeModifier lies on the trailing '-'. | ||
262 | *destEndOfCodedModifier = startPos + modifierCode.length() + 1; | 263 | *destEndOfCodedModifier = startPos + modifierCode.length() + 1; | ||
263 | Q_ASSERT(string[*destEndOfCodedModifier] == '-'); | 264 | Q_ASSERT(string[*destEndOfCodedModifier] == '-'); | ||
264 | } | 265 | } | ||
265 | return m_codesToModifiers.value(modifierCode); | 266 | return it.value(); | ||
266 | } | 267 | } | ||
267 | } | 268 | } | ||
268 | return Qt::NoModifier; | 269 | return Qt::NoModifier; | ||
269 | } | 270 | } | ||
270 | 271 | | |||
271 | Qt::Key BaseTest::parseCodedSpecialKey(const QString &string, int startPos, int *destEndOfCodedKey) | 272 | Qt::Key BaseTest::parseCodedSpecialKey(const QString &string, int startPos, int *destEndOfCodedKey) | ||
272 | { | 273 | { | ||
273 | foreach (const QString &specialKeyCode, m_codesToSpecialKeys.keys()) { | 274 | for (auto it = m_codesToSpecialKeys.constBegin(), end = m_codesToSpecialKeys.constEnd(); it != end; ++it) { | ||
275 | const QString &specialKeyCode = it.key(); | ||||
274 | // "+1" is for the leading '\'. | 276 | // "+1" is for the leading '\'. | ||
275 | if (string.mid(startPos, specialKeyCode.length() + 1) == QString("\\") + specialKeyCode) { | 277 | if (string.mid(startPos, specialKeyCode.length() + 1) == QString("\\") + specialKeyCode) { | ||
276 | if (destEndOfCodedKey) { | 278 | if (destEndOfCodedKey) { | ||
277 | *destEndOfCodedKey = startPos + specialKeyCode.length(); | 279 | *destEndOfCodedKey = startPos + specialKeyCode.length(); | ||
278 | } | 280 | } | ||
279 | return m_codesToSpecialKeys.value(specialKeyCode); | 281 | return it.value(); | ||
280 | } | 282 | } | ||
281 | } | 283 | } | ||
282 | return Qt::Key_unknown; | 284 | return Qt::Key_unknown; | ||
283 | } | 285 | } | ||
284 | 286 | | |||
285 | KateVi::EmulatedCommandBar * BaseTest::emulatedCommandBar() | 287 | KateVi::EmulatedCommandBar * BaseTest::emulatedCommandBar() | ||
286 | { | 288 | { | ||
287 | KateVi::EmulatedCommandBar *emulatedCommandBar = vi_input_mode->viModeEmulatedCommandBar(); | 289 | KateVi::EmulatedCommandBar *emulatedCommandBar = vi_input_mode->viModeEmulatedCommandBar(); | ||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |