Exemple #1
0
    def test_line_valid_input(self):
        _paint_utils = PaintMain()
        _paint_utils._layout_matrix = _paint_utils.draw_layout(20,20)

        _layout = _paint_utils.draw_line(10,10,15,15)
        self.assertEqual(22, len(_layout))
        print('Test Line with Valid inputs')
Exemple #2
0
 def test_draw_layout_wrong_input(self):
     _paint_utils = PaintMain()
     try:
         _paint_utils._layout_matrix = _paint_utils.draw('C 30r 30c')
     except ValueError as ex:
         self.assertIsInstance(ex,ValueError)
     print('Testing in input command for Layout with invalid input')
Exemple #3
0
 def test_layout_nagative_input(self):
     _paint_utils = PaintMain()
     try:
         _layout = _paint_utils.draw_layout(-100, -100)
     except ValueError as ex:
         self.assertIsInstance(ex, ValueError)
     print('Test Layout with negative inputs')
Exemple #4
0
 def test_layout_invalid_input(self):
     _paint_utils = PaintMain()
     try:
         _layout = _paint_utils.draw_layout(1000, 1000)
     except ValueError as ex:
         self.assertIsInstance(ex, ValueError)
     print('Test Layout wifht invalid inputs')
Exemple #5
0
 def __init__(self):
     self._paint_utils = None
     self.input_command = []
     self._layout_matrix = []
     self.MAX_WIDTH = 300
     self.MAX_HEIGHT = 300
     self._paint_utils = PaintMain(self.MAX_WIDTH, self.MAX_HEIGHT)
Exemple #6
0
 def test_line_nagative_input(self):
     _paint_utils = PaintMain()
     _paint_utils._layout_matrix = _paint_utils.draw_layout(20, 20)
     try:
         _layout = _paint_utils.draw_line(-100, -100, 15, 15)
     except ValueError as ex:
         self.assertIsInstance(ex, ValueError)
     print('Test Line with negative inputs')
Exemple #7
0
 def test_rect_invalid_input(self):
     _paint_utils = PaintMain()
     _paint_utils._layout_matrix = _paint_utils.draw_layout(20, 20)
     try:
         _layout = _paint_utils.draw_rectangle(100, 100, 15, 15)
     except ValueError as ex:
         self.assertIsInstance(ex, ValueError)
     print('Test Rectangle with invalid inputs')
Exemple #8
0
class Painter:
    def __init__(self):
        self._paint_utils = None
        self.input_command = []
        self._layout_matrix = []
        self.MAX_WIDTH = 300
        self.MAX_HEIGHT = 300
        self._paint_utils = PaintMain(self.MAX_WIDTH, self.MAX_HEIGHT)

    print('Welcome to the Painter')

    def execute_command(self, input_cmd):
        try:
            self._layout_matrix = copy.deepcopy(
                self._paint_utils.execute_command(input_cmd))
            self._paint_utils.render(self._layout_matrix)
        except ValueError as ex:
            print(str(ex))
Exemple #9
0
 def test_draw_rect(self):
     _paint_utils = PaintMain()
     _paint_utils._layout_matrix = _paint_utils.draw_layout(20, 20)
     _paint_utils._layout_matrix = _paint_utils.draw('R 1 1 20 20')
     self.assertEqual('X', _paint_utils._layout_matrix[20][20])
     print('Testing in input command for Rectangle rendering proerly')
Exemple #10
0
 def test_draw_layout(self):
     _paint_utils = PaintMain()
     _paint_utils._layout_matrix = _paint_utils.draw('C 30 30')
     self.assertEqual(32, len(_paint_utils._layout_matrix))
     print('Testing in input command for Layout rendering proerly')
Exemple #11
0
 def test_layout_valid_input(self):
     _paint_utils = PaintMain()
     _layout = _paint_utils.draw_layout(10,10)
     self.assertEqual(12, len(_layout))
     print('Test Layout with Valid inputs')
Exemple #12
0
 def test_draw_line(self,i=1):
     _paint_utils = PaintMain()
     _paint_utils._layout_matrix = _paint_utils.draw_layout(20, 20)
     _paint_utils._layout_matrix = _paint_utils.draw('L 1 1 20 20')
     self.assertEqual('X', _paint_utils._layout_matrix[i][i])
     print('Testing in input command for Line rendering proerly')