Skip to content

Commit

Permalink
LDEV-2736 testcase for cfpdf - removewatermark didn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed May 23, 2024
1 parent 49ddb3a commit 2486efd
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/LDEV2736.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
component extends="org.lucee.cfml.test.LuceeTestCase" labels="pdf" {

function beforeAll() {
variables.dir = getTempDirectory() & "/LDEV2256";
if (!directoryExists(variables.dir)) directoryCreate(variables.dir);

document filename="#variables.dir#/main.pdf",overwrite="true",format="pdf" {
writeoutput("test main pdf");
}

document filename="#variables.dir#/copyFrom.pdf" overwrite="true" format="pdf" name="copyFrom" {
writeoutput("test watermark pdf <br>");
writeoutput('<img src="https://raw.githubusercontent.com/lucee/Lucee/6.0/test/functions/images/lucee.png">');
}
}

function run( testResults , testBox ) {
describe( "Testcase for LDEV-2736", function() {
it( title="cfpdf - removewatermark didn't work", body = function( currentSpec ) {
pdf action="addwatermark" source="#variables.dir#/main.pdf" copyFrom="#variables.dir#/copyFrom.pdf" name="local.name";

expect( function(){
pdf action="removewatermark" source="#variables.dir#/main.pdf"; //needs name or destination
}).toThrow();

pdf action="removewatermark" source="#variables.dir#/main.pdf" name="local.out";
expect( isPDFObject( out ) ).toBeTrue();

var dest = "#variables.dir#/removed.pdf";
pdf action="removewatermark" source="#variables.dir#/main.pdf" destination="#dest#";

expect( isPDFObject(dest)).toBeTrue();
});
});
}

function afterAll() {
if (directoryExists(variables.dir)) directoryDelete(variables.dir, true);
}
}

0 comments on commit 2486efd

Please sign in to comment.