Fix --check-linearization of non-linearized files (fixes #615)

This commit is contained in:
m-holger 2022-02-04 00:02:05 +00:00 committed by Jay Berkenbilt
parent 4d507251fe
commit 1925ffd467
2 changed files with 15 additions and 1 deletions

View File

@ -1979,7 +1979,12 @@ QPDFJob::doInspection(QPDF& pdf)
}
if (m->check_linearization)
{
if (pdf.checkLinearization())
if (! pdf.isLinearized())
{
*(this->m->cout)
<< m->infilename << " is not linearized" << std::endl;
}
else if (pdf.checkLinearization())
{
*(this->m->cout)
<< m->infilename << ": no linearization errors" << std::endl;

View File

@ -4486,6 +4486,15 @@ $td->runtest("check linearization",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
# Test --check-linearization of non-linearized file
$n_tests += 1;
$td->runtest("check linearization of non-linearized file",
{$td->COMMAND => "qpdf --check-linearization minimal.pdf"},
{$td->STRING => "minimal.pdf is not linearized\n",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
# Test AES encryption in various ways.
$n_tests += 18;
$td->runtest("encrypt with AES",