Skip to content

Commit

Permalink
Merge pull request #50 from lucee/test-ldev1004
Browse files Browse the repository at this point in the history
LDEV-1004 test case
  • Loading branch information
zspitzer authored Nov 11, 2022
2 parents d4c80ea + c8ba409 commit 883f3e3
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/LDEV1004.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
component extends="org.lucee.cfml.test.LuceeTestCase" labels="pdf" skip="true"{
function run( testResults, testBox ) {
describe("Testcase for LDEV-1004", function() {
it( title="check placeholders are resolved", body=function( currentSpec ) {

local.result = _internalRequest(
template : "#createURI("LDEV1004")#/placeholders.cfm"
);
local.pdf=local.result.filecontent_binary;
expect( isPDFObject( pdf ) ).toBeTrue();

pdf action="extracttext" source="#pdf#" name="local.extractedText";

expect( extractedText ).notToInclude("currentPageNumber", "placeholder [currentPageNumber] should be resolved");
expect( extractedText ).notToInclude("totalPageCount", "placeholder [currentPageNumber] should be resolved");
expect( extractedText ).notToInclude("totalSectionPageCount", "placeholder [totalSectionPageCount] should be resolved");
expect( extractedText ).notToInclude("currentSectionPageNumber", "placeholder [currentSectionPageNumber] should be resolved");

});
});
}

private string function createURI(string calledName){

var baseURI = getDirectoryFromPath( contractPath( getCurrentTemplatePath() ) );
return baseURI&""&calledName;
}
}
37 changes: 37 additions & 0 deletions tests/LDEV1004/placeholders.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!--- https://dev.lucee.org/t/cfdocument-error-on-total-page-count/2102 --->
<cfdocument format="pdf">
<cfdocumentitem type="header" evalatprint="false">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<strong><tr><td align="right"><cfoutput>#cfdocument.currentSectionPageNumber# of</strong>
<strong>#cfdocument.totalSectionPageCount#</cfoutput></td></tr></strong>
</table>
</cfdocumentitem>

<cfdocumentitem type="footer" evalatprint="true">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<strong><tr><td align="center"><cfoutput>#cfdocument.currentPageNumber# of</strong>
<strong>#cfdocument.totalPageCount#</cfoutput></td></tr></strong>
</table>
</cfdocumentitem>

<cfdocumentsection>
<h1>Section 1</h1>
<cfloop from=1 to=5 index="i">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<p>
</cfloop>
</cfdocumentsection>

<cfdocumentsection>
<h1>Section 2</h1>
<cfloop from=1 to=5 index="i">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<p>
</cfloop>
</cfdocumentsection>

<cfdocumentsection>
<h1>Section 3</h1>
<cfloop from=1 to=5 index="i">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<p>
</cfloop>
</cfdocumentsection>
</cfdocument>

0 comments on commit 883f3e3

Please sign in to comment.