mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
Merge branch 'fix_g_unichar_totitle' into 'master'
Fix g unichar totitle Closes #135 See merge request GNOME/glib!843
This commit is contained in:
commit
4f5fe35385
@ -623,13 +623,19 @@ gunichar
|
||||
g_unichar_totitle (gunichar c)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/* We handle U+0000 explicitely because some elements in
|
||||
* title_table[i][1] may be null. */
|
||||
if (c == 0)
|
||||
return c;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (title_table); ++i)
|
||||
{
|
||||
if (title_table[i][0] == c || title_table[i][1] == c
|
||||
|| title_table[i][2] == c)
|
||||
return title_table[i][0];
|
||||
}
|
||||
|
||||
|
||||
if (TYPE (c) == G_UNICODE_LOWERCASE_LETTER)
|
||||
return g_unichar_toupper (c);
|
||||
|
||||
|
@ -882,6 +882,7 @@ test_title (void)
|
||||
g_assert_false (g_unichar_istitle (G_UNICODE_LAST_CHAR_PART1));
|
||||
g_assert_false (g_unichar_istitle (G_UNICODE_LAST_CHAR_PART1 + 1));
|
||||
|
||||
g_assert_cmphex (g_unichar_totitle (0x0000), ==, 0x0000);
|
||||
g_assert_cmphex (g_unichar_totitle (0x01c6), ==, 0x01c5);
|
||||
g_assert_cmphex (g_unichar_totitle (0x01c4), ==, 0x01c5);
|
||||
g_assert_cmphex (g_unichar_totitle (0x01c5), ==, 0x01c5);
|
||||
|
Loading…
Reference in New Issue
Block a user