serenity/Tests/LibUnicode
Nico Weber 0197bfcadf LibUnicode+LibWeb: Rework bidirectional_class() API a bit
Before this commit, GenerateUnicodeData generated a
`BidirectionalClass` enum directly from UnicodeData.txt.

Now, GenerateUnicodeData instead generates `BidirectionalClassInternal`
and CharacterTypes.h has an explicit enum `BidiClass` with nicer names
-- no underscores, but also names more similar to ICUs names.

(Since CharacterTypes.h is included in some of LibUnicode's generators,
it can't refer to generated `BidirectionalClassInternal`, so we instead
have a big manual mapping switch in UnicodeData.cpp.)

`bidirectional_class()` used to return an `Optional<BidirectionalClass>`
for when unicode data was disabled. Now we return `BidiClass` and
just return `BidiClass::LeftToRight` instead of making every client
do this.

It also updates LibWeb's Element.cpp to this new system.

Also remove now-unused `bidirectional_class_from_string()`.

This kind of cherry-picks the 4th commit of
LadybirdBrowser/ladybird#239 (aa3a30870b58c47cb37bce1418d7e6bee7af71d9):
The CharacterTypes.h, Element.cpp and TestUnicodeCharacterTypes.cpp changes are
by trflynn.

Co-authored-by: Tim Flynn <trflynn89@serenityos.org>
2024-11-23 19:24:11 -05:00
..
CMakeLists.txt
TestEmoji.cpp
TestIDNA.cpp
TestPunycode.cpp
TestSegmentation.cpp
TestUnicodeCharacterTypes.cpp LibUnicode+LibWeb: Rework bidirectional_class() API a bit 2024-11-23 19:24:11 -05:00
TestUnicodeNormalization.cpp