Beispiel #1
0
def test_widget_update_without_window(root):
    root.window.resize(1, 1)
    widget = Widget(root)
    widget.content = 'Hello World'
    root.window = None

    widget = widget.render()

    curses.doupdate()

    assert isinstance(widget, Widget)
    assert widget.window is None
Beispiel #2
0
def test_widget_render_with_window(root):
    widget = Widget(None)
    widget.window = root.window
    widget.content = 'Hello World'
    widget.pin(1, 2).render()

    window_text = widget.window.instr(0, 0, 11)

    assert isinstance(widget, Widget)
    assert widget.window is not None

    assert window_text == b'Hello World'
Beispiel #3
0
def test_widget_render_error(root):
    root.window.resize(1, 1)

    widget = Widget(root)
    widget.content = 'Hello World'

    widget = widget.render()

    curses.doupdate()

    window_text = widget.window.instr(0, 0, 1)

    assert window_text == b'H'
Beispiel #4
0
def test_widget_render_content(root):
    widget = Widget(root)
    assert widget.content == ''

    content = 'Hello World'
    widget.content = content
    widget = widget.render()

    curses.doupdate()

    window_text = widget.window.instr(0, 0, 11)

    assert widget.content == content
    assert window_text == b'Hello World'