mirror of
https://github.com/Textualize/rich.git
synced 2025-07-24 12:53:58 +00:00
fix split cells
This commit is contained in:
parent
4101991898
commit
a8c3b8700b
3 changed files with 21 additions and 2 deletions
|
@ -2,6 +2,7 @@ from io import StringIO
|
|||
|
||||
import pytest
|
||||
|
||||
from rich.cells import cell_len
|
||||
from rich.segment import ControlType, Segment, SegmentLines, Segments
|
||||
from rich.style import Style
|
||||
|
||||
|
@ -284,6 +285,13 @@ def test_split_cells_emoji(text, split, result):
|
|||
assert Segment(text).split_cells(split) == result
|
||||
|
||||
|
||||
def test_split_cells_mixed() -> None:
|
||||
test = Segment("早乙女リリエル (CV: 徳井青)")
|
||||
for position in range(1, test.cell_length):
|
||||
left, right = Segment.split_cells(test, position)
|
||||
assert cell_len(left.text) == position
|
||||
|
||||
|
||||
def test_segment_lines_renderable():
|
||||
lines = [[Segment("hello"), Segment(" "), Segment("world")], [Segment("foo")]]
|
||||
segment_lines = SegmentLines(lines)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue