Пример #1
0
def test_get_screen_lines():
    loadbar = px_load_bar.PxLoadBar(1, 1)
    baseline = px_process.get_all()

    SCREEN_ROWS = 10
    SCREEN_COLUMNS = 70
    lines = px_top.get_screen_lines(loadbar, baseline, SCREEN_ROWS,
                                    SCREEN_COLUMNS)

    # Top row should contain ANSI escape codes
    CSI = b"\x1b["
    assert b'CSI' in lines[0].replace(CSI, b'CSI')

    assert len(lines) == SCREEN_ROWS

    # Row three is the heading line, it should span the full width of the screen
    # and be in inverse video.
    assert len(lines[2]) == len(px_terminal.inverse_video('x' *
                                                          SCREEN_COLUMNS))

    # The actual process information starts at line four
    for line in lines[3:]:
        # No line can be longer than the screen width; long lines should have
        # been cut
        assert len(line) <= SCREEN_COLUMNS
Пример #2
0
def get_load_bar(physical=None, logical=None):
    return_me = px_load_bar.PxLoadBar(physical=physical, logical=logical)
    return_me.normal = b'n'
    return_me.inverse = b'i'
    return_me.red = b'r'
    return_me.yellow = b'y'
    return_me.green = b'g'
    return return_me
Пример #3
0
def test_redraw():
    # Just make sure it doesn't crash
    loadbar = px_load_bar.PxLoadBar(1, 1)
    baseline = px_process.get_all()
    px_top.redraw(loadbar, baseline, 100, 10, clear=False)