Skip to content

Commit f103594

Browse files
committed
Added commented test_reflowed_text_draft_panel_visible_char_coverage
1 parent 97a0318 commit f103594

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/data/display/panel/test_text_draft.py

+43
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,49 @@ def test_reflowed_text_draft_panel_variable_width_chars(
157157
)
158158

159159

160+
#
161+
# def test_reflowed_text_draft_panel_visible_char_coverage(
162+
# skip_test_if_not_default_data_config_values: Annotated[None, pytest.fixture]) -> None:
163+
# panel = ReflowedTextDraftPanel('', frame=Frame(Dimensions(width=6, height=3)))
164+
# assert panel.visible_char_coverage() == 0
165+
#
166+
# # Test without a frame
167+
# panel = ReflowedTextDraftPanel('Line 1\nLine 2\nLine 3',)
168+
# assert panel.visible_char_coverage() == 18
169+
#
170+
# # Ignore whitespace at beginning and end of line
171+
# panel = ReflowedTextDraftPanel(' Line 1\t\n Line 2 \n Line 3 ',)
172+
# assert panel.visible_char_coverage() == 18
173+
#
174+
# # Test with a frame that fits multiple lines of text
175+
# panel = ReflowedTextDraftPanel(
176+
# ' Line 1\t\n Line 2 \n Line 3 ', frame=Frame(Dimensions(width=6, height=3)))
177+
# assert panel.visible_char_coverage() == 18 # 6 chars per line * 3 lines
178+
#
179+
# # Test with a frame that truncates multi-line text vertically
180+
# panel = ReflowedTextDraftPanel(
181+
# ' Line 1\t\n Line 2 \n Line 3 ', frame=Frame(Dimensions(width=6, height=2)))
182+
# assert panel.visible_char_coverage() == 12 # 6 chars per line * 2 lines
183+
#
184+
# # Test with a frame that truncates multi-line text both horizontally and
185+
# # vertically
186+
# panel = ReflowedTextDraftPanel(
187+
# ' Line 1\t\n Line 2 \n Line 3 ', frame=Frame(Dimensions(width=5, height=2)))
188+
# assert panel.visible_char_coverage() == 12 # 6 chars per line * 2 lines
189+
#
190+
# # Test with Asian characters (double-width), rounding down
191+
# panel = ReflowedTextDraftPanel('\t北京欢迎你 ', frame=Frame(Dimensions(width=8, height=1)))
192+
# assert panel.visible_char_coverage() == 6 # 3 double-width chars (2 + 1)
193+
#
194+
# # Test with Asian characters and multiple lines
195+
# panel = ReflowedTextDraftPanel('北京欢\n 迎你\n 上海', frame=Frame(Dimensions(width=8, height=2)))
196+
# assert panel.visible_char_coverage() == 12 # 8 chars (line 1) + 4 chars (line 2)
197+
#
198+
# # Test with mixed content (Asian and English characters)
199+
# panel = ReflowedTextDraftPanel('Hello 北京', frame=Frame(Dimensions(width=10, height=1)))
200+
# assert panel.visible_char_coverage() == 10 # 5 English + 2 double-width Asian chars
201+
202+
160203
def test_reflowed_text_draft_panel_max_container_width_across_lines(
161204
skip_test_if_not_default_data_config_values: Annotated[None, pytest.fixture]) -> None:
162205

0 commit comments

Comments
 (0)