MCPcopy
hub / github.com/Textualize/textual / test_crop

Function test_crop

tests/test_styles_cache.py:162–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

160
161
162def test_crop():
163 content = [
164 Strip([Segment("foo")]),
165 Strip([Segment("bar")]),
166 Strip([Segment("baz")]),
167 ]
168 styles = Styles()
169 styles.padding = 1
170 styles.border = ("heavy", "white")
171 cache = StylesCache()
172 lines = cache.render(
173 styles,
174 Size(7, 7),
175 Color.parse("blue"),
176 Color.parse("green"),
177 content.__getitem__,
178 [],
179 None,
180 None,
181 content_size=Size(3, 3),
182 crop=Region(2, 2, 3, 3),
183 )
184 text_content = _extract_content(lines)
185 expected_text = [
186 "foo",
187 "bar",
188 "baz",
189 ]
190 assert text_content == expected_text
191
192
193def test_dirty_cache() -> None:

Callers

nothing calls this directly

Calls 8

renderMethod · 0.95
StripClass · 0.90
StylesClass · 0.90
StylesCacheClass · 0.90
SizeClass · 0.90
RegionClass · 0.90
_extract_contentFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…