skywalker-1/tui/tests/test_splash.py
Ryan Malloy bbdcb243dc Normalize line endings to LF across entire repository
Apply .gitattributes normalization to convert all CRLF line
endings inherited from Windows-origin source files to Unix LF.
175 files, zero content changes.
2026-02-20 10:55:50 -07:00

49 lines
1.8 KiB
Python

"""Tests for the splash screen art catalog and selection."""
from skywalker_tui.screens.splash import SplashScreen, ASSETS_DIR, ART_CATALOG
class TestSplashArtCatalog:
"""Verify bundled pre-baked .ans art assets exist and catalog is consistent."""
def test_assets_dir_exists(self):
assert ASSETS_DIR.is_dir(), f"Assets dir missing: {ASSETS_DIR}"
def test_all_catalog_entries_have_ans_files(self):
missing = []
for stem, artist, title in ART_CATALOG:
path = ASSETS_DIR / f"{stem}.ans"
if not path.exists():
missing.append(f"{stem}.ans")
assert not missing, f"Missing pre-baked .ans files: {missing}"
def test_catalog_has_entries(self):
assert len(ART_CATALOG) >= 1
def test_ans_files_not_empty(self):
for stem, _, _ in ART_CATALOG:
path = ASSETS_DIR / f"{stem}.ans"
if path.exists():
assert path.stat().st_size > 0, f"{stem}.ans is empty"
def test_ans_files_contain_ansi_escapes(self):
"""Pre-baked files should contain ANSI color escape sequences."""
for stem, _, _ in ART_CATALOG:
path = ASSETS_DIR / f"{stem}.ans"
if path.exists():
content = path.read_text()
assert "\033[" in content, f"{stem}.ans has no ANSI escapes"
assert "\u2580" in content, f"{stem}.ans has no half-block chars"
class TestSplashScreenInit:
"""Test SplashScreen construction (no app needed)."""
def test_selects_art_on_init(self):
screen = SplashScreen()
assert screen._ans_path is not None or len(ART_CATALOG) == 0
if screen._ans_path:
assert screen._ans_path.exists()
assert screen._artist != ""
assert screen._title != ""