def test_insert_delete_lines(): screen = DiffScreen(80, 24) screen.cursor_to_line(screen.lines // 2) for method in ["insert_lines", "delete_lines"]: screen.dirty.clear() getattr(screen, method)() assert screen.dirty == set(range(screen.cursor.y, screen.lines))
def test_index(): screen = DiffScreen(80, 24) screen.dirty.clear() # a) not at the bottom margin -- nothing is marked dirty. screen.index() assert not screen.dirty # b) whole screen is dirty. screen.cursor_to_line(24) screen.index() assert screen.dirty == set(range(screen.lines))
def test_reverse_index(): screen = DiffScreen(80, 24) screen.dirty.clear() # a) not at the top margin -- whole screen is dirty. screen.reverse_index() assert screen.dirty == set(range(screen.lines)) # b) nothing is marked dirty. screen.dirty.clear() screen.cursor_to_line(screen.lines // 2) screen.reverse_index() assert not screen.dirty
def test_erase_in_display(): screen = DiffScreen(80, 24) screen.cursor_to_line(screen.lines // 2) # a) from cursor to the end of the screen. screen.dirty.clear() screen.erase_in_display() assert screen.dirty == set(range(screen.cursor.y, screen.lines)) # b) from the begining of the screen to cursor. screen.dirty.clear() screen.erase_in_display(1) assert screen.dirty == set(range(0, screen.cursor.y + 1)) # c) whole screen. screen.dirty.clear() screen.erase_in_display(2) assert screen.dirty == set(range(0, screen.lines))