Skip to content

Commit cc1d86a

Browse files
committed
LDEV-1004 improve test case
1 parent 3918892 commit cc1d86a

File tree

2 files changed

+56
-8
lines changed

2 files changed

+56
-8
lines changed

tests/LDEV1004.cfc

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
component extends="org.lucee.cfml.test.LuceeTestCase" labels="pdf" skip="true" {
1+
component extends="org.lucee.cfml.test.LuceeTestCase" labels="pdf" {
22
function run( testResults, testBox ) {
3-
describe("Testcase for LDEV-1004", function() {
4-
it( title="check placeholders are resolved (modern)" , body=function( currentSpec ) {
3+
describe("Testcase for LDEV-1004 evalAtPrint=true", function() {
4+
xit( title="check placeholders are resolved (modern), evalAtPrint=true" , body=function( currentSpec ) {
55

66
local.result = _internalRequest(
77
template : "#createURI("LDEV1004")#/placeholders.cfm",
88
url: {
9-
type: "modern"
9+
type: "modern",
10+
evalAtPrint: "true"
1011
}
1112
);
1213
local.pdf=local.result.filecontent_binary;
@@ -21,12 +22,58 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="pdf" skip="true" {
2122

2223
});
2324

24-
it( title="check placeholders are resolved (classic)" , body=function( currentSpec ) {
25+
xit( title="check placeholders are resolved (classic), evalAtPrint=true" , body=function( currentSpec ) {
2526

2627
local.result = _internalRequest(
2728
template : "#createURI("LDEV1004")#/placeholders.cfm",
2829
url: {
29-
type: "classic"
30+
type: "classic",
31+
evalAtPrint: "true"
32+
}
33+
);
34+
local.pdf=local.result.filecontent_binary;
35+
expect( isPDFObject( pdf ) ).toBeTrue();
36+
37+
pdf action="extractText" source="#pdf#" name="local.extractedText";
38+
39+
expect( extractedText ).notToInclude("currentPageNumber", "placeholder [currentPageNumber] should be resolved");
40+
expect( extractedText ).notToInclude("totalPageCount", "placeholder [currentPageNumber] should be resolved");
41+
expect( extractedText ).notToInclude("totalSectionPageCount", "placeholder [totalSectionPageCount] should be resolved");
42+
expect( extractedText ).notToInclude("currentSectionPageNumber", "placeholder [currentSectionPageNumber] should be resolved");
43+
44+
});
45+
});
46+
47+
describe("Testcase for LDEV-1004 evalAtPrint=false", function() {
48+
49+
it( title="check placeholders are resolved (modern), evalAtPrint=false" , body=function( currentSpec ) {
50+
51+
local.result = _internalRequest(
52+
template : "#createURI("LDEV1004")#/placeholders.cfm",
53+
url: {
54+
type: "modern",
55+
evalAtPrint: "false"
56+
}
57+
);
58+
local.pdf=local.result.filecontent_binary;
59+
expect( isPDFObject( pdf ) ).toBeTrue();
60+
61+
pdf action="extractText" source="#pdf#" name="local.extractedText";
62+
63+
expect( extractedText ).notToInclude("currentPageNumber", "placeholder [currentPageNumber] should be resolved");
64+
expect( extractedText ).notToInclude("totalPageCount", "placeholder [currentPageNumber] should be resolved");
65+
expect( extractedText ).notToInclude("totalSectionPageCount", "placeholder [totalSectionPageCount] should be resolved");
66+
expect( extractedText ).notToInclude("currentSectionPageNumber", "placeholder [currentSectionPageNumber] should be resolved");
67+
68+
});
69+
70+
it( title="check placeholders are resolved (classic), evalAtPrint=false" , body=function( currentSpec ) {
71+
72+
local.result = _internalRequest(
73+
template : "#createURI("LDEV1004")#/placeholders.cfm",
74+
url: {
75+
type: "classic",
76+
evalAtPrint: "false"
3077
}
3178
);
3279
local.pdf=local.result.filecontent_binary;

tests/LDEV1004/placeholders.cfm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<cfparam name="url.type">
2+
<cfparam name="url.evalatprint">
23
<!--- https://dev.lucee.org/t/cfdocument-error-on-total-page-count/2102 --->
34
<cfdocument format="pdf" type="#url.type#">
4-
<cfdocumentitem type="header" evalatprint="false">
5+
<cfdocumentitem type="header" evalatprint="#url.evalatprint#">
56
<table width="100%" border="0" cellpadding="0" cellspacing="0">
67
<strong><tr><td align="right"><cfoutput>#cfdocument.currentSectionPageNumber# of</strong>
78
<strong>#cfdocument.totalSectionPageCount#</cfoutput></td></tr></strong>
89
</table>
910
</cfdocumentitem>
1011

11-
<cfdocumentitem type="footer" evalatprint="true">
12+
<cfdocumentitem type="footer" evalatprint="#url.evalatprint#">
1213
<table width="100%" border="0" cellpadding="0" cellspacing="0">
1314
<strong><tr><td align="center"><cfoutput>#cfdocument.currentPageNumber# of</strong>
1415
<strong>#cfdocument.totalPageCount#</cfoutput></td></tr></strong>

0 commit comments

Comments
 (0)