mirror of
https://github.com/qpdf/qpdf.git
synced 2025-02-02 03:48:24 +00:00
Test inline stream data with different decode levels
This commit is contained in:
parent
f08f398920
commit
2e87d593eb
2
TODO
2
TODO
@ -50,8 +50,6 @@ Output JSON v2
|
||||
|
||||
General things to remember:
|
||||
|
||||
* Test inline and file stream data.
|
||||
|
||||
* Make sure all the information from --check and other informational
|
||||
options (--show-linearization, --show-encryption, --show-xref,
|
||||
--list-attachments, --show-npages) is available in the json output.
|
||||
|
@ -6,6 +6,7 @@ use Cwd;
|
||||
use Digest::MD5;
|
||||
use File::Basename;
|
||||
use File::Copy;
|
||||
use File::Compare;
|
||||
use File::Spec;
|
||||
|
||||
unshift(@INC, '../../libtests/qtest/arg_parser');
|
||||
@ -1110,7 +1111,7 @@ my @json_files = (
|
||||
['V4-aes', ['--json-key=encrypt']],
|
||||
['V4-aes', ['--json-key=encrypt', '--show-encryption-key']],
|
||||
);
|
||||
$n_tests += 5 + (2 * scalar(@json_files));
|
||||
$n_tests += 24 + (2 * scalar(@json_files));
|
||||
foreach my $d (@json_files)
|
||||
{
|
||||
my ($file, $xargs) = @$d;
|
||||
@ -1170,6 +1171,64 @@ $td->runtest("check stream (file)",
|
||||
{$td->FILE => "auto-4"},
|
||||
{$td->FILE => "bad-data-4.out"});
|
||||
|
||||
foreach my $l (qw(none generalized specialized all))
|
||||
{
|
||||
if ($l ne 'all')
|
||||
{
|
||||
# We don't want a dependency on the exact value of the
|
||||
# uncompressed jpeg, which can differ depending on which jpeg
|
||||
# library is use.
|
||||
$td->runtest("image-streams json inline: $l",
|
||||
{$td->COMMAND =>
|
||||
"qpdf image-streams-small.pdf --json=2" .
|
||||
" --decode-level=$l --json-stream-data=inline"},
|
||||
{$td->FILE => "json-image-streams-$l-inline-v2.out",
|
||||
$td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
}
|
||||
$td->runtest("image-streams json file: $l",
|
||||
{$td->COMMAND =>
|
||||
"qpdf image-streams-small.pdf --json=2" .
|
||||
" --decode-level=$l --json-stream-data=file" .
|
||||
" --json-stream-prefix=auto --json-key=qpdf" .
|
||||
" --json-object=12 --json-object=16 --json-object=18"},
|
||||
{$td->FILE => "json-image-streams-$l-file-v2.out",
|
||||
$td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
# object 12: /FlateDecode
|
||||
# object 16: /DCTDecode
|
||||
# object 18: /RunLengthDecode
|
||||
my %exp_compression = (
|
||||
'12' => {'none' => 1},
|
||||
'16' => {'none' => 1, 'generalized' => 1, 'specialized' => 1},
|
||||
'18' => {'none' => 1, 'generalized' => 1},
|
||||
);
|
||||
|
||||
foreach my $obj (qw(12 16 18))
|
||||
{
|
||||
my $compressed = (exists $exp_compression{$obj}{$l});
|
||||
my $suf = $compressed ? "compressed" : "uncompressed";
|
||||
if (($obj eq '16') && (! $compressed))
|
||||
{
|
||||
# Rather than testing the uncompressed DCT, just make sure
|
||||
# it is different from the compressed DCT.
|
||||
my $same = (compare(
|
||||
"auto-$obj",
|
||||
"image-streams-small-$obj-compressed.out") ?
|
||||
"same" : "different");
|
||||
$td->runtest("check stream data ($obj, $l)",
|
||||
{$td->STRING => $same},
|
||||
{$td->STRING => "same"});
|
||||
}
|
||||
else
|
||||
{
|
||||
$td->runtest("check stream data ($obj, $l)",
|
||||
{$td->FILE => "auto-$obj"},
|
||||
{$td->FILE => "image-streams-small-$obj-$suf.out"});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
show_ntests();
|
||||
# ----------
|
||||
$td->notify("--- Page API Tests ---");
|
||||
|
BIN
qpdf/qtest/qpdf/image-streams-small-12-compressed.out
Normal file
BIN
qpdf/qtest/qpdf/image-streams-small-12-compressed.out
Normal file
Binary file not shown.
2
qpdf/qtest/qpdf/image-streams-small-12-uncompressed.out
Normal file
2
qpdf/qtest/qpdf/image-streams-small-12-uncompressed.out
Normal file
@ -0,0 +1,2 @@
|
||||
BT /F1 24 Tf 72 320 Td (/DeviceCMYK with filter null) Tj ET
|
||||
q 244 0 0 144 184 100 cm /Im1 Do Q
|
BIN
qpdf/qtest/qpdf/image-streams-small-16-compressed.out
Normal file
BIN
qpdf/qtest/qpdf/image-streams-small-16-compressed.out
Normal file
Binary file not shown.
After Width: | Height: | Size: 454 B |
BIN
qpdf/qtest/qpdf/image-streams-small-18-compressed.out
Normal file
BIN
qpdf/qtest/qpdf/image-streams-small-18-compressed.out
Normal file
Binary file not shown.
BIN
qpdf/qtest/qpdf/image-streams-small-18-uncompressed.out
Normal file
BIN
qpdf/qtest/qpdf/image-streams-small-18-uncompressed.out
Normal file
Binary file not shown.
44
qpdf/qtest/qpdf/json-image-streams-all-file-v2.out
Normal file
44
qpdf/qtest/qpdf/json-image-streams-all-file-v2.out
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"version": 2,
|
||||
"parameters": {
|
||||
"decodelevel": "all"
|
||||
},
|
||||
"qpdf": {
|
||||
"jsonversion": 2,
|
||||
"pdfversion": "1.3",
|
||||
"objects": {
|
||||
"obj:12 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-12",
|
||||
"dict": {}
|
||||
}
|
||||
},
|
||||
"obj:16 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-16",
|
||||
"dict": {
|
||||
"/BitsPerComponent": 8,
|
||||
"/ColorSpace": "/DeviceCMYK",
|
||||
"/Height": 48,
|
||||
"/Subtype": "/Image",
|
||||
"/Type": "/XObject",
|
||||
"/Width": 40
|
||||
}
|
||||
}
|
||||
},
|
||||
"obj:18 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-18",
|
||||
"dict": {
|
||||
"/BitsPerComponent": 8,
|
||||
"/ColorSpace": "/DeviceCMYK",
|
||||
"/Height": 48,
|
||||
"/Subtype": "/Image",
|
||||
"/Type": "/XObject",
|
||||
"/Width": 40
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
46
qpdf/qtest/qpdf/json-image-streams-generalized-file-v2.out
Normal file
46
qpdf/qtest/qpdf/json-image-streams-generalized-file-v2.out
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"version": 2,
|
||||
"parameters": {
|
||||
"decodelevel": "generalized"
|
||||
},
|
||||
"qpdf": {
|
||||
"jsonversion": 2,
|
||||
"pdfversion": "1.3",
|
||||
"objects": {
|
||||
"obj:12 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-12",
|
||||
"dict": {}
|
||||
}
|
||||
},
|
||||
"obj:16 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-16",
|
||||
"dict": {
|
||||
"/BitsPerComponent": 8,
|
||||
"/ColorSpace": "/DeviceCMYK",
|
||||
"/Filter": "/DCTDecode",
|
||||
"/Height": 48,
|
||||
"/Subtype": "/Image",
|
||||
"/Type": "/XObject",
|
||||
"/Width": 40
|
||||
}
|
||||
}
|
||||
},
|
||||
"obj:18 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-18",
|
||||
"dict": {
|
||||
"/BitsPerComponent": 8,
|
||||
"/ColorSpace": "/DeviceCMYK",
|
||||
"/Filter": "/RunLengthDecode",
|
||||
"/Height": 48,
|
||||
"/Subtype": "/Image",
|
||||
"/Type": "/XObject",
|
||||
"/Width": 40
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
736
qpdf/qtest/qpdf/json-image-streams-generalized-inline-v2.out
Normal file
736
qpdf/qtest/qpdf/json-image-streams-generalized-inline-v2.out
Normal file
File diff suppressed because one or more lines are too long
48
qpdf/qtest/qpdf/json-image-streams-none-file-v2.out
Normal file
48
qpdf/qtest/qpdf/json-image-streams-none-file-v2.out
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"version": 2,
|
||||
"parameters": {
|
||||
"decodelevel": "none"
|
||||
},
|
||||
"qpdf": {
|
||||
"jsonversion": 2,
|
||||
"pdfversion": "1.3",
|
||||
"objects": {
|
||||
"obj:12 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-12",
|
||||
"dict": {
|
||||
"/Filter": "/FlateDecode"
|
||||
}
|
||||
}
|
||||
},
|
||||
"obj:16 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-16",
|
||||
"dict": {
|
||||
"/BitsPerComponent": 8,
|
||||
"/ColorSpace": "/DeviceCMYK",
|
||||
"/Filter": "/DCTDecode",
|
||||
"/Height": 48,
|
||||
"/Subtype": "/Image",
|
||||
"/Type": "/XObject",
|
||||
"/Width": 40
|
||||
}
|
||||
}
|
||||
},
|
||||
"obj:18 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-18",
|
||||
"dict": {
|
||||
"/BitsPerComponent": 8,
|
||||
"/ColorSpace": "/DeviceCMYK",
|
||||
"/Filter": "/RunLengthDecode",
|
||||
"/Height": 48,
|
||||
"/Subtype": "/Image",
|
||||
"/Type": "/XObject",
|
||||
"/Width": 40
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
757
qpdf/qtest/qpdf/json-image-streams-none-inline-v2.out
Normal file
757
qpdf/qtest/qpdf/json-image-streams-none-inline-v2.out
Normal file
File diff suppressed because one or more lines are too long
45
qpdf/qtest/qpdf/json-image-streams-specialized-file-v2.out
Normal file
45
qpdf/qtest/qpdf/json-image-streams-specialized-file-v2.out
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"version": 2,
|
||||
"parameters": {
|
||||
"decodelevel": "specialized"
|
||||
},
|
||||
"qpdf": {
|
||||
"jsonversion": 2,
|
||||
"pdfversion": "1.3",
|
||||
"objects": {
|
||||
"obj:12 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-12",
|
||||
"dict": {}
|
||||
}
|
||||
},
|
||||
"obj:16 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-16",
|
||||
"dict": {
|
||||
"/BitsPerComponent": 8,
|
||||
"/ColorSpace": "/DeviceCMYK",
|
||||
"/Filter": "/DCTDecode",
|
||||
"/Height": 48,
|
||||
"/Subtype": "/Image",
|
||||
"/Type": "/XObject",
|
||||
"/Width": 40
|
||||
}
|
||||
}
|
||||
},
|
||||
"obj:18 0 R": {
|
||||
"stream": {
|
||||
"datafile": "auto-18",
|
||||
"dict": {
|
||||
"/BitsPerComponent": 8,
|
||||
"/ColorSpace": "/DeviceCMYK",
|
||||
"/Height": 48,
|
||||
"/Subtype": "/Image",
|
||||
"/Type": "/XObject",
|
||||
"/Width": 40
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
733
qpdf/qtest/qpdf/json-image-streams-specialized-inline-v2.out
Normal file
733
qpdf/qtest/qpdf/json-image-streams-specialized-inline-v2.out
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user