From f6b9903c313f0f1220daad47343c1408011557d4 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 19 Mar 2026 08:55:20 +0100 Subject: [PATCH] tests: Add test for tab autocompletion of /msg Test both latin and UTF-8. --- tests/functionaltests/functionaltests.c | 2 ++ tests/functionaltests/test_i18n.c | 39 +++++++++++++++++++++++++ tests/functionaltests/test_i18n.h | 2 ++ 3 files changed, 43 insertions(+) diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c index e163b0f3..14c5a8b6 100644 --- a/tests/functionaltests/functionaltests.c +++ b/tests/functionaltests/functionaltests.c @@ -120,6 +120,8 @@ main(int argc, char* argv[]) PROF_FUNC_TEST(i18n_msg_nickname), PROF_FUNC_TEST(i18n_win_nickname), + PROF_FUNC_TEST(i18n_autocomplete_tab_utf8), + PROF_FUNC_TEST(i18n_autocomplete_tab_latin), }; return cmocka_run_group_tests(all_tests, NULL, NULL); diff --git a/tests/functionaltests/test_i18n.c b/tests/functionaltests/test_i18n.c index 572486dc..78dccdf3 100644 --- a/tests/functionaltests/test_i18n.c +++ b/tests/functionaltests/test_i18n.c @@ -49,3 +49,42 @@ i18n_win_nickname(void** state) prof_input("/win Σωκράτης"); assert_true(prof_output_regex("socrates@localhost")); } + +void +i18n_autocomplete_tab_utf8(void** state) +{ + prof_connect_with_roster( + ""); + + prof_send_raw("/msg Σω"); + // TAB for completion + prof_send_raw("\t"); + prof_input(" Hello"); + + // If autocompletion worked, we should be in the Socrates window + assert_true(prof_output_regex("socrates@localhost")); + + // And stabber should have received the message + assert_true(stbbr_received( + "" + "Hello" + "")); +} + +void +i18n_autocomplete_tab_latin(void** state) +{ + prof_connect_with_roster( + ""); + + prof_send_raw("/msg Pl"); + prof_send_raw("\t"); + prof_input(" Hello"); + + assert_true(prof_output_regex("plato@localhost")); + + assert_true(stbbr_received( + "" + "Hello" + "")); +} diff --git a/tests/functionaltests/test_i18n.h b/tests/functionaltests/test_i18n.h index c37919cf..cb8ef612 100644 --- a/tests/functionaltests/test_i18n.h +++ b/tests/functionaltests/test_i18n.h @@ -7,3 +7,5 @@ */ void i18n_msg_nickname(void** state); void i18n_win_nickname(void** state); +void i18n_autocomplete_tab_utf8(void** state); +void i18n_autocomplete_tab_latin(void** state);