diff options
Diffstat (limited to 'app/tests/test_hub.py')
| -rw-r--r-- | app/tests/test_hub.py | 32 |
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"]} |
