From 83d0b7a5b2f669a1d3a9a0bea9c74b00e0b4c07b Mon Sep 17 00:00:00 2001 From: historia Date: Fri, 28 Aug 2026 19:01:16 -0400 Subject: fix: no .wav directory error formatting --- app/tests/test_tui.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'app/tests') diff --git a/app/tests/test_tui.py b/app/tests/test_tui.py index 4c8b431..72465c1 100644 --- a/app/tests/test_tui.py +++ b/app/tests/test_tui.py @@ -1355,6 +1355,58 @@ class FlashTests(TuiTestCase): self.assertIsNone(frame.status) +class FrameStatusTests(TuiTestCase): + """Frame status: a multi-line status stacks above the footer row. + + An embedded "\\n" must never spill onto the footer's row (the + controls line) — the dialog grows and the block is drawn one line + per row, ending just above the footer. + """ + + MESSAGE = "first line\nsecond line\n" # trailing blank separator line + + def _draw(self): + frame = tui.Frame(self.screen, "Generate Speech", + "Up/Down = move Enter = edit") + frame.mark("Model: qwen-tts", selectable=True) + frame.buttons = (["Generate!", "Cancel"], 0) + frame.status = (self.MESSAGE, "err") + frame.draw() + + def _y_of(self, text, exact=True): + matches = self.screen.strings if exact else \ + [(y, x, t, a) for y, x, t, a in self.screen.strings + if t.strip() == text] + return next(y for y, _, t, _ in matches + if (t == text if exact else True)) + + def test_status_lines_stack_above_the_footer_row(self): + self._draw() + first_y = self._y_of("first line", exact=False) + second_y = self._y_of("second line", exact=False) + footer_y = self._y_of("Up/Down = move Enter = edit") + self.assertEqual(second_y, first_y + 1) + # The trailing "\n" separates the error from the controls: the + # footer sits one blank row below the last status line. + self.assertEqual(footer_y, second_y + 2) + self.assert_inside_border(self.screen) + + def test_buttons_clear_the_status_block(self): + self._draw() + buttons_y = self._y_of("[ Generate! ]") + first_y = self._y_of("first line", exact=False) + self.assertLess(buttons_y, first_y) + self.assert_inside_border(self.screen) + + def test_single_line_status_sits_directly_above_the_footer(self): + frame = tui.Frame(self.screen, "Title", "footer") + frame.status = ("only line", "err") + frame.draw() + status_y = self._y_of("only line", exact=False) + footer_y = self._y_of("footer") + self.assertEqual(footer_y, status_y + 1) + + class TextViewerTests(TuiTestCase): """tui.text_viewer: a scrollable read-only dialog; Esc/q/Enter closes.""" -- cgit v1.2.3