diff --git a/rich/layout.py b/rich/layout.py index e54c92fe..0a88cf6b 100644 --- a/rich/layout.py +++ b/rich/layout.py @@ -185,7 +185,7 @@ class Layout: ) -> RenderResult: render_widths = ratio_resolve(options.max_width, self.children) renders = [ - console.render_lines(child.renderable, options.update(width=render_width)) + console.render_lines(child, options.update(width=render_width)) for child, render_width in zip(self.children, render_widths) ] new_line = Segment.line() diff --git a/tests/test_layout.py b/tests/test_layout.py index 1f5b60a2..e715d69b 100644 --- a/tests/test_layout.py +++ b/tests/test_layout.py @@ -22,6 +22,7 @@ def test_render(): top["asdasd"] layout["left"].update("foobar") + print(layout["left"].children) console = Console(width=60, color_system=None) diff --git a/tests/test_live.py b/tests/test_live.py index 1972e5b1..e86e187c 100644 --- a/tests/test_live.py +++ b/tests/test_live.py @@ -165,8 +165,8 @@ def test_live_screen() -> None: console = create_capture_console(width=20, height=5) console.begin_capture() with Live(Text("foo"), screen=True, console=console, auto_refresh=False) as live: - pass + live.refresh() result = console.end_capture() print(repr(result)) - expected = "\x1b[?1049h\x1b[H\x1b[?25l\x1b[Hfoo \n \n \n \n \n\x1b[?25h\x1b[?1049l" + expected = "\x1b[?1049h\x1b[H\x1b[?25l\x1b[Hfoo \n \n \n \n \x1b[?25h\x1b[?1049l" assert result == expected diff --git a/tests/test_screen.py b/tests/test_screen.py new file mode 100644 index 00000000..69a2e270 --- /dev/null +++ b/tests/test_screen.py @@ -0,0 +1,12 @@ +from rich.console import Console +from rich.screen import Screen + + +def test_screen(): + console = Console(color_system=None, width=20, height=5) + with console.capture() as capture: + console.print(Screen("foo\nbar\nbaz\nfoo\nbar\nbaz\foo")) + result = capture.get() + print(repr(result)) + expected = "foo \nbar \nbaz \nfoo \nbar " + assert result == expected \ No newline at end of file