aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_hub.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-27 15:53:22 -0400
committerhistoria <historiavg@proton.me>2026-08-27 15:53:22 -0400
commit2252a0e4ae86fcc71a58af99d63750adab54cabd (patch)
tree489a5e5d2124a831be31a69ee740ec4c260661e1 /app/tests/test_hub.py
parent5b98993b13dafe9a85495e4c68ad9b42863ef2bf (diff)
downloadtts-audiobook-generator-2252a0e4ae86fcc71a58af99d63750adab54cabd.tar.gz
feat: menu for language options
Diffstat (limited to 'app/tests/test_hub.py')
-rw-r--r--app/tests/test_hub.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/tests/test_hub.py b/app/tests/test_hub.py
index 439be26..7f16798 100644
--- a/app/tests/test_hub.py
+++ b/app/tests/test_hub.py
@@ -2186,6 +2186,35 @@ class SettingsTests(unittest.TestCase):
self.assertIsNotNone(hub._validate_port("70000"))
self.assertIsNotNone(hub._validate_port("abc"))
+ def test_language_fields_are_pickers_with_edit_hint(self):
+ # Both Language fields (Settings and Generate audiobooks) are
+ # static pickers over the audio.cpp-menu languages, with a dim
+ # hint inside their edit dialog. Common languages lead.
+ expected_choices = ["English", "Spanish", "Chinese", "French",
+ "German", "Italian", "Portuguese", "Japanese",
+ "Korean", "Russian", "Arabic", "Hindi",
+ "Vietnamese", "Auto"]
+ hint = hub._LANGUAGE_EDIT_HINT
+ self.assertEqual(hint,
+ ["Check model documentation for supported "
+ "languages."])
+
+ fields = hub._settings_fields()
+ field = next(f for f in fields if f["key"] == "language")
+ self.assertEqual(field["label"], "Default Language")
+ self.assertEqual(field["kind"], "choice")
+ self.assertEqual(field["choices"], expected_choices)
+ self.assertEqual(field["help"], hint)
+ self.assertEqual(field["value"], hub.config.LANGUAGE)
+
+ for gen_fields in (hub._common_fields(),):
+ field = next(f for f in gen_fields
+ if f["key"] == "language")
+ self.assertEqual(field["label"], "Language")
+ self.assertEqual(field["kind"], "choice")
+ self.assertEqual(field["choices"], expected_choices)
+ self.assertEqual(field["help"], hint)
+
def test_settings_menu_builds_form_and_saves(self):
captured = {}
@@ -2228,6 +2257,9 @@ class SettingsTests(unittest.TestCase):
self.assertEqual(labels["audiocpp_remote_url"],
"audio.cpp remote URL")
self.assertNotIn("(clone)", " ".join(labels.values()))
+ # The language setting is a picker labelled "Default Language".
+ self.assertEqual(labels["language"], "Default Language")
+ self.assertEqual(kinds["language"], "choice")
# The ports section note hangs off the first port field, the remote
# section note off the first remote URL field.
notes = {f["key"]: f.get("note") for f in captured["fields"]}