1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from __future__ import annotations
from pygittools.tui.git_colors import init_tui_color_theme, status_bar_style
from pygittools.tui.status_bar import _format_line, split_content_status
from pyratatui import Rect, Style
from unittest.mock import MagicMock
from pygittools.tui.status_bar import render_status_bar
def test_split_content_status_reserves_row() -> None:
content, status = split_content_status(Rect(0, 0, 80, 10))
assert content.height == 9
assert status.height == 1
def test_format_line_with_hint() -> None:
line = _format_line("left text", "q quit", 40)
assert line.endswith("q quit")
assert "left" in line
def test_format_line_without_hint() -> None:
assert _format_line("hello", "", 10) == "hello "
def test_format_line_hint_wider_than_width() -> None:
line = _format_line("ignored", "longhint", 4)
assert line.strip() == "long"
def test_format_line_tight_width() -> None:
line = _format_line("left", "hint", 4)
assert len(line) == 4
def test_render_status_bar_skips_zero_width() -> None:
frame = MagicMock()
render_status_bar(frame, Rect(0, 0, 0, 1), "x", Style())
frame.render_widget.assert_not_called()
def test_status_bar_style_after_init() -> None:
init_tui_color_theme(None)
assert status_bar_style() is not None