fix backwards rendering
Python CI / test (3.10) (push) Successful in 7m36s
Python CI / test (3.12) (push) Successful in 7m19s
Python CI / test (3.13) (push) Successful in 7m5s

This commit is contained in:
2025-11-09 15:56:00 +01:00
parent 73700baf87
commit 56c2c21021
3 changed files with 183 additions and 25 deletions
+8 -6
View File
@@ -790,13 +790,14 @@ class TestBidirectionalLayouter:
current_start = RenderingPosition(block_index=5)
target_end = RenderingPosition(block_index=10)
actual_end = RenderingPosition(block_index=12) # Overshot
actual_end = RenderingPosition(block_index=12) # Overshot (went too far)
adjusted = layouter._adjust_start_estimate(
current_start, target_end, actual_end)
# Should move start forward (increase block_index)
assert adjusted.block_index > current_start.block_index
# Overshot means we rendered too far forward
# So we need to start EARLIER (decrease block_index) to not go as far
assert adjusted.block_index < current_start.block_index
def test_adjust_start_estimate_undershot(self):
"""Test adjustment when forward render undershoots target."""
@@ -804,13 +805,14 @@ class TestBidirectionalLayouter:
current_start = RenderingPosition(block_index=5)
target_end = RenderingPosition(block_index=10)
actual_end = RenderingPosition(block_index=8) # Undershot
actual_end = RenderingPosition(block_index=8) # Undershot (didn't go far enough)
adjusted = layouter._adjust_start_estimate(
current_start, target_end, actual_end)
# Should move start backward (decrease block_index)
assert adjusted.block_index <= current_start.block_index
# Undershot means we didn't render far enough forward
# So we need to start LATER (increase block_index) to include more content
assert adjusted.block_index > current_start.block_index
def test_adjust_start_estimate_exact(self):
"""Test adjustment when forward render hits target exactly."""