@@ -127,18 +127,26 @@ class TestDocumentLayouter:
|
||||
|
||||
@patch('pyWebLayout.layout.document_layouter.ConcreteStyleRegistry')
|
||||
@patch('pyWebLayout.layout.document_layouter.Line')
|
||||
def test_paragraph_layouter_line_overflow(self, mock_line_class, mock_style_registry_class):
|
||||
@patch('pyWebLayout.layout.document_layouter.Text')
|
||||
def test_paragraph_layouter_line_overflow(self, mock_text_class, mock_line_class, mock_style_registry_class):
|
||||
"""Test handling of line overflow when words don't fit."""
|
||||
# Setup mocks
|
||||
mock_style_registry = Mock()
|
||||
mock_style_registry_class.return_value = mock_style_registry
|
||||
mock_style_registry.get_concrete_style.return_value = self.mock_concrete_style
|
||||
|
||||
# Create two mock lines
|
||||
# Create two mock lines with proper size attribute
|
||||
mock_line1 = Mock()
|
||||
mock_line1.size = (400, 20) # (width, height)
|
||||
mock_line2 = Mock()
|
||||
mock_line2.size = (400, 20) # (width, height)
|
||||
mock_line_class.side_effect = [mock_line1, mock_line2]
|
||||
|
||||
# Mock Text.from_word to return mock text objects with numeric width
|
||||
mock_text = Mock()
|
||||
mock_text.width = 50 # Reasonable word width
|
||||
mock_text_class.from_word.return_value = mock_text
|
||||
|
||||
# First line: first 2 words fit, third doesn't
|
||||
# Second line: remaining words fit
|
||||
mock_line1.add_word.side_effect = [
|
||||
|
||||
Reference in New Issue
Block a user