diff options
| author | historia <historiavg@proton.me> | 2026-08-31 17:19:27 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-31 17:19:27 -0400 |
| commit | 4bd0282da65db9f118ef5250582ab67079fad538 (patch) | |
| tree | 61983333df69b9cf9efc91f5320fbb51c66fdc97 /app/tests/test_tui.py | |
| parent | 3b109185d642319c2c1870815b25ae1c0ad49445 (diff) | |
| download | tts-audiobook-generator-4bd0282da65db9f118ef5250582ab67079fad538.tar.gz | |
fix: truncate excess spaces on generate audiobooks tui
Diffstat (limited to 'app/tests/test_tui.py')
| -rw-r--r-- | app/tests/test_tui.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/tests/test_tui.py b/app/tests/test_tui.py index 085a1f1..e3383cb 100644 --- a/app/tests/test_tui.py +++ b/app/tests/test_tui.py @@ -631,6 +631,32 @@ class FormTests(TuiTestCase): self.assertNotIn(" qwen", painted) self.assertNotIn(" clone", painted) + def test_compact_label_collapses_padded_choice_on_the_row(self): + # A choice field may opt into a compact row display: the pick + # menu keeps the padded table label (aligned capability columns), + # while the painted row collapses its runs of column padding back + # to the two-space gutter. Fields without the flag paint the + # label verbatim. + padded = "supertonic".ljust(22) + " tts" + fields = [ + {"key": "model", "label": "Model", "kind": "choice", + "value": "supertonic", + "choices": [(padded, "supertonic"), + ("a-much-longer-model-id".ljust(22) + " tts", + "a-much-longer-model-id")], + "compact_label": True}, + {"key": "plain", "label": "Plain", "kind": "choice", + "value": "a", "choices": [("a b", "a")]}, + ] + 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(" supertonic tts", painted) + self.assertNotIn(padded, painted) + self.assertIn(" a b", 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. |
