from ..page import Color, Line, Page


def make_test_page():
    """Make a test page (899)."""
    p = Page(899)

    line = Line()
    line.start_double_size()
    line.add_text("Test page")
    p.set_line(2, line)

    line = Line()
    line.add_text("Foreground colours:")
    p.set_line(5, line)

    line = Line()
    line.add_text(" " * 2)
    line.start_fg(Color.RED)
    line.add_text("red")
    line.start_fg(Color.GREEN)
    line.add_text("green")
    line.start_fg(Color.BLUE)
    line.add_text("blue")
    line.start_fg(Color.CYAN)
    line.add_text("cyan")
    line.start_fg(Color.MAGENTA)
    line.add_text("magenta")
    p.set_line(6, line)

    line = Line()
    line.add_text(" " * 2)
    line.start_fg(Color.YELLOW)
    line.add_text("yellow")
    line.start_fg(Color.WHITE)
    line.add_text("white")
    line.start_fg(Color.DEFAULT)
    line.add_text("default")
    p.set_line(7, line)

    line = Line()
    line.add_text("Background colours:")
    p.set_line(9, line)

    line = Line()
    line.add_text(" " * 2)
    line.start_bg(Color.RED)
    line.start_fg(Color.WHITE)
    line.add_text("red")
    line.start_bg(Color.DEFAULT)
    line.start_bg(Color.GREEN)
    line.start_fg(Color.WHITE)
    line.add_text("green")
    line.start_bg(Color.DEFAULT)
    line.start_bg(Color.BLUE)
    line.start_fg(Color.WHITE)
    line.add_text("blue")
    line.start_bg(Color.DEFAULT)
    line.start_bg(Color.CYAN)
    line.start_fg(Color.WHITE)
    line.add_text("cyan")
    p.set_line(10, line)

    line = Line()
    line.add_text(" " * 2)
    line.start_bg(Color.MAGENTA)
    line.start_fg(Color.WHITE)
    line.add_text("magenta")
    line.start_bg(Color.DEFAULT)
    line.start_bg(Color.YELLOW)
    line.start_fg(Color.BLUE)
    line.add_text("yellow")
    line.start_bg(Color.DEFAULT)
    line.start_bg(Color.WHITE)
    line.start_fg(Color.BLUE)
    line.add_text("white")
    line.start_bg(Color.DEFAULT)
    line.start_bg(Color.BLACK)
    line.start_fg(Color.WHITE)
    line.add_text("black")
    p.set_line(11, line)

    line = Line()
    line.add_text(" " * 2)
    line.start_bg(Color.DEFAULT)
    line.start_fg(Color.WHITE)
    line.add_text("default")
    p.set_line(12, line)

    line = Line()
    line.add_text("Blocks:")
    p.set_line(14, line)

    line = Line()
    for c in [Color.WHITE, Color.RED, Color.GREEN, Color.BLUE,
              Color.CYAN, Color.MAGENTA, Color.YELLOW]:
        line.add_block(".xxx.xxx\n.x.x.x.x\nxx.xxx.x", c, None)
    p.set_line(15, line)

    p.write()
