Tests that pdf-decrypt works.
Test pdf-decrypt-001.xml is expected to pass.
<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:p="http://www.w3.org/ns/xproc" name="main" version="3.0">
<p:import href="https://xmlcalabash.com/ext/library/pdf-steps.xpl"/>
<p:output port="result"/>
<p:try name="nopass">
<cx:pdf-info>
<p:with-input href="../documents/encrypted.pdf"/>
</cx:pdf-info>
<p:catch>
<p:identity>
<p:with-input>
<result>Failed to load without password</result>
</p:with-input>
</p:identity>
</p:catch>
</p:try>
<cx:pdf-info name="info" password="sekrit">
<p:with-input href="../documents/encrypted.pdf"/>
</cx:pdf-info>
<p:wrap-sequence wrapper="wrapper">
<p:with-input pipe="@nopass @info"/>
</p:wrap-sequence>
</p:declare-step>
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<s:ns prefix="cx" uri="http://xmlcalabash.com/ns/extensions"/>
<s:ns prefix="f" uri="http://xmlcalabash.com/ns/acro-form"/>
<s:pattern>
<s:rule context="/">
<s:assert test="wrapper">Wrong document element></s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/wrapper">
<s:assert test="count(result) = 1">Wrong number of result outputs</s:assert>
<s:assert test="count(cx:pdf-info) = 1">Wrong number of PDF outputs</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/wrapper/result">
<s:assert test="contains(., 'Failed to load without password')">Wrong message</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/wrapper/cx:pdf-info">
<s:assert test="cx:encrypted = 'true'">Encrypted value incorrect</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Created test.