tests: Add test for tab autocompletion of /msg

Test both latin and UTF-8.
This commit is contained in:
Michael Vetter
2026-03-19 08:55:20 +01:00
parent ee0d325648
commit f6b9903c31
3 changed files with 43 additions and 0 deletions

View File

@@ -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);

View File

@@ -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(
"<item jid='socrates@localhost' subscription='both' name='Σωκράτης'/>");
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(
"<message to='socrates@localhost' id='*' type='chat'>"
"<body>Hello</body>"
"</message>"));
}
void
i18n_autocomplete_tab_latin(void** state)
{
prof_connect_with_roster(
"<item jid='plato@localhost' subscription='both' name='Plato'/>");
prof_send_raw("/msg Pl");
prof_send_raw("\t");
prof_input(" Hello");
assert_true(prof_output_regex("plato@localhost"));
assert_true(stbbr_received(
"<message to='plato@localhost' id='*' type='chat'>"
"<body>Hello</body>"
"</message>"));
}

View File

@@ -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);