2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

Avoid depending on exact xref stream offsets

For the modified test case, we care about successful recovery, not
about the exact offsets. Add a filter to remove the specific numbers
from show-xref.
This commit is contained in:
Jay Berkenbilt 2023-12-20 13:28:42 -05:00
parent d61612a2e5
commit 7e679ab8b6
3 changed files with 14 additions and 5 deletions

View File

@ -0,0 +1,8 @@
use warnings;
use strict;
while (<>)
{
s/(uncompressed; offset =) \d+/$1 .../;
print;
}

View File

@ -1,4 +1,4 @@
1/0: uncompressed; offset = 15
1/0: uncompressed; offset = ...
2/0: compressed; stream = 1, index = 0
3/0: compressed; stream = 1, index = 1
4/0: compressed; stream = 1, index = 2
@ -8,6 +8,6 @@
8/0: compressed; stream = 1, index = 6
9/0: compressed; stream = 1, index = 7
10/0: compressed; stream = 1, index = 8
11/0: uncompressed; offset = 674
12/0: uncompressed; offset = 801
13/0: uncompressed; offset = 16194
11/0: uncompressed; offset = ...
12/0: uncompressed; offset = ...
13/0: uncompressed; offset = ...

View File

@ -28,7 +28,8 @@ $td->runtest("recover xref with short size",
$td->EXIT_STATUS => 3},
$td->NORMALIZE_NEWLINES);
$td->runtest("show new xref stream",
{$td->COMMAND => "qpdf --show-xref a.pdf"},
{$td->COMMAND => "qpdf --show-xref a.pdf",
$td->FILTER => "perl filter-xref-offsets.pl"},
{$td->FILE => "xref-with-short-size-new.out",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);