Skip to content

Commit 13bf58c

Browse files
format
1 parent c2ccab3 commit 13bf58c

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

src_c/draw.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,8 @@ flood_fill(PyObject *self, PyObject *arg, PyObject *kwargs)
10451045
}
10461046
}
10471047

1048-
flood_fill_result = flood_fill_inner(surf, startx, starty, color, pattern, drawn_area);
1048+
flood_fill_result =
1049+
flood_fill_inner(surf, startx, starty, color, pattern, drawn_area);
10491050

10501051
if (pattern != NULL) {
10511052
SDL_FreeSurface(pattern);
@@ -1057,7 +1058,7 @@ flood_fill(PyObject *self, PyObject *arg, PyObject *kwargs)
10571058
}
10581059
}
10591060

1060-
if(flood_fill_result == -1){
1061+
if (flood_fill_result == -1) {
10611062
return RAISE(PyExc_RuntimeError, "flood fill allocation fail");
10621063
}
10631064

@@ -3145,7 +3146,7 @@ static PyMethodDef _draw_methods[] = {
31453146
{"ellipse", (PyCFunction)ellipse, METH_VARARGS | METH_KEYWORDS,
31463147
DOC_DRAW_ELLIPSE},
31473148
{"flood_fill", (PyCFunction)flood_fill, METH_VARARGS | METH_KEYWORDS,
3148-
DOC_DRAW_FLOODFILL},
3149+
DOC_DRAW_FLOODFILL},
31493150
{"arc", (PyCFunction)arc, METH_VARARGS | METH_KEYWORDS, DOC_DRAW_ARC},
31503151
{"circle", (PyCFunction)circle, METH_VARARGS | METH_KEYWORDS,
31513152
DOC_DRAW_CIRCLE},

test/draw_test.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6312,41 +6312,47 @@ class to add any draw.arc specific tests to.
63126312

63136313

63146314
class DrawFloodFillMixin(unittest.TestCase):
6315-
"""Mixin tests for flood fill.
6316-
"""
6315+
"""Mixin tests for flood fill."""
63176316

63186317
def test_flood_fill(self):
63196318
"""Ensures flood fill fills with solid color"""
63206319
surf = pygame.Surface((100, 100))
6321-
surf.fill((0,0,0))
6322-
6323-
pygame.draw.line (surf, (255,0,0), (10,10), (90,90), 5)
6320+
surf.fill((0, 0, 0))
63246321

6325-
self.assertEqual(surf.get_at((10,10)), (255,0,0), "line drawing precondition")
6326-
self.assertEqual(surf.get_at((90,90)), (255,0,0), "line drawing precondition")
6322+
pygame.draw.line(surf, (255, 0, 0), (10, 10), (90, 90), 5)
63276323

6328-
pygame.draw.flood_fill(surf, (255,255,255), (90, 90))
6324+
self.assertEqual(
6325+
surf.get_at((10, 10)), (255, 0, 0), "line drawing precondition"
6326+
)
6327+
self.assertEqual(
6328+
surf.get_at((90, 90)), (255, 0, 0), "line drawing precondition"
6329+
)
63296330

6330-
self.assertEqual(surf.get_at((90,90)), (255,255,255), "flood fill start point")
6331-
self.assertEqual(surf.get_at((10,10)), (255,255,255), "flood fill reaching the end")
6331+
pygame.draw.flood_fill(surf, (255, 255, 255), (90, 90))
63326332

6333+
self.assertEqual(
6334+
surf.get_at((90, 90)), (255, 255, 255), "flood fill start point"
6335+
)
6336+
self.assertEqual(
6337+
surf.get_at((10, 10)), (255, 255, 255), "flood fill reaching the end"
6338+
)
63336339

63346340
def test_flood_pattern(self):
63356341
"""Ensures flood fill fills in a pattern"""
63366342
surf = pygame.Surface((100, 100))
6337-
surf.fill((0,0,0))
6343+
surf.fill((0, 0, 0))
63386344

63396345
pattern = pygame.Surface((2, 2))
6340-
pattern.fill((255,255,255))
6341-
pattern.set_at((0,0), (255,0,0))
6342-
pattern.set_at((1,1), (0,0,255))
6346+
pattern.fill((255, 255, 255))
6347+
pattern.set_at((0, 0), (255, 0, 0))
6348+
pattern.set_at((1, 1), (0, 0, 255))
63436349

6344-
pygame.draw.line (surf, (0,0,0), (5,95), (95,5))
6345-
pygame.draw.line (surf, (0,0,0), (50, 0), (50,95))
6350+
pygame.draw.line(surf, (0, 0, 0), (5, 95), (95, 5))
6351+
pygame.draw.line(surf, (0, 0, 0), (50, 0), (50, 95))
63466352

63476353
pygame.draw.flood_fill(surf, pattern, (95, 95))
63486354

6349-
for pt in [(0,0),(0,1),(1,0),(1,1)]:
6355+
for pt in [(0, 0), (0, 1), (1, 0), (1, 1)]:
63506356
self.assertEqual(surf.get_at(pt), pattern.get_at(pt), pt)
63516357

63526358

0 commit comments

Comments
 (0)