mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-15 17:17:08 +00:00
Add tests for PCLm
Files written in PCLm mode have to be created in a very specific way. qpdf doesn't know how to create PCLm files from scratch. All it knows how to do is to write an already valid file in a suitable way. Therefore there is no command-line support for PCLm.
This commit is contained in:
parent
4b908ade70
commit
f08ce00e62
@ -917,6 +917,19 @@ $td->runtest("check output",
|
|||||||
{$td->FILE => "from-scratch-0.pdf"});
|
{$td->FILE => "from-scratch-0.pdf"});
|
||||||
show_ntests();
|
show_ntests();
|
||||||
# ----------
|
# ----------
|
||||||
|
$td->notify("--- PCLm ---");
|
||||||
|
$n_tests += 2;
|
||||||
|
|
||||||
|
$td->runtest("write as PCLm",
|
||||||
|
{$td->COMMAND => "test_driver 40 pclm-in.pdf a.pdf"},
|
||||||
|
{$td->STRING => "test 40 done\n", $td->EXIT_STATUS => 0},
|
||||||
|
$td->NORMALIZE_NEWLINES);
|
||||||
|
$td->runtest("check output",
|
||||||
|
{$td->FILE => "a.pdf"},
|
||||||
|
{$td->FILE => "pclm-out.pdf"});
|
||||||
|
|
||||||
|
show_ntests();
|
||||||
|
# ----------
|
||||||
$td->notify("--- Precheck streams ---");
|
$td->notify("--- Precheck streams ---");
|
||||||
$n_tests += 2;
|
$n_tests += 2;
|
||||||
|
|
||||||
|
5678
qpdf/qtest/qpdf/pclm-in.pdf
Normal file
5678
qpdf/qtest/qpdf/pclm-in.pdf
Normal file
File diff suppressed because one or more lines are too long
8583
qpdf/qtest/qpdf/pclm-out.pdf
Normal file
8583
qpdf/qtest/qpdf/pclm-out.pdf
Normal file
File diff suppressed because one or more lines are too long
@ -1334,6 +1334,18 @@ void runtest(int n, char const* filename1, char const* arg2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (n == 40)
|
||||||
|
{
|
||||||
|
// Write PCLm. This requires specially crafted PDF files. This
|
||||||
|
// feature was implemented by Sahil Arora
|
||||||
|
// <sahilarora.535@gmail.com> as part of a Google Summer of
|
||||||
|
// Code project in 2017.
|
||||||
|
assert(arg2 != 0);
|
||||||
|
QPDFWriter w(pdf, arg2);
|
||||||
|
w.setPCLm(true);
|
||||||
|
w.setStaticID(true);
|
||||||
|
w.write();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw std::runtime_error(std::string("invalid test ") +
|
throw std::runtime_error(std::string("invalid test ") +
|
||||||
|
Loading…
Reference in New Issue
Block a user