Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def test_line_for_gaps(self):
- # __doc__ (as of 2008-06-25) for pygame.draw.line:
- # pygame.draw.line(Surface, color, start_pos, end_pos, width=1): return Rect
- # draw a straight line segment
- # This checks bug Thick Line Bug #448
- def surrounded_pixels_are_white(p):
- x, y = p
- self.assertEqual(surf.get_at((x+1, y)), (255, 255, 255, 255))
- self.assertEqual(surf.get_at((x, y+1)), (255, 255, 255, 255))
- self.assertEqual(surf.get_at((x-1, y)), (255, 255, 255, 255))
- self.assertEqual(surf.get_at((x, y-1)), (255, 255, 255, 255))
- self.assertEqual(surf.get_at((x+1, y+1)), (255, 255, 255, 255))
- self.assertEqual(surf.get_at((x+1, y-1)), (255, 255, 255, 255))
- self.assertEqual(surf.get_at((x-1, y+1)), (255, 255, 255, 255))
- self.assertEqual(surf.get_at((x-1, y+1)), (255, 255, 255, 255))
- surf = pygame.Surface((200, 200), pygame.SRCALPHA)
- surf.fill((0, 0, 0))
- pygame.draw.line(surf, (255, 255, 255), (50, 50), (140, 0), 30)
- pixel = (51, 49)
- self.assertEqual(surf.get_at(pixel), (255, 255, 255, 255))
- surrounded_pixels_are_white(pixel)
- surf.fill((0, 0, 0))
- pygame.draw.line(surf, (255, 255, 255), (50, 50), (0, 120), 30)
- pixel = (49, 51)
- self.assertEqual(surf.get_at(pixel), (255, 255, 255, 255))
- surrounded_pixels_are_white(pixel)
- surf.fill((0, 0, 0))
- pygame.draw.line(surf, (255, 255, 255), (50, 50), (199, 198), 30)
- pixel = (51, 52)
- self.assertEqual(surf.get_at(pixel), (255, 255, 255, 255))
- surrounded_pixels_are_white(pixel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement