-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #795 from ndw/paged-media
Paged media tests
- Loading branch information
Showing
2 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="pass" features="p-css-formatter"> | ||
<t:info> | ||
<t:title>Test nw-css-formatter-001</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-12-28</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Initial commit.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests that <code>p:css-formatter</code> (appears to) work. There’s | ||
no actual attempt to test the result.</p> | ||
</t:description> | ||
|
||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
version="3.0"> | ||
<p:output port="result"/> | ||
|
||
<p:css-formatter content-type="application/pdf"> | ||
<p:with-input port="source"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<title>Hello, world</title> | ||
</head> | ||
<body> | ||
<p>I can haz PDF?</p> | ||
</body> | ||
</html> | ||
</p:with-input> | ||
<p:with-input port="stylesheet"> | ||
<p:inline content-type="text/css">p {{ color: red; }}</p:inline> | ||
</p:with-input> | ||
</p:css-formatter> | ||
|
||
<p:identity> | ||
<p:with-input select="p:document-properties(.)"/> | ||
</p:identity> | ||
|
||
<p:cast-content-type content-type="application/xml"/> | ||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron"> | ||
<s:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="fn:map">Root element is not 'map'.</s:assert> | ||
<s:assert test="fn:map/fn:string[@key='content-type'] = 'application/pdf'" | ||
>The content type is not application/pdf</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="pass" features="p-xsl-formatter"> | ||
<t:info> | ||
<t:title>Test nw-xsl-formatter-001</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-12-28</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Initial commit.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests that <code>p:xsl-formatter</code> (appears to) work. There’s | ||
no actual attempt to test the result.</p> | ||
</t:description> | ||
|
||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
version="3.0"> | ||
<p:output port="result"/> | ||
|
||
<p:xsl-formatter content-type="application/pdf"> | ||
<p:with-input port="source"> | ||
<fo:root xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:fo="http://www.w3.org/1999/XSL/Format"> | ||
<fo:layout-master-set> | ||
<fo:simple-page-master margin-bottom="0.125in" | ||
margin-left="0.125in" | ||
margin-right="0.125in" | ||
margin-top="0.125in" | ||
master-name="personal-envelope" | ||
page-height="3.625in" | ||
page-width="6.375in"> | ||
<fo:region-body margin-bottom="0in" margin-top="0in"/> | ||
</fo:simple-page-master> | ||
<fo:simple-page-master margin-bottom="0.125in" | ||
margin-left="0.125in" | ||
margin-right="0.125in" | ||
margin-top="0.125in" | ||
master-name="business-envelope" | ||
page-height="4.125in" | ||
page-width="9.5in"> | ||
<fo:region-body margin-bottom="0in" margin-top="0in"/> | ||
</fo:simple-page-master> | ||
<fo:page-sequence-master master-name="personal"> | ||
<fo:repeatable-page-master-alternatives> | ||
<fo:conditional-page-master-reference master-reference="personal-envelope" odd-or-even="odd"/> | ||
<fo:conditional-page-master-reference master-reference="personal-envelope" odd-or-even="even"/> | ||
</fo:repeatable-page-master-alternatives> | ||
</fo:page-sequence-master> | ||
<fo:page-sequence-master master-name="business"> | ||
<fo:repeatable-page-master-alternatives> | ||
<fo:conditional-page-master-reference master-reference="business-envelope" odd-or-even="odd"/> | ||
<fo:conditional-page-master-reference master-reference="business-envelope" odd-or-even="even"/> | ||
</fo:repeatable-page-master-alternatives> | ||
</fo:page-sequence-master> | ||
</fo:layout-master-set> | ||
<fo:page-sequence master-reference="business"> | ||
<fo:flow flow-name="xsl-region-body"> | ||
<fo:block> | ||
<fo:block>John Smith</fo:block> | ||
<fo:block linefeed-treatment="preserve">123 Main Street</fo:block> | ||
<fo:block>Anytown, SA 12345</fo:block> | ||
</fo:block> | ||
<fo:block margin-left="4in" margin-top="1in"> | ||
<fo:block>Jane Doe</fo:block> | ||
<fo:block linefeed-treatment="preserve">456 Random Street | ||
Suite 200</fo:block> | ||
<fo:block>Othertown, OA 67890</fo:block> | ||
</fo:block> | ||
</fo:flow> | ||
</fo:page-sequence> | ||
</fo:root> | ||
</p:with-input> | ||
</p:xsl-formatter> | ||
|
||
<p:identity> | ||
<p:with-input select="p:document-properties(.)"/> | ||
</p:identity> | ||
|
||
<p:cast-content-type content-type="application/xml"/> | ||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron"> | ||
<s:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="fn:map">Root element is not 'map'.</s:assert> | ||
<s:assert test="fn:map/fn:string[@key='content-type'] = 'application/pdf'" | ||
>The content type is not application/pdf</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |