|
| 1 | +import itertools |
1 | 2 | import math
|
2 | 3 | import sys
|
3 | 4 | import unittest
|
4 | 5 | import warnings
|
5 |
| -import itertools |
6 | 6 |
|
7 | 7 | import pygame
|
8 | 8 | from pygame import draw
|
@@ -7361,34 +7361,40 @@ def test_flood_circle(self):
|
7361 | 7361 | """Ensures flood fill doesn't overdraw"""
|
7362 | 7362 | surf = pygame.Surface((100, 100))
|
7363 | 7363 | surf.fill((0, 0, 0))
|
7364 |
| - pygame.draw.circle(surf, (255,0,255), (50,50), 40, 2) |
7365 |
| - pygame.draw.flood_fill(surf, (255,255,255), (10, 50)) |
| 7364 | + pygame.draw.circle(surf, (255, 0, 255), (50, 50), 40, 2) |
| 7365 | + pygame.draw.flood_fill(surf, (255, 255, 255), (10, 50)) |
7366 | 7366 |
|
7367 | 7367 | surf2 = pygame.Surface((100, 100))
|
7368 | 7368 | surf2.fill((0, 0, 0))
|
7369 |
| - pygame.draw.circle(surf2, (255,255,255), (50,50), 40, 2) |
| 7369 | + pygame.draw.circle(surf2, (255, 255, 255), (50, 50), 40, 2) |
7370 | 7370 |
|
7371 | 7371 | for pt in itertools.product(range(100), range(100)):
|
7372 | 7372 | self.assertEqual(surf.get_at(pt), surf2.get_at(pt))
|
7373 | 7373 |
|
7374 | 7374 | surf = pygame.Surface((100, 100))
|
7375 | 7375 | surf.fill((0, 0, 0))
|
7376 |
| - pygame.draw.circle(surf, (255,0,255), (50,50), 40, 1) |
| 7376 | + pygame.draw.circle(surf, (255, 0, 255), (50, 50), 40, 1) |
7377 | 7377 | # fill outside of circle white
|
7378 |
| - pygame.draw.flood_fill(surf, (255,255,255), (1,1)) |
| 7378 | + pygame.draw.flood_fill(surf, (255, 255, 255), (1, 1)) |
7379 | 7379 | # fill inside red
|
7380 |
| - pygame.draw.flood_fill(surf, (255,0,0), (50,50)) |
| 7380 | + pygame.draw.flood_fill(surf, (255, 0, 0), (50, 50)) |
7381 | 7381 |
|
7382 | 7382 | surf2 = pygame.Surface((100, 100))
|
7383 |
| - surf2.fill((255,255,255)) |
| 7383 | + surf2.fill((255, 255, 255)) |
7384 | 7384 | # draw filled circle red
|
7385 |
| - pygame.draw.circle(surf2, (255,0,0), (50,50), 40) |
7386 |
| - # fill circle hot pink |
7387 |
| - pygame.draw.circle(surf2, (255,0,255), (50,50), 40, 1) |
| 7385 | + pygame.draw.circle(surf2, (255, 0, 0), (50, 50), 40) |
| 7386 | + # draw outer edge circle hot pink |
| 7387 | + pygame.draw.circle(surf2, (255, 0, 255), (50, 50), 40, 1) |
| 7388 | + |
| 7389 | + # both should be identical: white outside, thin pink line, red inside |
| 7390 | + # no black pixels missed, no spillover between inside and outside |
| 7391 | + # This assumes circle drawing works correctly: |
| 7392 | + # if circle is broken, this may or may not fail |
7388 | 7393 |
|
7389 | 7394 | for pt in itertools.product(range(100), range(100)):
|
7390 | 7395 | self.assertEqual(surf.get_at(pt), surf2.get_at(pt))
|
7391 | 7396 |
|
| 7397 | + |
7392 | 7398 | ### Draw Module Testing #######################################################
|
7393 | 7399 |
|
7394 | 7400 |
|
|
0 commit comments