<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/pdf-to-images-001.xml"
        name="pdf-to-images-001.xml"
        expected="pass">
   <t:info>
      <t:title>pdf-to-images-001</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2026-06-11</t:date>
            <t:author>
               <t:name>Norm Tovey-Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Created test.</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests that pdf-to-images works.</p>
   </t:description>
   <t:pipeline>
      <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"/>
         <cx:pdf-to-images dpi="100">
            <p:with-input port="source" href="../documents/longer.pdf"/>
         </cx:pdf-to-images>
         <p:for-each>
            <p:cast-content-type content-type="application/xml">
               <p:with-input select="p:document-properties(.)"/>
            </p:cast-content-type>
         </p:for-each>
         <p:wrap-sequence wrapper="wrapper"/>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <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:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="wrapper">Wrong document element&gt;</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="/wrapper">
               <s:assert test="count(fn:map) = 2">Wrong number of maps</s:assert>
               <s:assert test="count(fn:map/fn:string[. = 'image/png']) = 2">Wrong content types</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="pdf-to-images-001.xml">
      <wrapper>
         <map xmlns="http://www.w3.org/2005/xpath-functions">
            <string key="content-type">image/png</string>
         </map>
         <map xmlns="http://www.w3.org/2005/xpath-functions">
            <string key="content-type">image/png</string>
         </map>
      </wrapper>
   </t:result>
</t:test>
