MCPcopy Index your code
hub / github.com/python/cpython / test_textpad

Function test_textpad

Lib/test/curses_tests.py:13–37  ·  view source on GitHub ↗
(stdscr, insert_mode=False)

Source from the content-addressed store, hash-verified

11from curses import textpad
12
13def test_textpad(stdscr, insert_mode=False):
14 ncols, nlines = 8, 3
15 uly, ulx = 3, 2
16 if insert_mode:
17 mode = 'insert mode'
18 else:
19 mode = 'overwrite mode'
20
21 stdscr.addstr(uly-3, ulx, "Use Ctrl-G to end editing (%s)." % mode)
22 stdscr.addstr(uly-2, ulx, "Be sure to try typing in the lower-right corner.")
23 win = curses.newwin(nlines, ncols, uly, ulx)
24 textpad.rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
25 stdscr.refresh()
26
27 box = textpad.Textbox(win, insert_mode)
28 contents = box.edit()
29 stdscr.addstr(uly+ncols+2, 0, "Text entered in the box\n")
30 stdscr.addstr(repr(contents))
31 stdscr.addstr('\n')
32 stdscr.addstr('Press any key')
33 stdscr.getch()
34
35 for i in range(3):
36 stdscr.move(uly+ncols+2 + i, 0)
37 stdscr.clrtoeol()
38
39def main(stdscr):
40 stdscr.clear()

Callers 1

mainFunction · 0.85

Calls 3

editMethod · 0.95
refreshMethod · 0.45
moveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…