Skip to content

Commit

Permalink
Merge pull request lucee#486 from MitrahSoft/LDEV-1850
Browse files Browse the repository at this point in the history
Added test case for LDEV-1850
  • Loading branch information
micstriit authored May 24, 2018
2 parents 010c066 + 5633a63 commit 459a56e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/tickets/LDEV1850.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
component extends="org.lucee.cfml.test.LuceeTestCase"{
function run( testResults , testBox ) {
describe( title="Test suite for LDEV-1850", body=function() {
it( title='checking cfpdf action="ddxfile" ', body=function( currentSpec ) {
var uri = createURI("LDEV1850");
var result = _InternalRequest(
template:"#uri#/test.cfm"
);
expect(result.filecontent.trim()).toBe('successful');
});
});
}

private string function createURI(string calledName){
var baseURI = "/test/#listLast(getDirectoryFromPath(getCurrenttemplatepath()),"\/")#/";
return baseURI & "" & calledName;
}
}
30 changes: 30 additions & 0 deletions test/tickets/LDEV1850/test.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<cfoutput>
<cfset passwordPdf = "lucee-test">
<cfdocument filename="testLucee.pdf" userpassword="#passwordPdf#" encryption="128-bit" format="pdf" overwrite="yes">
Lucee PDF
</cfdocument>
<cfset temp=structnew()>
<cfset strDocumentWithPath = "testLucee.pdf">

<cfset temp.pwFiacWord="#passwordPdf#">
<cfset temp.outfile = replacenocase(strDocumentWithPath,".pdf","down.pdf")>

<cfsavecontent variable="temp.myddx">
<?xml version="1.0" encoding="UTF-8"?>
<DDX xmlns="http://ns.adobe.com/DDX/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd">
<PDF result="OUTpdf">
<PDF source="INpdf" access="fiacPDF"/></PDF>
<PasswordAccessProfile name="fiacPDF">
<Password>#temp.pwFiacWord#</Password>
</PasswordAccessProfile>
</DDX>
</cfsavecontent>

<cfset temp.myddx = trim(temp.myddx)>

<cfset temp.inputStruct = {INpdf="#strDocumentWithPath#"}>
<cfset temp.outputStruct = {OUTpdf="#temp.outfile#"}>
<cfpdf action="processddx" ddxfile="#temp.myddx#" inputfiles="#temp.inputStruct#" outputfiles="#temp.outputStruct#" name="temp.ddxVar">

#temp.ddxVar.OUTPDF#
</cfoutput>

0 comments on commit 459a56e

Please sign in to comment.