mirror of https://github.com/Textualize/rich.git
test fixes
This commit is contained in:
parent
da69cff49f
commit
60f41610cd
|
@ -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()
|
||||
|
|
|
@ -22,6 +22,7 @@ def test_render():
|
|||
top["asdasd"]
|
||||
|
||||
layout["left"].update("foobar")
|
||||
print(layout["left"].children)
|
||||
|
||||
console = Console(width=60, color_system=None)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue