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

Function test_min

tests/test_box_model.py:169–189  ·  view source on GitHub ↗

Check that min_width and min_height are respected.

()

Source from the content-addressed store, hash-verified

167
168
169async def test_min():
170 """Check that min_width and min_height are respected."""
171
172 one = Fraction(1)
173
174 class TestWidget(Widget):
175 def get_content_width(self, container: Size, parent: Size) -> int:
176 assert False, "must not be called"
177
178 def get_content_height(self, container: Size, parent: Size, width: int) -> int:
179 assert False, "must not be called"
180
181 widget = TestWidget()
182 styles = widget.styles
183 styles.width = 10
184 styles.height = 5
185 styles.min_width = 40
186 styles.min_height = 30
187
188 box_model = widget._get_box_model(Size(40, 30), Size(80, 24), one, one)
189 assert box_model == BoxModel(Fraction(40), Fraction(30), Spacing(0, 0, 0, 0))

Callers

nothing calls this directly

Calls 5

SizeClass · 0.90
BoxModelClass · 0.90
SpacingClass · 0.90
_get_box_modelMethod · 0.80
TestWidgetClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…