aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_tui.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-28 02:27:10 -0400
committerhistoria <historiavg@proton.me>2026-08-28 02:27:10 -0400
commita7c653313d2bb1e185cfbc3f0f52c2fe33218600 (patch)
treef28f57fa5509ddb54176116cc4cc1198d034e9ff /app/tests/test_tui.py
parent975053f1789771ba5cb9dbe50ba7fe0aa396f0ab (diff)
downloadtts-audiobook-generator-a7c653313d2bb1e185cfbc3f0f52c2fe33218600.tar.gz
feat: qwen-tts backend widgets updated to same style as audio.cpp
Diffstat (limited to 'app/tests/test_tui.py')
-rw-r--r--app/tests/test_tui.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/tests/test_tui.py b/app/tests/test_tui.py
index e765e60..a0e0309 100644
--- a/app/tests/test_tui.py
+++ b/app/tests/test_tui.py
@@ -593,6 +593,29 @@ class FormTests(TuiTestCase):
result = tui.form(screen, "Settings", self._fields())
self.assertEqual(result, {"fmt": "ogg", "chunk": "250"})
+ def test_choice_row_shows_the_selected_label_not_the_raw_value(self):
+ # A (label, value) choice's value can be a bare key ("qwen") while
+ # its label is the display name ("qwen-tts"): the painted row shows
+ # the label — the same text the pick menu shows — for both static
+ # and callable choice lists.
+ fields = [
+ {"key": "backend", "label": "Backend", "kind": "choice",
+ "value": "qwen",
+ "choices": [("qwen-tts", "qwen"), ("audio.cpp", "audiocpp")]},
+ {"key": "mode", "label": "Model", "kind": "choice",
+ "value": "clone",
+ "choices": lambda fs: [("Base (voice cloning)", "clone")]},
+ ]
+ screen = FakeScreen(keys=[27])
+ marker = object()
+ self.assertIs(tui.form(screen, "Form", fields, back_value=marker),
+ marker)
+ painted = [text for _, _, text, _ in screen.strings]
+ self.assertIn(" qwen-tts", painted)
+ self.assertIn(" Base (voice cloning)", painted)
+ self.assertNotIn(" qwen", painted)
+ self.assertNotIn(" clone", painted)
+
def test_text_field_edits_then_saves(self):
# Down to the text row, Enter opens the editor, type 'x', Enter,
# then Tab -> Save, Enter.