mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:47:35 +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:
parent
65b895595a
commit
d345c5b793
2 changed files with 24 additions and 4 deletions
|
@ -44,6 +44,21 @@ TEST_CASE(empty_file_issue_10702)
|
||||||
EXPECT(document.is_error());
|
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)
|
TEST_CASE(truncated_pdf_header_issue_10717)
|
||||||
{
|
{
|
||||||
AK::DeprecatedString string { "%PDF-2.11%" };
|
AK::DeprecatedString string { "%PDF-2.11%" };
|
||||||
|
|
|
@ -32,17 +32,22 @@ endobj
|
||||||
<</Type/Font/Subtype/Type1/Name/F1/BaseFont/Helvetica/Encoding/MacRomanEncoding>>
|
<</Type/Font/Subtype/Type1/Name/F1/BaseFont/Helvetica/Encoding/MacRomanEncoding>>
|
||||||
endobj
|
endobj
|
||||||
|
|
||||||
|
6 0 obj
|
||||||
|
<</Author<FEFF004E00690063006F002000570065006200650072>/Producer(\357\273\277Man\303\274ally Created)/Title(\312\361\251\200ding test)>>
|
||||||
|
endobj
|
||||||
|
|
||||||
xref
|
xref
|
||||||
0 6
|
0 7
|
||||||
0000000000 65536 f
|
0000000000 00001 f
|
||||||
0000000016 00000 n
|
0000000016 00000 n
|
||||||
0000000062 00000 n
|
0000000062 00000 n
|
||||||
0000000114 00000 n
|
0000000114 00000 n
|
||||||
0000000227 00000 n
|
0000000227 00000 n
|
||||||
0000000448 00000 n
|
0000000448 00000 n
|
||||||
|
0000000546 00000 n
|
||||||
|
|
||||||
trailer
|
trailer
|
||||||
<</Size 6/Root 1 0 R>>
|
<</Size 7/Info 6 0 R/Root 1 0 R>>
|
||||||
startxref
|
startxref
|
||||||
546
|
699
|
||||||
%%EOF
|
%%EOF
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue