mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:37:45 +00:00
LibGfx/WOFF2: Tolerate incorrect totalSfntSize
in WOFF2 header
The specification says that this value is for reference only, so we should be able to load a file where this value is incorrect.
This commit is contained in:
parent
0eaf13bae3
commit
af633523af
4 changed files with 26 additions and 1 deletions
22
Tests/LibGfx/TestWOFF2.cpp
Normal file
22
Tests/LibGfx/TestWOFF2.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Tim Ledbetter <timledbetter@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/Font/WOFF2/Font.h>
|
||||
#include <LibTest/TestCase.h>
|
||||
|
||||
#ifdef AK_OS_SERENITY
|
||||
# define TEST_INPUT(x) ("/usr/Tests/LibGfx/test-inputs/" x)
|
||||
#else
|
||||
# define TEST_INPUT(x) ("test-inputs/" x)
|
||||
#endif
|
||||
|
||||
TEST_CASE(tolerate_incorrect_sfnt_size)
|
||||
{
|
||||
auto file = MUST(Core::MappedFile::map(TEST_INPUT("woff2/incorrect_sfnt_size.woff2"sv)));
|
||||
auto font = TRY_OR_FAIL(WOFF2::Font::try_load_from_externally_owned_memory(file->bytes()));
|
||||
EXPECT_EQ(font->family(), "Test"_string);
|
||||
EXPECT_EQ(font->glyph_count(), 4u);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue