diff options
| author | historia <historiavg@proton.me> | 2026-08-24 23:49:34 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-24 23:49:34 -0400 |
| commit | fe4b2b9eb7fb8aac81f65630720c9079d0a3121a (patch) | |
| tree | 9c5e5f56d0b931d25e6580f10d09453505eddc2f /app/tests/test_tui.py | |
| parent | f4b1de303704e13818259d5057d176cd841b6ed8 (diff) | |
| download | tts-audiobook-generator-fe4b2b9eb7fb8aac81f65630720c9079d0a3121a.tar.gz | |
feat: user-friendly menu gating, clearer install/configure path for backends
Diffstat (limited to 'app/tests/test_tui.py')
| -rw-r--r-- | app/tests/test_tui.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/tests/test_tui.py b/app/tests/test_tui.py index 7c9c800..5b5cb3c 100644 --- a/app/tests/test_tui.py +++ b/app/tests/test_tui.py @@ -227,6 +227,33 @@ class MenuTests(TuiTestCase): with self.assertRaises(tui.WizardCancelled): tui.menu(screen, "Pick", self.OPTIONS) + def test_separator_is_blank_and_skipped_by_cursor(self): + options = [("build", "build"), tui.MENU_SEPARATOR, + ("quit", "quit")] + # Down from the first option must skip the blank divider and land on + # the third option (Enter returns its value, not the separator's). + screen = FakeScreen(keys=[FakeCurses.KEY_DOWN, 10]) + self.assertEqual(tui.menu(screen, "Pick", options), "quit") + + def test_separator_alone_is_rejected(self): + with self.assertRaises(ValueError): + tui.menu(self.screen, "Pick", [tui.MENU_SEPARATOR]) + + def test_suffix_renders_in_its_theme_color(self): + # default_index=1 keeps the suffixed option unselected, so its + # segments keep their own colors instead of the cursor bar. + options = [("Build audio.cpp server", "build", + ("[recommended]", "warn")), ("other", "other")] + screen = FakeScreen(keys=[10]) + tui.menu(screen, "Pick", options, default_index=1) + text = " [recommended]" + attr = next(a for _, _, drawn, a in screen.strings + if drawn == text) + self.assertEqual(attr, tui._THEME["warn"]) + label_attr = next(a for _, _, drawn, a in screen.strings + if drawn == "Build audio.cpp server") + self.assertEqual(label_attr, tui._THEME["body"]) + class MenuTableTests(TuiTestCase): """The optional status table: aligned columns and colored statuses.""" |
