From a7c653313d2bb1e185cfbc3f0f52c2fe33218600 Mon Sep 17 00:00:00 2001 From: historia Date: Fri, 28 Aug 2026 02:27:10 -0400 Subject: feat: qwen-tts backend widgets updated to same style as audio.cpp --- app/tests/test_tui.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'app/tests/test_tui.py') 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. -- cgit v1.2.3