Commit 290742b069756218cd9d2075ea18b9fa60fc56ca

Authored by Jay Berkenbilt
Committed by GitHub
2 parents b0b6d9f2 9146f1f0

Merge pull request #1070 from m-holger/flate

Change default for SF_FlateLzwDecode::columns to 1
libqpdf/SF_FlateLzwDecode.cc
@@ -11,7 +11,7 @@ SF_FlateLzwDecode::SF_FlateLzwDecode(bool lzw) : @@ -11,7 +11,7 @@ SF_FlateLzwDecode::SF_FlateLzwDecode(bool lzw) :
11 lzw(lzw), 11 lzw(lzw),
12 // Initialize values to their defaults as per the PDF spec 12 // Initialize values to their defaults as per the PDF spec
13 predictor(1), 13 predictor(1),
14 - columns(0), 14 + columns(1),
15 colors(1), 15 colors(1),
16 bits_per_component(8), 16 bits_per_component(8),
17 early_code_change(true) 17 early_code_change(true)
qpdf/qtest/qpdf/png-filters-1-column.pdf 0 โ†’ 100644
No preview for this file type
qpdf/qtest/qpdf/png-filters-no-columns-decoded.pdf 0 โ†’ 100644
No preview for this file type
qpdf/qtest/qpdf/png-filters-no-columns.pdf 0 โ†’ 100644
No preview for this file type
qpdf/qtest/specialized-filter.test
@@ -16,7 +16,7 @@ cleanup(); @@ -16,7 +16,7 @@ cleanup();
16 16
17 my $td = new TestDriver('specialized-filter'); 17 my $td = new TestDriver('specialized-filter');
18 18
19 -my $n_tests = 3; 19 +my $n_tests = 5;
20 my $n_compare_pdfs = 1; 20 my $n_compare_pdfs = 1;
21 21
22 # The PDF file was submitted on bug #83 on github. All the PNG filters 22 # The PDF file was submitted on bug #83 on github. All the PNG filters
@@ -39,6 +39,18 @@ $td->runtest("stream with tiff predictor", @@ -39,6 +39,18 @@ $td->runtest("stream with tiff predictor",
39 {$td->FILE => "tiff-predictor.out", 39 {$td->FILE => "tiff-predictor.out",
40 $td->EXIT_STATUS => 0}, 40 $td->EXIT_STATUS => 0},
41 $td->NORMALIZE_NEWLINES); 41 $td->NORMALIZE_NEWLINES);
42 - 42 +# TC:SF_FlateLzwDecode PNG filter
  43 +# PDF:Table 8:Columns
  44 +# The test file is invalid as it does not actually use one column (as is implied by the missing
  45 +# key). However png-filters-1-column.pdf is the same file with /Columns explicitely set to 1,
  46 +# and displays the same as png-filters-no-columns.pdf and png-filters-no-columns-decoded.pdf.
  47 +$td->runtest("decode flate no /Columns",
  48 + {$td->COMMAND => "qpdf --static-id --compress-streams=n --decode-level=all" .
  49 + " png-filters-no-columns.pdf a.pdf"},
  50 + {$td->STRING => "", $td->EXIT_STATUS => 0},
  51 + $td->NORMALIZE_NEWLINES);
  52 +$td->runtest("check output",
  53 + {$td->FILE => "a.pdf"},
  54 + {$td->FILE => "png-filters-no-columns-decoded.pdf"});
43 cleanup(); 55 cleanup();
44 $td->report(calc_ntests($n_tests, $n_compare_pdfs)); 56 $td->report(calc_ntests($n_tests, $n_compare_pdfs));