diff options
Diffstat (limited to 'app/tests/test_tui.py')
| -rw-r--r-- | app/tests/test_tui.py | 23 |
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. |
