diff --git a/tests/LDEV2736.cfc b/tests/LDEV2736.cfc new file mode 100644 index 0000000..d23ea8d --- /dev/null +++ b/tests/LDEV2736.cfc @@ -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
"); + writeoutput(''); + } + } + + 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); + } +} \ No newline at end of file