Skip to content

Commit d440ba8

Browse files
Better explain test case on comments
1 parent 7012bdf commit d440ba8

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

test/draw_test.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import itertools
12
import math
23
import sys
34
import unittest
45
import warnings
5-
import itertools
66

77
import pygame
88
from pygame import draw
@@ -7361,34 +7361,40 @@ def test_flood_circle(self):
73617361
"""Ensures flood fill doesn't overdraw"""
73627362
surf = pygame.Surface((100, 100))
73637363
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))
73667366

73677367
surf2 = pygame.Surface((100, 100))
73687368
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)
73707370

73717371
for pt in itertools.product(range(100), range(100)):
73727372
self.assertEqual(surf.get_at(pt), surf2.get_at(pt))
73737373

73747374
surf = pygame.Surface((100, 100))
73757375
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)
73777377
# 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))
73797379
# 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))
73817381

73827382
surf2 = pygame.Surface((100, 100))
7383-
surf2.fill((255,255,255))
7383+
surf2.fill((255, 255, 255))
73847384
# 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
73887393

73897394
for pt in itertools.product(range(100), range(100)):
73907395
self.assertEqual(surf.get_at(pt), surf2.get_at(pt))
73917396

7397+
73927398
### Draw Module Testing #######################################################
73937399

73947400

0 commit comments

Comments
 (0)