Skip to content

Commit

Permalink
Add snapshot test for RichLog.shrink
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Sep 10, 2024
1 parent 5ce0086 commit 6081380
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions tests/snapshot_tests/test_snapshots.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 6081380

Please sign in to comment.