Skip to content

Commit aea08b7

Browse files
committed
add test
1 parent 46924c2 commit aea08b7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_syntax.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,23 @@ def test_syntax_measure():
402402
assert code.__rich_measure__(console, console.options) == Measurement(3, 24)
403403

404404

405+
def test_background_color_override_includes_padding():
406+
"""Regression test for https://github.com/Textualize/rich/issues/3295"""
407+
408+
syntax = Syntax(
409+
"x = 1",
410+
lexer="python",
411+
padding=(1, 3),
412+
background_color="red",
413+
)
414+
result = render(syntax)
415+
print(repr(result))
416+
assert (
417+
result
418+
== "\x1b[41m \x1b[0m\n\x1b[41m \x1b[0m\x1b[38;2;248;248;242;41mx\x1b[0m\x1b[38;2;248;248;242;41m \x1b[0m\x1b[38;2;255;70;137;41m=\x1b[0m\x1b[38;2;248;248;242;41m \x1b[0m\x1b[38;2;174;129;255;41m1\x1b[0m\x1b[41m \x1b[0m\x1b[41m \x1b[0m\n\x1b[41m \x1b[0m\n"
419+
)
420+
421+
405422
if __name__ == "__main__":
406423
syntax = Panel.fit(
407424
Syntax(

0 commit comments

Comments
 (0)