TestWOFF.cpp 592 B

1234567891011121314151617181920212223
  1. /*
  2. * Copyright (c) 2023, Tim Ledbetter <timledbetter@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibGfx/Font/WOFF/Typeface.h>
  7. #include <LibTest/TestCase.h>
  8. #define TEST_INPUT(x) ("test-inputs/" x)
  9. TEST_CASE(malformed_woff)
  10. {
  11. Array test_inputs = {
  12. TEST_INPUT("woff/invalid_sfnt_size.woff"sv)
  13. };
  14. for (auto test_input : test_inputs) {
  15. auto file = MUST(Core::MappedFile::map(test_input));
  16. auto font_or_error = WOFF::Typeface::try_load_from_externally_owned_memory(file->bytes());
  17. EXPECT(font_or_error.is_error());
  18. }
  19. }