mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add test for line crop issue
This commit is contained in:
8
tests/test_input.py
Normal file
8
tests/test_input.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from textual.widgets._input import _InputRenderable, Input
|
||||
|
||||
|
||||
def test_input_renderable():
|
||||
input_widget = Input(value="a1あ11bcdaef123a1a")
|
||||
|
||||
renderable_cursor = _InputRenderable(input_widget, cursor_visible=True)
|
||||
renderable_no_cursor = _InputRenderable(input_widget, cursor_visible=False)
|
||||
@@ -63,6 +63,17 @@ def test_line_crop_edge_2():
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_line_crop_highlight_reverse_bug():
|
||||
"""Regression test for #818"""
|
||||
segments_joined = [Segment('a1あ11bcdaef123a1a')]
|
||||
segments_split = [Segment('a1あ11bcdaef'), Segment('1'), Segment('23a1a')]
|
||||
|
||||
joined1 = "".join(seg.text for seg in line_crop(segments_split, start=9, end=16, total=23))
|
||||
joined2 = "".join(seg.text for seg in line_crop(segments_joined, start=9, end=16, total=23))
|
||||
|
||||
assert joined1 == joined2
|
||||
|
||||
|
||||
def test_line_trim():
|
||||
segments = [Segment("foo")]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user