From 0dda9a5921eafd03853d233e077138ff72d64e4d Mon Sep 17 00:00:00 2001 From: historia Date: Fri, 28 Aug 2026 04:24:06 -0400 Subject: feat: .wav hints for all voice directory pickers in tui --- app/tests/test_tui.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'app/tests/test_tui.py') diff --git a/app/tests/test_tui.py b/app/tests/test_tui.py index a0e0309..6fc3fd5 100644 --- a/app/tests/test_tui.py +++ b/app/tests/test_tui.py @@ -965,6 +965,27 @@ class FormTests(TuiTestCase): self.assertEqual(Path(mk_browser.call_args[1]["start"]), Path("/start")) + def test_dir_field_passes_info_and_preview_to_the_browser(self): + # A dir field may carry info/preview callbacks (e.g. the .wav + # count alerts); the form forwards them to the browser untouched. + def info(directory): + return ("info text", "ok") + + def preview(directory): + return ("preview text", "warn") + + picked = Path("/picked/voices") + fields = [{"key": "voices", "label": "Voices directory", + "kind": "dir", "value": Path("/start"), + "info": info, "preview": preview}] + with patch.object(tui, "browse_directory", + return_value=picked) as mk_browser: + screen = FakeScreen(keys=[10, 10]) + result = tui.form(screen, "Settings", fields) + self.assertEqual(result, {"voices": picked}) + self.assertIs(mk_browser.call_args[1]["info"], info) + self.assertIs(mk_browser.call_args[1]["preview"], preview) + def test_dir_pick_moves_focus_to_the_accept_button(self): # Accepting a directory is a completed choice: focus lands on # Save, so the very next Enter submits — no Tab hunting. -- cgit v1.2.3