mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 11:44:58 +00:00
LibUnicode: Handle edge-case script extensions, Common and Inherited
These script extensions have some peculiar behavior in the Unicode spec. The UCD ScriptExtension file does not contain these scripts. Rather, it is implied the code points which have these scripts as an extension are the code points that both: 1. Have Common or Inherited as their primary script value 2. Do not have any other script value in their script extension lists Because these are not explictly listed in the UCD, we must manually form these script extensions.
This commit is contained in:
parent
47bb350ebd
commit
1e91334008
2 changed files with 49 additions and 0 deletions
|
@ -464,4 +464,26 @@ TEST_CASE(script_extension)
|
|||
|
||||
EXPECT(!Unicode::code_point_has_script(0x1dc1, script_greek));
|
||||
EXPECT(Unicode::code_point_has_script_extension(0x1dc1, script_greek));
|
||||
|
||||
auto script_common = script("Common"sv);
|
||||
auto script_zyyy = script("Zyyy"sv);
|
||||
EXPECT_EQ(script_common, script_zyyy);
|
||||
|
||||
EXPECT(Unicode::code_point_has_script(0x202f, script_common));
|
||||
EXPECT(!Unicode::code_point_has_script_extension(0x202f, script_common));
|
||||
|
||||
EXPECT(Unicode::code_point_has_script(0x3000, script_common));
|
||||
EXPECT(Unicode::code_point_has_script_extension(0x3000, script_common));
|
||||
|
||||
auto script_inherited = script("Inherited"sv);
|
||||
auto script_qaai = script("Qaai"sv);
|
||||
auto script_zinh = script("Zinh"sv);
|
||||
EXPECT_EQ(script_inherited, script_qaai);
|
||||
EXPECT_EQ(script_inherited, script_zinh);
|
||||
|
||||
EXPECT(Unicode::code_point_has_script(0x1ced, script_inherited));
|
||||
EXPECT(!Unicode::code_point_has_script_extension(0x1ced, script_inherited));
|
||||
|
||||
EXPECT(Unicode::code_point_has_script(0x101fd, script_inherited));
|
||||
EXPECT(Unicode::code_point_has_script_extension(0x101fd, script_inherited));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue