diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_richlog_shrink.svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_richlog_shrink.svg new file mode 100644 index 0000000000..7f00a1e742 --- /dev/null +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_richlog_shrink.svg @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + RichLogShrink + + + + + + + + + + ╭────────────────╮ +│ lorem ipsum    │ +│ dolor sit amet │ +│ lorem ipsum    │ +│ dolor sit amet │ +╰────────────────╯ + + + diff --git a/tests/snapshot_tests/test_snapshots.py b/tests/snapshot_tests/test_snapshots.py index d55d784b5e..f155687dd4 100644 --- a/tests/snapshot_tests/test_snapshots.py +++ b/tests/snapshot_tests/test_snapshots.py @@ -1,6 +1,8 @@ from pathlib import Path import pytest +from rich.panel import Panel +from rich.table import Table from rich.text import Text from tests.snapshot_tests.language_snippets import SNIPPETS @@ -637,6 +639,19 @@ def compose(self) -> ComposeResult: assert snap_compare(RichLogWidth(), terminal_size=(42, 6)) +def test_richlog_shrink(snap_compare): + class RichLogShrink(App[None]): + CSS = "RichLog { width: 20; background: red;}" + + def compose(self) -> ComposeResult: + rich_log = RichLog(min_width=4) + panel = Panel("lorem ipsum dolor sit amet lorem ipsum dolor sit amet") + rich_log.write(panel) + yield rich_log + + assert snap_compare(RichLogShrink(), terminal_size=(24, 6)) + + def test_tabs_invalidate(snap_compare): assert snap_compare( SNAPSHOT_APPS_DIR / "tabs_invalidate.py",