1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 02:10:45 +00:00

LibPDF: Add (automated!) test for outline encoding

Manually added an Outlines dict with three items, one each for
every text string encoding in its title.

(Preview.app apparently can't handle UTF-8 in outlines either.)
This commit is contained in:
Nico Weber 2023-11-21 20:34:23 -05:00 committed by Andrew Kaster
parent d345c5b793
commit 8ee0c75f43
2 changed files with 38 additions and 11 deletions

View File

@ -57,6 +57,13 @@ TEST_CASE(encodig)
// FIXME: Make this pass.
// EXPECT_EQ(MUST(info_dict.title()).value(), (char const*)u8"Êñ©•ding test");
auto outline_dict = document->outline();
EXPECT_EQ(outline_dict->count, 3u);
EXPECT_EQ(outline_dict->children[0]->title, (char const*)u8"Titlè 1");
// FIXME: Make this pass:
// EXPECT_EQ(outline_dict->children[1]->title, (char const*)u8"Titlè 2");
EXPECT_EQ(outline_dict->children[2]->title, (char const*)u8"Titlè 3");
}
TEST_CASE(truncated_pdf_header_issue_10717)

View File

@ -1,8 +1,8 @@
%PDF-1.7
%PDF-2.0
%µ¶
1 0 obj
<</Type/Catalog/Pages 2 0 R>>
<</Type/Catalog/Pages 2 0 R/Outlines 10 0 R>>
endobj
2 0 obj
@ -36,18 +36,38 @@ endobj
<</Author<FEFF004E00690063006F002000570065006200650072>/Producer(\357\273\277Man\303\274ally Created)/Title(\312\361\251\200ding test)>>
endobj
7 0 obj
<</Title<FEFF005400690074006C00E800200031>/Parent 10 0 R/Next 8 0 R>>
endobj
8 0 obj
<</Title(Titl\350 2)/Parent 10 0 R/Prev 7 0 R/Next 9 0 R>>
endobj
9 0 obj
<</Title<EFBBBF5469746CC3A82033>/Parent 10 0 R/Prev 8 0 R>>
endobj
10 0 obj
<</Count 3/First 7 0 R/Last 9 0 R>>
endobj
xref
0 7
0000000000 00001 f
0 11
0000000000 65536 f
0000000016 00000 n
0000000062 00000 n
0000000114 00000 n
0000000227 00000 n
0000000448 00000 n
0000000546 00000 n
0000000078 00000 n
0000000130 00000 n
0000000243 00000 n
0000000464 00000 n
0000000562 00000 n
0000000715 00000 n
0000000801 00000 n
0000000876 00000 n
0000000952 00000 n
trailer
<</Size 7/Info 6 0 R/Root 1 0 R>>
<</Size 11/Info 6 0 R/Root 1 0 R>>
startxref
699
1005
%%EOF