Skip to content

Commit 0f7db6e

Browse files
committed
Adjust code to Andrew Coffeey's reviews.
1 parent a975224 commit 0f7db6e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

buildconfig/stubs/pygame/font.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class Font:
5858
def point_size(self, value: int) -> None: ...
5959
@property
6060
def outline(self) -> int: ...
61+
@outline.setter
62+
def outline(self, value: int) -> None: ...
6163
def __init__(self, filename: Optional[FileArg] = None, size: int = 20) -> None: ...
6264
def render(
6365
self,

src_c/font.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,8 @@ font_setter_outline(PyObject *self, PyObject *value, void *closure)
842842
DEL_ATTR_NOT_SUPPORTED_CHECK("outline", value);
843843

844844
val = PyLong_AsLong(value);
845+
if ((val == -1) && (PyErr_Occurred() != NULL))
846+
return -1;
845847

846848
TTF_SetFontOutline(font, val);
847849
return 0;

test/font_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,7 @@ def test_font_property_should_raise_exception_after_quit(self):
981981
("italic", True),
982982
("underline", True),
983983
("strikethrough", True),
984+
("outline", 2006),
984985
]
985986
skip_properties = set()
986987
version = pygame.font.get_sdl_ttf_version()
@@ -992,10 +993,6 @@ def test_font_property_should_raise_exception_after_quit(self):
992993
properties.append(("point_size", 1))
993994
else:
994995
skip_properties.add("point_size")
995-
if version >= (2, 0, 12):
996-
properties.append(("outline", 2006))
997-
else:
998-
skip_properties.add("outline")
999996

1000997
font = pygame_font.Font(None, 10)
1001998
actual_names = []

0 commit comments

Comments
 (0)