fix backwards rendering
This commit is contained in:
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user