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

Function TestKeyRepeat

vt/tests/key_test.go:241–258  ·  view source on GitHub ↗

TestKeyRepeat tests simple key repeat

(t *testing.T)

Source from the content-addressed store, hash-verified

239
240// TestKeyRepeat tests simple key repeat
241func TestKeyRepeat(t *testing.T) {
242 term := vt.NewMockTerm()
243 defer MustClose(t, term)
244
245 MustStart(t, term)
246
247 // Keep the initial repeat quick, but make later repeats very slow so the test
248 // does not depend on sub-100ms timer precision.
249 term.SetRepeat(time.Millisecond*50, time.Second)
250
251 term.KeyPress(vt.KeyX)
252 time.Sleep(100 * time.Millisecond)
253 term.KeyPress(vt.KeyX)
254 term.KeyRelease(vt.KeyX)
255 term.KeyRelease(vt.KeyCapsLock)
256
257 CheckRead(t, term, "xx")
258}
259
260// TestKeyRepeatDisabled tests simple key repeat
261func TestKeyRepeatDisabled(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…