Check that max_width and max_height are respected.
()
| 144 | |
| 145 | |
| 146 | async 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 | |
| 169 | async def test_min(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…