1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:07:34 +00:00

LibPDF: Add (automated!) test for info dict encoding

Manually added an info dict with the three text string encoding
methods to encoding.pdf.

(Preview.app apparently can't handle UTF-8 in info dicts!)
This commit is contained in:
Nico Weber 2023-11-21 20:09:51 -05:00 committed by Andrew Kaster
parent 65b895595a
commit d345c5b793
2 changed files with 24 additions and 4 deletions

View file

@ -44,6 +44,21 @@ TEST_CASE(empty_file_issue_10702)
EXPECT(document.is_error());
}
TEST_CASE(encodig)
{
auto file = MUST(Core::MappedFile::map("encoding.pdf"sv));
auto document = MUST(PDF::Document::create(file->bytes()));
MUST(document->initialize());
EXPECT_EQ(document->get_page_count(), 1U);
auto info_dict = MUST(document->info_dict()).value();
EXPECT_EQ(MUST(info_dict.author()).value(), "Nico Weber");
EXPECT_EQ(MUST(info_dict.producer()).value(), (char const*)u8"Manüally Created");
// FIXME: Make this pass.
// EXPECT_EQ(MUST(info_dict.title()).value(), (char const*)u8"Êñ©•ding test");
}
TEST_CASE(truncated_pdf_header_issue_10717)
{
AK::DeprecatedString string { "%PDF-2.11%" };