"""Regression checks for the user-visible Korin Timer product name."""

from pathlib import Path
import unittest


ROOT = Path(__file__).resolve().parents[1]


class BrandingTests(unittest.TestCase):
    def test_desktop_entry_uses_korin_timer(self) -> None:
        desktop_entry = (ROOT / "packaging" / "korin-timer.desktop").read_text()

        self.assertIn("Name=Korin Timer", desktop_entry)
        self.assertIn("Comment=2-step title switching timer for Elsword", desktop_entry)

    def test_appimage_has_korin_timer_filename(self) -> None:
        build_script = (ROOT / "packaging" / "build-appimage.sh").read_text()

        self.assertIn('OUT="${BUILD_DIR}/Korin-Timer.AppImage"', build_script)

    def test_settings_titles_use_korin_timer(self) -> None:
        translations = (ROOT / "src" / "titletimer" / "i18n.py").read_text()

        self.assertIn('"settings_title": {"de": "Korin Timer - Einstellungen",', translations)
        self.assertIn('"en": "Korin Timer - Settings"}', translations)

    def test_gtk_application_ids_use_korin_timer(self) -> None:
        main_module = (ROOT / "src" / "titletimer" / "__main__.py").read_text()

        self.assertIn('application_id="dev.korintimer.settings"', main_module)
        self.assertIn('application_id="dev.korintimer.overlay"', main_module)


if __name__ == "__main__":
    unittest.main()
