MCPcopy Index your code
hub / github.com/Textualize/textual / test_max

Function test_max

tests/test_box_model.py:146–166  ·  view source on GitHub ↗

Check that max_width and max_height are respected.

()

Source from the content-addressed store, hash-verified

144
145
146async def test_max():
147 """Check that max_width and max_height are respected."""
148 one = Fraction(1)
149
150 class TestWidget(Widget):
151 def get_content_width(self, container: Size, parent: Size) -> int:
152 assert False, "must not be called"
153
154 def get_content_height(self, container: Size, parent: Size, width: int) -> int:
155 assert False, "must not be called"
156
157 widget = TestWidget()
158 styles = widget.styles
159
160 styles.width = 100
161 styles.height = 80
162 styles.max_width = 40
163 styles.max_height = 30
164
165 box_model = widget._get_box_model(Size(40, 30), Size(80, 24), one, one)
166 assert box_model == BoxModel(Fraction(40), Fraction(30), Spacing(0, 0, 0, 0))
167
168
169async def test_min():

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…