fix to use same font in CI and local tests
Python CI / test (push) Failing after 4m7s

This commit is contained in:
2025-06-08 17:10:47 +02:00
parent c28cd0e6ea
commit a014de854e
2 changed files with 27 additions and 12 deletions
+6 -8
View File
@@ -133,7 +133,7 @@ class TestMultilineRendering(unittest.TestCase):
def test_three_line_sentence(self):
"""Test sentence that should wrap to three lines"""
sentence = "This is a much longer sentence that contains many more words and should definitely wrap across three lines when rendered with the specified width constraints."
line_width = 180
line_width = 280
actual_lines, lines, combined_image = self._create_multiline_test(
sentence, line_width, 25, font_size=12
@@ -144,16 +144,15 @@ class TestMultilineRendering(unittest.TestCase):
combined_image.save(filename)
self.test_images.append(filename)
# Assertions - Allow for font variations across environments
# Different fonts can cause different text widths and line wrapping behavior
# Assertions
self.assertGreaterEqual(actual_lines, 2, "Should have at least two lines")
self.assertLessEqual(actual_lines, 8, "Should not exceed 8 lines for this sentence (allowing for font variations)")
self.assertLessEqual(actual_lines, 5, "Should not exceed 5 lines for this sentence")
self.assertTrue(os.path.exists(filename), "Test image should be created")
def test_four_line_sentence(self):
"""Test sentence that should wrap to four lines"""
sentence = "Here we have an even longer sentence with significantly more content that will require four lines to properly display all the text when using the constrained width setting."
line_width = 160
line_width = 200
actual_lines, lines, combined_image = self._create_multiline_test(
sentence, line_width, 25, font_size=12
@@ -164,10 +163,9 @@ class TestMultilineRendering(unittest.TestCase):
combined_image.save(filename)
self.test_images.append(filename)
# Assertions - Allow for font variations across environments
# Different fonts can cause different text widths and line wrapping behavior
# Assertions
self.assertGreaterEqual(actual_lines, 3, "Should have at least three lines")
self.assertLessEqual(actual_lines, 9, "Should not exceed 9 lines for this sentence (allowing for font variations)")
self.assertLessEqual(actual_lines, 6, "Should not exceed 6 lines for this sentence")
self.assertTrue(os.path.exists(filename), "Test image should be created")
def test_single_line_sentence(self):