# Path: gfxlcd/driver/null/null_area.py
# class NullArea(Area, Chip):
#     """Test chip driver for area drawing"""
#     def __init__(self, width, height, driver, auto_flush=True):
#         Chip.__init__(self, width, height, driver, auto_flush)
#         Area.__init__(self, driver)
#         self.rotation = 0
# 
#     def _convert_color(self, color):
#         """color color"""
#         return color
# 
#     def init(self):
#         """init display"""
#         self.driver.init()
#         Area.init(self)
#         Chip.init(self)
#         self.driver.reset()
# 
#     def _set_area(self, pos_x1, pos_y1, pos_x2, pos_y2):
#         """set area to work on"""
#         self.driver.area = {
#             'start_x': pos_x1,
#             'start_y': pos_y1,
#             'end_x': pos_x2,
#             'end_y': pos_y2
#         }
#         self.driver.pointer = (0, 0)
# 
# Path: gfxlcd/driver/null/area_driver.py
# class AreaDriver(Driver):
#     """Null communication driver"""
#     def __init__(self, width, height):
#         self.height = height
#         self.width = width
#         self.buffer = [[0] * self.height for x in range(self.width)]
#         self.area = {
#             'start_x': 0,
#             'start_y': 0,
#             'end_x': width,
#             'end_y': height
#         }
#         self.pointer = (0, 0)
# 
#     def init(self):
#         """initialize pins"""
#         pass
# 
#     def reset(self):
#         """reset a display"""
#         pass
# 
#     def cmd(self, data, enable):
#         """send command to display"""
#         pass
# 
#     def data(self, data, enable):
#         """send data to display"""
#         app_x, app_y = self.pointer
#         self.buffer[
#             self.area['start_x'] + app_x][self.area['start_y'] + app_y
#         ] = data
#         self._inc_pointer()
# 
#     def _inc_pointer(self):
#         app_x, app_y = self.pointer
#         app_x += 1
#         if self.area['start_x'] + app_x > self.area['end_x']:
#             app_x = 0
#             app_y += 1
# 
#         if self.area['start_y'] + app_y > self.area['end_y']:
#             app_x = 0
#             app_y = 0
# 
#         self.pointer = (app_x, app_y)


import sys
from nose.tools import assert_equal
from gfxlcd.driver.null.null_area import NullArea
from gfxlcd.driver.null.area_driver import AreaDriver
sys.path.append("../../")


class TestAreaDrawing(object):
    color_black = {'R': 0, 'G': 0, 'B': 0}
    color_white = {'R': 255, 'G': 255, 'B':255}

    def setUp(self):
        self.drv = AreaDriver(10, 16)

# Path: gfxlcd/driver/null/null_area.py
# class NullArea(Area, Chip):
#     """Test chip driver for area drawing"""
#     def __init__(self, width, height, driver, auto_flush=True):
#         Chip.__init__(self, width, height, driver, auto_flush)
#         Area.__init__(self, driver)
#         self.rotation = 0
# 
#     def _convert_color(self, color):
#         """color color"""
#         return color
# 
#     def init(self):
#         """init display"""
#         self.driver.init()
#         Area.init(self)
#         Chip.init(self)
#         self.driver.reset()
# 
#     def _set_area(self, pos_x1, pos_y1, pos_x2, pos_y2):
#         """set area to work on"""
#         self.driver.area = {
#             'start_x': pos_x1,
#             'start_y': pos_y1,
#             'end_x': pos_x2,
#             'end_y': pos_y2
#         }
#         self.driver.pointer = (0, 0)
# 
# Path: gfxlcd/driver/null/area_driver.py
# class AreaDriver(Driver):
#     """Null communication driver"""
#     def __init__(self, width, height):
#         self.height = height
#         self.width = width
#         self.buffer = [[0] * self.height for x in range(self.width)]
#         self.area = {
#             'start_x': 0,
#             'start_y': 0,
#             'end_x': width,
#             'end_y': height
#         }
#         self.pointer = (0, 0)
# 
#     def init(self):
#         """initialize pins"""
#         pass
# 
#     def reset(self):
#         """reset a display"""
#         pass
# 
#     def cmd(self, data, enable):
#         """send command to display"""
#         pass
# 
#     def data(self, data, enable):
#         """send data to display"""
#         app_x, app_y = self.pointer
#         self.buffer[
#             self.area['start_x'] + app_x][self.area['start_y'] + app_y
#         ] = data
#         self._inc_pointer()
# 
#     def _inc_pointer(self):
#         app_x, app_y = self.pointer
#         app_x += 1
#         if self.area['start_x'] + app_x > self.area['end_x']:
#             app_x = 0
#             app_y += 1
# 
#         if self.area['start_y'] + app_y > self.area['end_y']:
#             app_x = 0
#             app_y = 0
# 
#         self.pointer = (app_x, app_y)


# Path: gfxlcd/tests/test_area_drawing.py
import sys
from nose.tools import assert_equal
from gfxlcd.driver.null.null_area import NullArea
from gfxlcd.driver.null.area_driver import AreaDriver

sys.path.append("../../")


class TestAreaDrawing(object):
    color_black = {'R': 0, 'G': 0, 'B': 0}
    color_white = {'R': 255, 'G': 255, 'B':255}

    def setUp(self):
        self.drv = AreaDriver(10, 16)

        self.lcd = NullArea(10, 16, self.drv, False)