MCPcopy
hub / github.com/gdamore/tcell / TestKeyRepeatShift

Function TestKeyRepeatShift

vt/tests/key_test.go:323–341  ·  view source on GitHub ↗

TestKeyRepeatShift ensures that shifted keys still work as long as repeat is held down.

(t *testing.T)

Source from the content-addressed store, hash-verified

321
322// TestKeyRepeatShift ensures that shifted keys still work as long as repeat is held down.
323func TestKeyRepeatShift(t *testing.T) {
324 term := vt.NewMockTerm()
325 defer MustClose(t, term)
326
327 MustStart(t, term)
328
329 // Use a large repeat interval so the test is not sitting on a timing boundary.
330 // We only need to prove that shifted keys keep their shifted value while repeating.
331 term.SetRepeat(time.Millisecond*50, time.Millisecond*250)
332
333 term.KeyPress(vt.KeyLShift)
334 term.KeyPress(vt.Key1)
335 time.Sleep(90 * time.Millisecond)
336 term.KeyPress(vt.Key1)
337 term.KeyRelease(vt.Key1)
338 term.KeyRelease(vt.KeyLShift)
339
340 CheckRead(t, term, "!!") // 0 ms, 50 ms
341}
342
343// TestKeyRepeatShiftRelease ensures that releasing shift breaks repeat.
344func TestKeyRepeatShiftRelease(t *testing.T) {

Callers

nothing calls this directly

Calls 7

SetRepeatMethod · 0.95
KeyPressMethod · 0.95
KeyReleaseMethod · 0.95
NewMockTermFunction · 0.92
MustCloseFunction · 0.85
MustStartFunction · 0.85
CheckReadFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…