Example #1
0
    def test_paint_cross(self):
        widget_size = (500, 1000)
        display_size = (50, 100)
        vertical_line = [[250, 0], [250, 1000]]
        horizontal_line = [[0, 800], [500, 800]]
        brush_color = Color.White()
        point_size = 5
        effect = PaintEffect(display_size, widget_size)

        effect.set_point_size(point_size)
        effect.set_line_color(brush_color)
        effect.draw_lines(vertical_line)
        effect.draw_lines(horizontal_line)

        image = effect.get_image()
        self.assertEqual(image.size, display_size)
        self.assertEqual(image.getpixel((25, 0)), brush_color.get_as_tuple())
        self.assertEqual(image.getpixel((25, 99)), brush_color.get_as_tuple())
        self.assertEqual(image.getpixel((0, 80)), brush_color.get_as_tuple())
        self.assertEqual(image.getpixel((49, 80)), brush_color.get_as_tuple())
Example #2
0
 def __init__(self, size, widget_size):
     self.__size = size
     self.__widget_size = widget_size
     self.__point_size = 10
     self.__line_color = Color.White()
     self.__image = ImageFactory.create_rgb_image(self.__size)