fix(gui): use loaded fonts in gui tests, to be consistent across OS by eruvanos · Pull Request #2416 · pythonarcade/arcade · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions arcade/examples/gui/6_size_hints.py
6 changes: 6 additions & 0 deletions arcade/gui/widgets/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,8 @@ class UITextArea(UIWidget):
success.
font_size: Font size of font.
text_color: Color of the text.
bold: If enabled, the label's text will be in a **bold** style.
italic: If enabled, the label's text will be in an *italic*
multiline: If enabled, a ``\\n`` will start a new line.
scroll_speed: Speed of mouse scrolling.
size_hint: A tuple of floats between 0 and 1 defining the amount
Expand All @@ -650,6 +652,8 @@ def __init__(
text: str = "",
font_name=("arial", "calibri"),
font_size: float = 12,
bold=False,
italic=False,
text_color: RGBA255 = arcade.color.WHITE,
multiline: bool = True,
scroll_speed: Optional[float] = None,
Expand Down Expand Up @@ -689,6 +693,8 @@ def __init__(
font_name=font_name,
font_size=font_size,
color=Color.from_iterable(text_color),
bold=bold,
italic=italic,
),
)

Expand Down
2 changes: 2 additions & 0 deletions arcade/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def __init__(
batch: pyglet.graphics.Batch | None = None,
group: pyglet.graphics.Group | None = None,
z: float = 0,
**kwargs,
):
# Raises a RuntimeError if no window for better user feedback
arcade.get_window()
Expand Down Expand Up @@ -255,6 +256,7 @@ def __init__(
rotation=rotation, # type: ignore # pending https://github.com/pyglet/pyglet/issues/843
batch=batch,
group=group,
**kwargs,
)

def __enter__(self):
Expand Down
8 changes: 5 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
WINDOW = None
OFFSCREEN = None

arcade.resources.load_system_fonts()

def make_window_caption(request=None, prefix='Testing', sep=' - ') -> str:

def make_window_caption(request=None, prefix="Testing", sep=" - ") -> str:
"""Centralizes test name customization.

It helps with:
Expand Down Expand Up @@ -179,11 +181,11 @@ def size(self):
@size.setter
def size(self, size):
self.window.size = size

@property
def center_x(self):
return self.window.center_x

@property
def center_y(self):
return self.window.center_y
Expand Down
50 changes: 25 additions & 25 deletions tests/unit/gui/test_uilabel.py