fixed issue with bounding box height being wrong
This commit is contained in:
@@ -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)))
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user