Ejemplo n.º 1
0
 def test_coords_filtering(self):
     """tests whether the coordinate filtering works"""
     w = 128
     h = 64
     c = Canvas(get_mock_output(width=w, height=h), name=c_name)
     assert (c.check_coordinates((0, 1)) == (0, 1))
     assert (c.check_coordinates(("-2", "-3")) == (w-2, h-3))
     assert (c.check_coordinates((0, 1, 2, 3)) == (0, 1, 2, 3))
     assert (c.check_coordinates((0, 1, "-2", "-3")) == (0, 1, w-2, h-3))
     assert (c.check_coordinates(("-0", "-1", "-2", "-3")) == (w, h-1, w-2, h-3))
     assert (c.check_coordinates(("-0", "1", "-2", "-3")) == (w, h+1, w-2, h-3))
Ejemplo n.º 2
0
 def test_coords_filtering(self):
     """tests whether the coordinate filtering works"""
     w = 128
     h = 64
     c = Canvas(get_mock_output(width=w, height=h), name=c_name)
     assert (c.check_coordinates((0, 1)) == (0, 1))
     assert (c.check_coordinates(("-2", "-3")) == (w - 2, h - 3))
     assert (c.check_coordinates((0, 1, 2, 3)) == (0, 1, 2, 3))
     assert (c.check_coordinates(
         (0, 1, "-2", "-3")) == (0, 1, w - 2, h - 3))
     # check_coordinates will rearrange coordinates in a way that x1 < x2 and y1 < y2
     assert (c.check_coordinates(
         ("-0", "-1", "-2", "-3")) == (w - 2, h - 3, w, h - 1))
     assert (c.check_coordinates(
         ("-0", "1", "-2", "-3")) == (w - 2, h - 3, w, h + 1))