aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_hub.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/tests/test_hub.py')
-rw-r--r--app/tests/test_hub.py40
1 files changed, 34 insertions, 6 deletions
diff --git a/app/tests/test_hub.py b/app/tests/test_hub.py
index ebae82b..794faf2 100644
--- a/app/tests/test_hub.py
+++ b/app/tests/test_hub.py
@@ -209,7 +209,7 @@ class HubMenuTests(unittest.TestCase):
labels = [label for label, _ in captured["options"]]
self.assertEqual(
labels,
- ["Convert books", "Configure backends",
+ ["Generate audiobooks", "Configure backends",
"Start/Stop Backend Servers", "Settings", "Quit"])
# The status table is passed through, one row per backend.
self.assertEqual(captured["rows"],
@@ -256,7 +256,8 @@ class HubMenuTests(unittest.TestCase):
labels = [label for label, _ in captured["options"]]
self.assertEqual(
labels,
- ["Convert books", "Configure backends", "Settings", "Quit"])
+ ["Generate audiobooks", "Configure backends", "Settings",
+ "Quit"])
def test_ffmpeg_warning_shown_when_missing(self):
# ffmpeg not on PATH → a red notice is passed above the table.
@@ -529,7 +530,7 @@ class SubmenuStatusTableTests(unittest.TestCase):
patch.object(hub.shutil, "which", return_value="/x"):
result = hub._Hub(None).screen_convert()
self.assertIs(result, tui.Wizard.BACK)
- self.assertEqual(captured["title"], "Convert books")
+ self.assertEqual(captured["title"], "Generate audiobooks")
# One form, no picker menu: the first field is the Backend picker,
# and only convertible backends are offered in it.
self.assertEqual(captured["fields"][0]["key"], "backend")
@@ -742,7 +743,7 @@ class ConvertFlowTests(unittest.TestCase):
# One form, not a cascade of menus/editors.
self.assertEqual(len(self.tui.forms_seen), 1)
title, fields, form_kwargs = self.tui.forms_seen[0]
- self.assertEqual(title, "Convert books")
+ self.assertEqual(title, "Generate audiobooks")
self.assertEqual([f["key"] for f in fields],
["backend", "model_id", "audiocpp_voice",
"instructions", "output_format", "speed",
@@ -757,9 +758,36 @@ class ConvertFlowTests(unittest.TestCase):
# The backend field offers the remote entry under a [remote] label.
self.assertEqual(fields[0]["choices"],
[("audio.cpp [remote]", "audiocpp-remote")])
- # The model menu was fed from the live query (label, id).
+ # The model menu was fed from the live query (label, id); ids are
+ # padded so the type column lines up across entries.
self.assertEqual(self._field("model_id")["choices"],
- [("higgs (higgs_audio_tts, clone)", "higgs")])
+ [("higgs (clone)", "higgs")])
+
+ def test_model_menu_lines_the_type_column_up(self):
+ # Ids are padded to the widest id: every (type) starts on the same
+ # column, so the picker reads as a two-column table.
+ self._patch_remote(
+ [{"id": "short", "family": "higgs_audio_tts", "task": "tts"},
+ {"id": "a-much-longer-model-id", "family": "qwen3_tts",
+ "task": "tts"}])
+ with patch.object(hub.config, "AUDIOCPP_INSTRUCTIONS", ""):
+ self._answer_form(backend="audiocpp-remote", model_id="short",
+ audiocpp_voice="", instructions="")
+ cmd = self._convert(
+ None, [self._remote("audiocpp", "audio.cpp")])
+ self.assertIsNotNone(cmd)
+ choices = self._field("model_id")["choices"]
+ # "a-much-longer-model-id" is 22 columns wide; both types open at
+ # column 24 ("(" right after the two-space gutter).
+ self.assertEqual(choices[0],
+ ("short".ljust(22) + " (clone)", "short"))
+ self.assertEqual(choices[1],
+ ("a-much-longer-model-id (clone)",
+ "a-much-longer-model-id"))
+ self.assertEqual({label.index("(") for label, _ in choices}, {24})
+ # A plain qwen3_tts entry (no CustomVoice in the id) is clone-only.
+ self.assertEqual(choices[1][1], "a-much-longer-model-id")
+ self.assertTrue(choices[1][0].endswith("(clone)"))
def test_audiocpp_customvoice_entry_lists_builtin_speakers(self):
# A CustomVoice entry populates the Voice menu with the Qwen3-TTS