def test_terminal_show_notification(terminal, stdscr, use_ascii): terminal.config['ascii'] = use_ascii # Multi-line messages should be automatically split text = 'line 1\nline 2\nline3' terminal.show_notification(text) assert stdscr.subwin.nlines == 5 assert stdscr.subwin.addstr.call_count == 3 stdscr.reset_mock() # The text should be trimmed to fit 40x80 text = HELP.strip().splitlines() terminal.show_notification(text) assert stdscr.subwin.nlines == 40 assert stdscr.subwin.ncols <= 80 assert stdscr.subwin.addstr.call_count == 38 stdscr.reset_mock() # The text should be trimmed to fit in 20x20 stdscr.nlines, stdscr.ncols = 15, 20 text = HELP.strip().splitlines() terminal.show_notification(text) assert stdscr.subwin.nlines == 15 assert stdscr.subwin.ncols == 20 assert stdscr.subwin.addstr.call_count == 13
def test_show_notification(terminal, stdscr, use_ascii): terminal.config['ascii'] = use_ascii # Multi-line messages should be automatically split text = 'line 1\nline 2\nline3' terminal.show_notification(text) assert stdscr.subwin.nlines == 5 assert stdscr.subwin.addstr.call_count == 3 stdscr.reset_mock() # The whole message should fit in 40x80 text = HELP.strip().splitlines() terminal.show_notification(text) assert stdscr.subwin.nlines == len(text) + 2 assert stdscr.subwin.ncols == 80 assert stdscr.subwin.addstr.call_count == len(text) stdscr.reset_mock() # The text should be trimmed to fit in 20x20 stdscr.nlines, stdscr.ncols = 15, 20 text = HELP.strip().splitlines() terminal.show_notification(text) assert stdscr.subwin.nlines == 15 assert stdscr.subwin.ncols == 20 assert stdscr.subwin.addstr.call_count == 13
def test_show_notification(terminal, stdscr, ascii): terminal.ascii = ascii # The whole message should fit in 40x80 text = HELP.strip().splitlines() terminal.show_notification(text) assert stdscr.subwin.nlines == len(text) + 2 assert stdscr.subwin.ncols == 80 assert stdscr.subwin.addstr.call_count == len(text) stdscr.reset_mock() # The text should be trimmed to fit in 20x20 stdscr.nlines, stdscr.ncols = 15, 20 text = HELP.strip().splitlines() terminal.show_notification(text) assert stdscr.subwin.nlines == 15 assert stdscr.subwin.ncols == 20 assert stdscr.subwin.addstr.call_count == 13