mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-04 20:37:50 +00:00
Add another test case for weird page trees
This commit is contained in:
parent
0a470d2daf
commit
1fba24aada
@ -1802,8 +1802,8 @@ foreach my $f (qw(screen print))
|
||||
|
||||
show_ntests();
|
||||
# ----------
|
||||
$td->notify("--- Duplicated Page Object ---");
|
||||
$n_tests += 4;
|
||||
$td->notify("--- Page Tree Issues ---");
|
||||
$n_tests += 9;
|
||||
|
||||
$td->runtest("linearize duplicated pages",
|
||||
{$td->COMMAND =>
|
||||
@ -1823,6 +1823,31 @@ $td->runtest("extract duplicated pages",
|
||||
$td->runtest("compare files",
|
||||
{$td->FILE => "a.pdf"},
|
||||
{$td->FILE => "extract-duplicate-page.pdf"});
|
||||
$td->runtest("direct pages",
|
||||
{$td->COMMAND =>
|
||||
"qpdf --static-id direct-pages.pdf --pages . -- a.pdf"},
|
||||
{$td->STRING => "", $td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
$td->runtest("check output",
|
||||
{$td->FILE => "a.pdf"},
|
||||
{$td->FILE => "direct-pages-fixed.pdf"});
|
||||
$td->runtest("show direct pages",
|
||||
{$td->COMMAND =>
|
||||
"qpdf --show-pages direct-pages.pdf"},
|
||||
{$td->FILE => "direct-pages.out", $td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
|
||||
# Json mode for direct and duplicated pages illustrates that the
|
||||
# "objects" section still shows the original objects before correction
|
||||
# but the "pages" section shows the pages with their new object
|
||||
# numbers.
|
||||
foreach my $f (qw(page_api_2 direct-pages))
|
||||
{
|
||||
$td->runtest("json for $f",
|
||||
{$td->COMMAND => "qpdf --json $f.pdf"},
|
||||
{$td->FILE => "$f-json.out", $td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
}
|
||||
|
||||
show_ntests();
|
||||
# ----------
|
||||
@ -2542,7 +2567,7 @@ for (my $n = 16; $n <= 19; ++$n)
|
||||
show_ntests();
|
||||
# ----------
|
||||
$td->notify("--- Specific File Tests ---");
|
||||
$n_tests += 7;
|
||||
$n_tests += 4;
|
||||
|
||||
# Special PDF files that caused problems at some point
|
||||
|
||||
@ -2563,19 +2588,6 @@ $td->runtest("compress objstm and xref",
|
||||
$td->runtest("check output",
|
||||
{$td->FILE => "a.pdf"},
|
||||
{$td->FILE => "compress-objstm-xref.pdf"});
|
||||
$td->runtest("direct pages",
|
||||
{$td->COMMAND =>
|
||||
"qpdf --static-id direct-pages.pdf --pages . -- a.pdf"},
|
||||
{$td->STRING => "", $td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
$td->runtest("check output",
|
||||
{$td->FILE => "a.pdf"},
|
||||
{$td->FILE => "direct-pages-fixed.pdf"});
|
||||
$td->runtest("show direct pages",
|
||||
{$td->COMMAND =>
|
||||
"qpdf --show-pages direct-pages.pdf"},
|
||||
{$td->FILE => "direct-pages.out", $td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
|
||||
show_ntests();
|
||||
# ----------
|
||||
|
104
qpdf/qtest/qpdf/direct-pages-json.out
Normal file
104
qpdf/qtest/qpdf/direct-pages-json.out
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"acroform": {
|
||||
"fields": [],
|
||||
"hasacroform": false,
|
||||
"needappearances": false
|
||||
},
|
||||
"objects": {
|
||||
"1 0 R": {
|
||||
"/Pages": "2 0 R",
|
||||
"/Type": "/Catalog"
|
||||
},
|
||||
"2 0 R": {
|
||||
"/Count": 2,
|
||||
"/Kids": [
|
||||
{
|
||||
"/Contents": "3 0 R",
|
||||
"/MediaBox": [
|
||||
0,
|
||||
0,
|
||||
612,
|
||||
792
|
||||
],
|
||||
"/Parent": "2 0 R",
|
||||
"/Resources": {
|
||||
"/Font": {
|
||||
"/F1": "5 0 R"
|
||||
},
|
||||
"/ProcSet": "6 0 R"
|
||||
},
|
||||
"/Type": "/Page"
|
||||
},
|
||||
{
|
||||
"/Contents": "3 0 R",
|
||||
"/MediaBox": [
|
||||
0,
|
||||
0,
|
||||
612,
|
||||
792
|
||||
],
|
||||
"/Parent": "2 0 R",
|
||||
"/Resources": {
|
||||
"/Font": {
|
||||
"/F1": "5 0 R"
|
||||
},
|
||||
"/ProcSet": "6 0 R"
|
||||
},
|
||||
"/Type": "/Page"
|
||||
}
|
||||
],
|
||||
"/Type": "/Pages"
|
||||
},
|
||||
"3 0 R": {
|
||||
"/Length": "4 0 R"
|
||||
},
|
||||
"4 0 R": 44,
|
||||
"5 0 R": {
|
||||
"/BaseFont": "/Helvetica",
|
||||
"/Encoding": "/WinAnsiEncoding",
|
||||
"/Name": "/F1",
|
||||
"/Subtype": "/Type1",
|
||||
"/Type": "/Font"
|
||||
},
|
||||
"6 0 R": [
|
||||
"/PDF",
|
||||
"/Text"
|
||||
],
|
||||
"trailer": {
|
||||
"/ID": [
|
||||
"\u0013#¥fi|WzfsU…©6ŸÎ<",
|
||||
"7,¿DöÛ‹«`Ù&<\u000f\u000bÒj"
|
||||
],
|
||||
"/Root": "1 0 R",
|
||||
"/Size": 7
|
||||
}
|
||||
},
|
||||
"outlines": [],
|
||||
"pagelabels": [],
|
||||
"pages": [
|
||||
{
|
||||
"contents": [
|
||||
"3 0 R"
|
||||
],
|
||||
"images": [],
|
||||
"label": null,
|
||||
"object": "7 0 R",
|
||||
"outlines": [],
|
||||
"pageposfrom1": 1
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
"3 0 R"
|
||||
],
|
||||
"images": [],
|
||||
"label": null,
|
||||
"object": "8 0 R",
|
||||
"outlines": [],
|
||||
"pageposfrom1": 2
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"decodelevel": "generalized"
|
||||
},
|
||||
"version": 1
|
||||
}
|
127
qpdf/qtest/qpdf/page_api_2-json.out
Normal file
127
qpdf/qtest/qpdf/page_api_2-json.out
Normal file
@ -0,0 +1,127 @@
|
||||
{
|
||||
"acroform": {
|
||||
"fields": [],
|
||||
"hasacroform": false,
|
||||
"needappearances": false
|
||||
},
|
||||
"objects": {
|
||||
"1 0 R": {
|
||||
"/Pages": "3 0 R",
|
||||
"/Type": "/Catalog"
|
||||
},
|
||||
"10 0 R": 47,
|
||||
"2 0 R": {
|
||||
"/CreationDate": "D:20120621124041",
|
||||
"/Producer": "Apex PDFWriter"
|
||||
},
|
||||
"3 0 R": {
|
||||
"/Count": 3,
|
||||
"/Kids": [
|
||||
"4 0 R",
|
||||
"4 0 R",
|
||||
"5 0 R"
|
||||
],
|
||||
"/Type": "/Pages"
|
||||
},
|
||||
"4 0 R": {
|
||||
"/Contents": "6 0 R",
|
||||
"/MediaBox": [
|
||||
0,
|
||||
0,
|
||||
612,
|
||||
792
|
||||
],
|
||||
"/Parent": "3 0 R",
|
||||
"/Resources": {
|
||||
"/Font": {
|
||||
"/F1": "8 0 R"
|
||||
},
|
||||
"/ProcSet": [
|
||||
"/PDF",
|
||||
"/Text"
|
||||
]
|
||||
},
|
||||
"/Type": "/Page"
|
||||
},
|
||||
"5 0 R": {
|
||||
"/Contents": "9 0 R",
|
||||
"/MediaBox": [
|
||||
0,
|
||||
0,
|
||||
612,
|
||||
792
|
||||
],
|
||||
"/Parent": "3 0 R",
|
||||
"/Resources": {
|
||||
"/Font": {
|
||||
"/F1": "8 0 R"
|
||||
},
|
||||
"/ProcSet": [
|
||||
"/PDF",
|
||||
"/Text"
|
||||
]
|
||||
},
|
||||
"/Type": "/Page"
|
||||
},
|
||||
"6 0 R": {
|
||||
"/Length": "7 0 R"
|
||||
},
|
||||
"7 0 R": 47,
|
||||
"8 0 R": {
|
||||
"/BaseFont": "/Times-Roman",
|
||||
"/Encoding": "/WinAnsiEncoding",
|
||||
"/Subtype": "/Type1",
|
||||
"/Type": "/Font"
|
||||
},
|
||||
"9 0 R": {
|
||||
"/Length": "10 0 R"
|
||||
},
|
||||
"trailer": {
|
||||
"/ID": [
|
||||
"û\u0018·ƒÿ{5⁄\u0005Ú−S*º‘o",
|
||||
"÷\u0017ž³QY¿ÔÀ\u000f\u0012−¼ý\u001f\u0002"
|
||||
],
|
||||
"/Info": "2 0 R",
|
||||
"/Root": "1 0 R",
|
||||
"/Size": 11
|
||||
}
|
||||
},
|
||||
"outlines": [],
|
||||
"pagelabels": [],
|
||||
"pages": [
|
||||
{
|
||||
"contents": [
|
||||
"6 0 R"
|
||||
],
|
||||
"images": [],
|
||||
"label": null,
|
||||
"object": "4 0 R",
|
||||
"outlines": [],
|
||||
"pageposfrom1": 1
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
"6 0 R"
|
||||
],
|
||||
"images": [],
|
||||
"label": null,
|
||||
"object": "11 0 R",
|
||||
"outlines": [],
|
||||
"pageposfrom1": 2
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
"9 0 R"
|
||||
],
|
||||
"images": [],
|
||||
"label": null,
|
||||
"object": "5 0 R",
|
||||
"outlines": [],
|
||||
"pageposfrom1": 3
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"decodelevel": "generalized"
|
||||
},
|
||||
"version": 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user