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
from __future__ import annotations
from pygittools.tui.git_colors import init_tui_color_theme, status_bar_attr
from pygittools.tui.status_bar import _format_line, content_height, draw_status_bar
def test_content_height_reserves_status_row() -> None:
assert content_height(10) == 9
assert content_height(0) == 0
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_draw_status_bar_skips_zero_width() -> None:
draw_status_bar(0, 0, "x", 0)
def test_status_bar_attr_after_init() -> None:
init_tui_color_theme(None)
assert status_bar_attr() != 0