Skip to content

Commit

Permalink
Specify font SourceHanSerifTC for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-seifert committed Nov 9, 2023
1 parent b6039ce commit e814dbf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/tests/test_painter.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@ def test_set_colour_theme(self):
def test_get_text_dimension(self):
painter = PNGPainter(100, 100)
text = "Hello World"
font = "Arial"
font = "../fonts/SourceHanSerifTC-Regular.otf"
font_size = 12
width, height = painter.get_text_dimension(text, font, font_size)
assert width > 0
assert height > 0

def test_get_text_dimension2(self):
painter = PNGPainter(800, 600)
text_width, text_height = painter.get_text_dimension("Hello World", "Arial", 12)
text_width, text_height = painter.get_text_dimension(
"Hello World",
"../fonts/SourceHanSerifTC-Regular.otf",
12,
)
print(f"text_width: {text_width}, text_height: {text_height}")
# Linux returns different text width
assert text_width in [62, 64]
Expand Down

0 comments on commit e814dbf

Please sign in to comment.