-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LDEV-2736 testcase for cfpdf - removewatermark didn't work
- Loading branch information
Showing
1 changed file
with
40 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,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); | ||
} | ||
} |