mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-23 17:16:21 +00:00
Autocompletion failed for nicknames using non Latin scripts. We used `g_str_to_ascii`, which replaces characters it cannot transliterate with '?', leading search failures and false matches between different scripts. Now we do: Use `g_utf8_casefold` for case-insensitive UTF-8 comparison. This ensures that like 'Σ' correctly match 'σ' across all Unicode scripts, providing correct results for non English nicknames. If we don't fine anything typing a base ASCII character matches an accented one (typing `e` matches `è`). This pass uses `g_str_to_ascii` followed by `g_ascii_strdown` for comparison. It is now restricted to run if the search string itself is valid ASCII, preventing the "everything matches '?'" bug in non Latin scripts. Autocomplete items are sorted using `strcmp`. `g_utf8_collate` provides linguistical ordering for a specific language. But its behavior is locale dependent and undefined when comparing strings from different scripts. `strcmp` does byte-wise ordering that correctly follows Unicode code order for UTF-8 strings.
42 lines
2.5 KiB
C
42 lines
2.5 KiB
C
#ifndef TESTS_TEST_ROSTER_LIST_H
|
|
#define TESTS_TEST_ROSTER_LIST_H
|
|
|
|
void roster_get_contacts__returns__empty_list_when_none_added(void** state);
|
|
void roster_get_contacts__returns__one_element(void** state);
|
|
void roster_get_contacts__returns__correct_first_element(void** state);
|
|
void roster_get_contacts__returns__two_elements(void** state);
|
|
void roster_get_contacts__returns__correct_first_and_second_elements(void** state);
|
|
void roster_get_contacts__returns__three_elements(void** state);
|
|
void roster_get_contacts__returns__correct_first_three_elements(void** state);
|
|
void roster_add__updates__adds_once_when_called_twice_at_beginning(void** state);
|
|
void roster_add__updates__adds_once_when_called_twice_in_middle(void** state);
|
|
void roster_add__updates__adds_once_when_called_twice_at_end(void** state);
|
|
void roster_contact_autocomplete__returns__first_exists(void** state);
|
|
void roster_contact_autocomplete__returns__second_exists(void** state);
|
|
void roster_contact_autocomplete__returns__third_exists(void** state);
|
|
void roster_contact_autocomplete__returns__null_when_no_match(void** state);
|
|
void roster_contact_autocomplete__returns__null_on_empty_roster(void** state);
|
|
void roster_contact_autocomplete__returns__second_when_two_match(void** state);
|
|
void roster_contact_autocomplete__returns__fifth_when_multiple_match(void** state);
|
|
void roster_contact_autocomplete__returns__first_when_two_match_and_reset(void** state);
|
|
void roster_contact_autocomplete__returns__utf8(void** state);
|
|
void roster_get_groups__returns__empty_for_no_group(void** state);
|
|
void roster_get_groups__returns__one_group(void** state);
|
|
void roster_get_groups__returns__two_groups(void** state);
|
|
void roster_get_groups__returns__three_groups(void** state);
|
|
void roster_update__updates__adding_two_groups(void** state);
|
|
void roster_update__updates__removing_one_group(void** state);
|
|
void roster_update__updates__removing_two_groups(void** state);
|
|
void roster_update__updates__removing_three_groups(void** state);
|
|
void roster_update__updates__two_new_groups(void** state);
|
|
void roster_remove__updates__contact_groups(void** state);
|
|
void roster_add__updates__different_groups(void** state);
|
|
void roster_add__updates__same_groups(void** state);
|
|
void roster_add__updates__overlapping_groups(void** state);
|
|
void roster_remove__updates__remaining_in_group(void** state);
|
|
void roster_get_display_name__returns__nickname_when_exists(void** state);
|
|
void roster_get_display_name__returns__barejid_when_nickname_empty(void** state);
|
|
void roster_get_display_name__returns__barejid_when_not_exists(void** state);
|
|
|
|
#endif
|