fixed issue with bounding box height being wrong
Python CI / test (3.10) (push) Has been cancelled
Python CI / test (3.12) (push) Has been cancelled
Python CI / test (3.13) (push) Has been cancelled

This commit is contained in:
2025-11-09 17:10:50 +01:00
parent 56c2c21021
commit 50b9aa5431
4 changed files with 56 additions and 13 deletions
+2 -2
View File
@@ -125,8 +125,8 @@ class TestLinkText(unittest.TestCase):
# Mock width property
renderable._width = 80
# Point inside link
self.assertTrue(renderable.in_object((15, 25)))
# Point inside link - origin is at baseline (10, 20), so test at baseline Y
self.assertTrue(renderable.in_object((15, 20)))
# Point outside link
self.assertFalse(renderable.in_object((200, 200)))
+7 -1
View File
@@ -76,8 +76,14 @@ class TestText(unittest.TestCase):
def test_in_object_true(self):
text_instance = Text(text="Test", style=self.style, draw=self.draw)
# Set origin at baseline position (50, 50)
text_instance.set_origin(np.array([50, 50]))
# Test with a point that should be inside the text bounds
point = (5, 5)
# The text origin is at the baseline (50, 50)
# Visual bounds are: top = 50 - ascent, bottom = 50 + descent
# So a point at (55, 50) should be inside (at baseline)
point = (55, 50)
self.assertTrue(text_instance.in_object(point))
def test_in_object_false(self):