| 33 | |
| 34 | @pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows") |
| 35 | def test_render(): |
| 36 | layout = Layout(name="root") |
| 37 | repr(layout) |
| 38 | |
| 39 | layout.split_column(Layout(name="top"), Layout(name="bottom")) |
| 40 | top = layout["top"] |
| 41 | top.update(Panel("foo")) |
| 42 | |
| 43 | print(type(top._renderable)) |
| 44 | assert isinstance(top.renderable, Panel) |
| 45 | layout["bottom"].split_row(Layout(name="left"), Layout(name="right")) |
| 46 | |
| 47 | assert layout["root"].name == "root" |
| 48 | assert layout["left"].name == "left" |
| 49 | |
| 50 | assert isinstance(layout.map, dict) |
| 51 | |
| 52 | with pytest.raises(KeyError): |
| 53 | top["asdasd"] |
| 54 | |
| 55 | layout["left"].update("foobar") |
| 56 | print(layout["left"].children) |
| 57 | |
| 58 | console = Console(width=60, color_system=None) |
| 59 | |
| 60 | with console.capture() as capture: |
| 61 | console.print(layout, height=10) |
| 62 | |
| 63 | result = capture.get() |
| 64 | print(repr(result)) |
| 65 | expected = "╭──────────────────────────────────────────────────────────╮\n│ foo │\n│ │\n│ │\n╰──────────────────────────────────────────────────────────╯\nfoobar ╭───── 'right' (30 x 5) ─────╮\n │ │\n │ Layout(name='right') │\n │ │\n ╰────────────────────────────╯\n" |
| 66 | |
| 67 | assert result == expected |
| 68 | |
| 69 | |
| 70 | def test_tree(): |