diff options
Diffstat (limited to 'app/tests')
| -rw-r--r-- | app/tests/test_backends_audiocpp.py | 4 | ||||
| -rw-r--r-- | app/tests/test_backends_faster.py | 5 | ||||
| -rw-r--r-- | app/tests/test_hub.py | 3 | ||||
| -rw-r--r-- | app/tests/test_tui.py | 21 |
4 files changed, 33 insertions, 0 deletions
diff --git a/app/tests/test_backends_audiocpp.py b/app/tests/test_backends_audiocpp.py index 4a8ee5f..95f8bec 100644 --- a/app/tests/test_backends_audiocpp.py +++ b/app/tests/test_backends_audiocpp.py @@ -2713,6 +2713,10 @@ class WizardNavigationTests(unittest.TestCase): by_key = {f["key"]: f for f in fields} self.assertEqual(by_key["wav_dir"]["value"], Path(recorded_voices)) + # The directory browser alerts on the .wavs it lists. + self.assertIs(by_key["wav_dir"]["info"], common.wav_dir_info) + self.assertIs(by_key["wav_dir"]["preview"], + common.wav_dir_preview) return {f["key"]: f["value"] for f in fields} with patch.object(make_server.build, "find_local_checkout", diff --git a/app/tests/test_backends_faster.py b/app/tests/test_backends_faster.py index 44f4907..2f21377 100644 --- a/app/tests/test_backends_faster.py +++ b/app/tests/test_backends_faster.py @@ -273,6 +273,11 @@ class WizardFormTests(unittest.TestCase): captured["title"] = title captured["keys"] = [f["key"] for f in fields] by_key = {f["key"]: f for f in fields} + # The directory browser alerts on the .wavs it lists. + self.assertIs(by_key["wav_dir"]["info"], + make_voices.common.wav_dir_info) + self.assertIs(by_key["wav_dir"]["preview"], + make_voices.common.wav_dir_preview) by_key["wav_dir"]["value"] = folder return {f["key"]: f["value"] for f in fields} diff --git a/app/tests/test_hub.py b/app/tests/test_hub.py index 0bdf2d5..ee1425d 100644 --- a/app/tests/test_hub.py +++ b/app/tests/test_hub.py @@ -1596,6 +1596,9 @@ class ConvertFlowTests(unittest.TestCase): mode_field["choices"]}, {13}) speaker_field = self._field("speaker") clone_dir_field = self._field("clone_dir") + # The .wav directory browser alerts on the .wavs it lists. + self.assertIs(clone_dir_field["info"], hub.common.wav_dir_info) + self.assertIs(clone_dir_field["preview"], hub.common.wav_dir_preview) clone_field = self._field("clone") design_field = self._field("qwen_instructions") # Speaker shows in custom mode; the .wav directory browser and 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. |
