def test_focusable_widget_gets_keypress_only_if_visible(self):
w = Scrollable(
urwid.Pile([urwid.Text('t1'),
urwid.Text('t2'),
urwid.Edit('', 'e3')])
)
size = (5, 2)
def press_keys():
for key in ('backspace', 'backspace', 'f', 'o', 'o'):
w.keypress(size, key)
self.check(w, size, text=('t1'.ljust(size[0]),
't2'.ljust(size[0])))
press_keys()
self.check(w, size, text=('t1'.ljust(size[0]),
't2'.ljust(size[0])))
w.set_scrollpos(1)
self.check(w, size, text=('t2'.ljust(size[0]),
'e3'.ljust(size[0])))
press_keys()
self.check(w, size, text=('t2'.ljust(size[0]),
'foo'.ljust(size[0])))
评论列表
文章目录