Exemple #1
0
def test_set_indicator_simple() -> None:
    mainloop = mock.Mock(urwid.MainLoop)
    screen = ScreenManagerImpl(mainloop)

    screen.set_indicator("test", "Hello World", protocol.IndicatorLocation.LEFT, 0)

    view = _render(mainloop.widget)
    assert "Hello World" in view

    screen.remove_indicator("test")
    view = _render(mainloop.widget)
    assert "Hello World" not in view
Exemple #2
0
def test_set_indicator_ordering() -> None:
    # GIVEN
    mainloop = mock.Mock(urwid.MainLoop)
    screen = ScreenManagerImpl(mainloop)
    screen.set_indicator("3", "Three", protocol.IndicatorLocation.RIGHT, 3)
    screen.set_indicator("1", "One", protocol.IndicatorLocation.RIGHT, 1)
    screen.set_indicator("2", ["T", "w", "o"], protocol.IndicatorLocation.RIGHT, 2)

    # WHEN
    view = _render(mainloop.widget)

    # THEN
    assert "One Two Three" in view