From 366ac953f204aceb2e207242f9d95246f22e224e Mon Sep 17 00:00:00 2001 From: Felix Seifert Date: Thu, 9 Nov 2023 23:20:26 +0100 Subject: [PATCH] Specify font `SourceHanSerifTC` for testing --- src/tests/test_painter.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/tests/test_painter.py b/src/tests/test_painter.py index 8d455e7..33db5a1 100644 --- a/src/tests/test_painter.py +++ b/src/tests/test_painter.py @@ -53,7 +53,7 @@ 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 @@ -61,8 +61,12 @@ def test_get_text_dimension(self): 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] - assert text_height == 11 + assert text_width in [71, 73] + assert text_height == 14