From bf83a30f9bf146cc2e8751b33c3973bbc3582f1a Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Thu, 14 Sep 2023 09:03:34 +0200 Subject: [PATCH] LDEV-4692 test case for pdf protect / removePassword https://luceeserver.atlassian.net/browse/LDEV-4692 --- build.number | 4 ++-- tests/LDEV4692.cfc | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 tests/LDEV4692.cfc diff --git a/build.number b/build.number index 65b4cbd..c43ab65 100644 --- a/build.number +++ b/build.number @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Fri Sep 08 09:45:49 CEST 2023 -build.number=7 +#Thu Sep 14 09:02:27 CEST 2023 +build.number=8 diff --git a/tests/LDEV4692.cfc b/tests/LDEV4692.cfc new file mode 100644 index 0000000..e5e17ab --- /dev/null +++ b/tests/LDEV4692.cfc @@ -0,0 +1,39 @@ +component extends="org.lucee.cfml.test.LuceeTestCase" labels="pdf" { + + function beforeAll() { + + variables.testPdf = getTempFile( getTempDirectory(), "ldev4692", "pdf" ); + variables.testCode = createUniqueID(); + variables.password = createUniqueID(); + + document fileName="#testPdf#" overwrite="true" { + writeoutput(" test pdf file [#variables.testCode#]" ); + } + } + + function run( testResults , testBox ) { + describe( "testcase for LDEV-3048", function() { + + it( title="cfpdf check password routines, protect, removePassword", body=function( currentSpec ) { + + pdf action="extractText" source="#testPdf#" name="local.extractedText"; + expect( extractedText ).toInclude( testCode ); + + pdf action="protect" source="#testPdf#" destination="#testPdf#" newUserPassword="#variables.password#" overwrite="true"; + pdf action="extractText" source="#testPdf#" name="local.extractedText" password="#variables.password#"; + expect( extractedText ).toInclude( testCode ); + + pdf action="removePassword" source="#testPdf#" destination="#testPdf#" password="#variables.password#" overwrite="true"; + pdf action="extractText" source="#testPdf#" name="local.extractedText"; + expect( extractedText ).toInclude( testCode ); + + }); + + }); + } + + function afterAll(){ + if ( fileExists( variables.testPdf ) ) + fileDelete( variables.testPdf ); + }; +}