Wallpaper-Support via moongreet.toml, Astronauten-SVG als Default-Avatar mit dynamischer Theme-Farbe, CSS auf GTK-Theme-Farben umgestellt, konsistentes Widget-Spacing, Custom-Icon-Registrierung.
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
# ABOUTME: Tests for configuration loading from moongreet.toml.
|
|
# ABOUTME: Verifies parsing of appearance and behavior settings.
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from moongreet.config import load_config, Config
|
|
|
|
|
|
class TestLoadConfig:
|
|
"""Tests for loading moongreet.toml configuration."""
|
|
|
|
def test_loads_background_path(self, tmp_path: Path) -> None:
|
|
toml_file = tmp_path / "moongreet.toml"
|
|
toml_file.write_text(
|
|
"[appearance]\n"
|
|
'background = "/usr/share/backgrounds/test.jpg"\n'
|
|
)
|
|
|
|
config = load_config(toml_file)
|
|
|
|
assert config.background == Path("/usr/share/backgrounds/test.jpg")
|
|
|
|
def test_returns_none_background_when_missing(self, tmp_path: Path) -> None:
|
|
toml_file = tmp_path / "moongreet.toml"
|
|
toml_file.write_text("[appearance]\n")
|
|
|
|
config = load_config(toml_file)
|
|
|
|
assert config.background is None
|
|
|
|
def test_returns_defaults_for_missing_file(self, tmp_path: Path) -> None:
|
|
config = load_config(tmp_path / "nonexistent.toml")
|
|
|
|
assert config.background is None
|
|
|
|
def test_resolves_relative_path_against_config_dir(self, tmp_path: Path) -> None:
|
|
toml_file = tmp_path / "moongreet.toml"
|
|
toml_file.write_text(
|
|
"[appearance]\n"
|
|
'background = "wallpaper.jpg"\n'
|
|
)
|
|
|
|
config = load_config(toml_file)
|
|
|
|
assert config.background == tmp_path / "wallpaper.jpg"
|