from pathlib import Path from hyprsunset_qt.settings import Settings def test_defaults_created_on_first_run(tmp_path): path = tmp_path / "config" s = Settings.load(path) assert path.exists() assert s.auto_detect is True assert s.daemon_command == "hyprsunset" def test_roundtrip_and_tilde_expansion(tmp_path): path = tmp_path / "config" s = Settings.load(path) s.lat = "45.07" s.lon = "7.68" s.auto_detect = False s.cache_path = "~/somewhere/sun.json" s.save(path) s2 = Settings.load(path) assert s2.lat == "45.07" assert s2.lon == "7.68" assert s2.auto_detect is False assert s2.cache_path_expanded() == Path.home() / "somewhere" / "sun.json"