mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 20:46:14 +01:00
Document, that the second part of a decompose() wouldn't decompose()
This is not directly documented in Unicode, or I couldn't find it, but the test I just added confirms that it is currently the case.
This commit is contained in:
parent
f4cf6c3db0
commit
89a5d17d58
@ -625,6 +625,13 @@ compose_hangul_step (gunichar a,
|
||||
* If @ch is not decomposable, *@a is set to @ch and *@b
|
||||
* is set to zero.
|
||||
*
|
||||
* Note that the way Unicode decomposition pairs are
|
||||
* defined, it is guaranteed that @b would not decompose
|
||||
* further, but @a may itself decompose. To get the full
|
||||
* canonical decomposition for @ch, one would need to
|
||||
* recursively call this function on @a. Or use
|
||||
* g_unicode_canonical_decomposition().
|
||||
*
|
||||
* See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
|
||||
* for details.
|
||||
*
|
||||
|
@ -525,6 +525,21 @@ test_canonical_decomposition (void)
|
||||
TEST2 (0xCE20, 0x110E, 0x1173);
|
||||
}
|
||||
|
||||
static void
|
||||
test_decompose_tail (void)
|
||||
{
|
||||
gunichar ch, a, b, c, d;
|
||||
|
||||
/* Test that whenever a char ch decomposes into a and b, b itself
|
||||
* won't decompose any further. */
|
||||
|
||||
for (ch = 0; ch < 0x110000; ch++)
|
||||
if (g_unichar_decompose (ch, &a, &b))
|
||||
g_assert (!g_unichar_decompose (b, &c, &d));
|
||||
else
|
||||
g_assert (a == ch && b == 0);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
@ -543,6 +558,7 @@ main (int argc,
|
||||
g_test_add_func ("/unicode/compose", test_compose);
|
||||
g_test_add_func ("/unicode/decompose", test_decompose);
|
||||
g_test_add_func ("/unicode/canonical-decomposition", test_canonical_decomposition);
|
||||
g_test_add_func ("/unicode/decompose-tail", test_decompose_tail);
|
||||
|
||||
return g_test_run();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user