mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-16 17:00:35 +03:00
Tests: Update TestFontHandling and add new test
Updates BitmapFont testing for fallible writes and adds a new test font file for use in a new un/masking test.
This commit is contained in:
parent
cc291a0ca7
commit
3c1ea2861b
Notes:
sideshowbarker
2024-07-17 08:27:02 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/3c1ea2861b Pull-request: https://github.com/SerenityOS/serenity/pull/14736 Reviewed-by: https://github.com/krkk
@ -7,3 +7,5 @@ set(TEST_SOURCES
|
||||
foreach(source IN LISTS TEST_SOURCES)
|
||||
serenity_test("${source}" LibGfx LIBS LibGUI)
|
||||
endforeach()
|
||||
|
||||
install(FILES TestFont.font DESTINATION usr/Tests/LibGfx)
|
||||
|
BIN
Tests/LibGfx/TestFont.font
Normal file
BIN
Tests/LibGfx/TestFont.font
Normal file
Binary file not shown.
@ -131,6 +131,24 @@ TEST_CASE(test_write_to_file)
|
||||
|
||||
char path[] = "/tmp/new.font.XXXXXX";
|
||||
EXPECT(mkstemp(path) != -1);
|
||||
EXPECT(font->write_to_file(path));
|
||||
EXPECT(!font->write_to_file(path).is_error());
|
||||
unlink(path);
|
||||
}
|
||||
|
||||
TEST_CASE(test_character_set_masking)
|
||||
{
|
||||
auto font = Gfx::BitmapFont::try_load_from_file("/usr/Tests/LibGfx/TestFont.font");
|
||||
EXPECT(!font.is_error());
|
||||
|
||||
auto unmasked_font = font.value()->unmasked_character_set();
|
||||
EXPECT(!unmasked_font.is_error());
|
||||
EXPECT(unmasked_font.value()->glyph_index(0x0041).value() == 0x0041);
|
||||
EXPECT(unmasked_font.value()->glyph_index(0x0100).value() == 0x0100);
|
||||
EXPECT(unmasked_font.value()->glyph_index(0xFFFD).value() == 0xFFFD);
|
||||
|
||||
auto masked_font = unmasked_font.value()->masked_character_set();
|
||||
EXPECT(!masked_font.is_error());
|
||||
EXPECT(masked_font.value()->glyph_index(0x0041).value() == 0x0041);
|
||||
EXPECT(!masked_font.value()->glyph_index(0x0100).has_value());
|
||||
EXPECT(masked_font.value()->glyph_index(0xFFFD).value() == 0x1FD);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user