mirror of
https://github.com/Textualize/rich.git
synced 2025-12-23 07:08:35 +00:00
test(panel): add regression test for title with border color
It looks like there's a history of issues related to the panel border style, so add a test to prevent any regressions.
This commit is contained in:
parent
0c6c75644f
commit
69e1618f1f
1 changed files with 24 additions and 0 deletions
|
|
@ -124,6 +124,30 @@ def test_title_text() -> None:
|
|||
assert result == expected
|
||||
|
||||
|
||||
def test_title_text_with_border_color() -> None:
|
||||
"""Regression test for https://github.com/Textualize/rich/issues/2745"""
|
||||
panel = Panel(
|
||||
"Hello, World",
|
||||
border_style="blue",
|
||||
title=Text("title", style="red"),
|
||||
subtitle=Text("subtitle", style="magenta bold"),
|
||||
)
|
||||
console = Console(
|
||||
file=io.StringIO(),
|
||||
width=50,
|
||||
height=20,
|
||||
legacy_windows=False,
|
||||
force_terminal=True,
|
||||
color_system="truecolor",
|
||||
)
|
||||
console.print(panel)
|
||||
|
||||
result = console.file.getvalue()
|
||||
print(repr(result))
|
||||
expected = "\x1b[34m╭─\x1b[0m\x1b[34m───────────────────\x1b[0m\x1b[31m title \x1b[0m\x1b[34m────────────────────\x1b[0m\x1b[34m─╮\x1b[0m\n\x1b[34m│\x1b[0m Hello, World \x1b[34m│\x1b[0m\n\x1b[34m╰─\x1b[0m\x1b[34m──────────────────\x1b[0m\x1b[1;35m subtitle \x1b[0m\x1b[34m──────────────────\x1b[0m\x1b[34m─╯\x1b[0m\n"
|
||||
assert result == expected
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
expected = []
|
||||
for panel in tests:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue