Files
VIctory-xmem/launcher/tests/test_settings_catalog.py
Tim-van-Oudheusden ef4dcd6c7d feat(launcher): add saves folder shortcut and fix below-4K HUD guidance
Add an Open Folder button (and primary menu action) on Play & Status to
open local/data/7952987A/saves/0009000000000001/00000000-0000-0000-0000-00007952987a
in the host file manager (creating it if missing so saves can be imported
before first launch).

Fix Separate 4K HUD Plane (VICTORY_UI_PLANE) guidance:
- Replace the misleading Default (Auto) label with Default (Off) because
  unset VICTORY_UI_PLANE only activates at 1080p without host FSR.
- Show a one-click Enable 4K HUD banner in Game Settings whenever output is
  below 4K without VICTORY_UI_PLANE=3840x2160.
- Recommend VICTORY_UI_PLANE=3840x2160 in Hardware & Tuning for below-4K
  display profiles.

Verified with 34/34 launcher unit tests, Flatpak bundle rebuild, and
--smoke with zero warnings.
2026-12-06 02:15:40 +01:00

75 lines
3.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Verify curated plain-English settings catalog covers the real repo `run.conf.default`."""
from __future__ import annotations
import unittest
from pathlib import Path
from victory_launcher.core.run_conf import SettingDef, parse_defaults
from victory_launcher.core.settings_catalog import (
GROUP_ORDER,
build_display_settings,
group_display_settings,
)
REPO_ROOT = Path(__file__).resolve().parents[2]
class SettingsCatalogTests(unittest.TestCase):
def test_all_repo_defaults_have_plain_english_metadata(self) -> None:
defs = parse_defaults((REPO_ROOT / "run.conf.default").read_text(encoding="utf-8"))
display = build_display_settings(defs)
self.assertEqual(len(display), len(defs))
for item in display:
self.assertIn(item.group, GROUP_ORDER)
self.assertTrue(item.title, f"Empty title for {item.key}")
self.assertNotEqual(
item.title,
item.key,
f"Expected human-readable title rather than raw env var for {item.key}",
)
self.assertGreater(len(item.summary), 15, f"Summary too short for {item.key}")
short_def = item.short_label_for(None)
self.assertTrue(short_def, f"Empty short default label for {item.key}")
self.assertLessEqual(
len(short_def),
32,
f"Short default label too long for {item.key}: {short_def!r}",
)
for choice in item.choices:
short_val = item.short_label_for(choice)
self.assertTrue(short_val, f"Empty short choice label for {item.key}={choice}")
self.assertLessEqual(
len(short_val),
32,
f"Short choice label too long for {item.key}={choice}: {short_val!r}",
)
grouped = group_display_settings(display)
self.assertEqual(sum(len(items) for _, items in grouped), len(display))
ui_plane = next(item for item in display if item.key == "VICTORY_UI_PLANE")
self.assertEqual(ui_plane.short_label_for(None), "Default (Off)")
self.assertNotIn("Auto", ui_plane.label_for(None))
self.assertEqual(ui_plane.short_label_for("3840x2160"), "On (3840×2160)")
def test_unknown_future_setting_falls_back_gracefully(self) -> None:
future = SettingDef(
name="VICTORY_BRAND_NEW_SWITCH",
label="Brand new switch",
group="Performance",
help_text="Speeds up something new. Changes the shader cache key.",
choices=("0", "1"),
default="0",
)
display = build_display_settings([future])
self.assertEqual(len(display), 1)
self.assertEqual(display[0].title, "Brand new switch")
self.assertEqual(display[0].group, "Performance & Memory")
self.assertTrue(display[0].rewarms_pipelines)
self.assertEqual(display[0].label_for("1"), "On (1)")
if __name__ == "__main__":
unittest.main()