diff --git a/test/Application.cfc b/test/Application.cfc new file mode 100644 index 0000000..dd928ce --- /dev/null +++ b/test/Application.cfc @@ -0,0 +1,3 @@ +component { + this.pdf.type = 'classic'; +} diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..92d43cf --- /dev/null +++ b/test/README.md @@ -0,0 +1,9 @@ +This is the manual test suite for the PDF extension. + +## Running tests + +In the `test` folder: + +- Install the most recently built extension by running `bin/install_extension.sh` +- Run `box start`. This should open a browser to the test suite page. +- Scroll down the page and make sure that each PDF looks like the reference image. diff --git a/test/bin/install_extension.sh b/test/bin/install_extension.sh new file mode 100755 index 0000000..008f430 --- /dev/null +++ b/test/bin/install_extension.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -e + +script_dir=$(cd `dirname $0` && pwd) +repo_root=${script_dir}/../../ + +cd "${repo_root}test" +lucee_home=$(box server info property=serverHomeDirectory) + +if [ -z "${lucee_home}" ]; then + echo "ERROR: Could not find Lucee home directory" + exit 1 +fi + +deploy_dir=${lucee_home}/WEB-INF/lucee-server/deploy + +echo "Found Lucee home directory at ${lucee_home}" +echo "Copying the following files to ${deploy_dir}:" +ls "${repo_root}"dist/*.lex + +cp "${repo_root}"dist/*.lex "${deploy_dir}" + +echo "Waiting for Lucee to install the extension..." +while ls "${deploy_dir}"/*.lex &> /dev/null; do + sleep 1 + echo -n . +done +echo +echo "Extension installed" diff --git a/test/box.json b/test/box.json new file mode 100644 index 0000000..53dfe8b --- /dev/null +++ b/test/box.json @@ -0,0 +1,57 @@ +{ + "author":"", + "bugs":"", + "changelog":"", + "contributors":[], + "dependencies":{}, + "description":"", + "devDependencies":{}, + "documentation":"", + "homepage":"", + "ignore":[ + "**/.*", + "/test/", + "/tests/" + ], + "installPaths":{}, + "instructions":"", + "keywords":[], + "license":[ + { + "type":"", + "URL":"" + } + ], + "location":"ForgeboxStorage", + "name":"My Package", + "private":false, + "projectURL":"", + "repository":{ + "type":"", + "URL":"" + }, + "scripts":{}, + "shortDescription":"A sweet package", + "slug":"my-package", + "testbox":{ + "bundles":"", + "directory":"tests.specs", + "labels":"", + "options":{}, + "recurse":true, + "reporter":"", + "runner":[ + { + "default":"" + } + ], + "testBundles":"", + "testSpecs":"", + "testSuites":"", + "verbose":true, + "watchDelay":500, + "watchPaths":"**.cfc" + }, + "type":"modules", + "version":"0.0.0" +} diff --git a/test/expected_output/classic_basic.png b/test/expected_output/classic_basic.png new file mode 100644 index 0000000..956541a Binary files /dev/null and b/test/expected_output/classic_basic.png differ diff --git a/test/expected_output/classic_images.png b/test/expected_output/classic_images.png new file mode 100644 index 0000000..8ddff84 Binary files /dev/null and b/test/expected_output/classic_images.png differ diff --git a/test/expected_output/modern_basic.png b/test/expected_output/modern_basic.png new file mode 100644 index 0000000..01b479f Binary files /dev/null and b/test/expected_output/modern_basic.png differ diff --git a/test/expected_output/modern_section.png b/test/expected_output/modern_section.png new file mode 100644 index 0000000..6806035 Binary files /dev/null and b/test/expected_output/modern_section.png differ diff --git a/test/index.cfm b/test/index.cfm new file mode 100644 index 0000000..0d639a6 --- /dev/null +++ b/test/index.cfm @@ -0,0 +1,44 @@ + + + + +
+
Actual PDF Output
+
Expected Output (screenshot)
+
+ + + + diff --git a/test/test_cases/classic_basic.cfm b/test/test_cases/classic_basic.cfm new file mode 100644 index 0000000..8d56221 --- /dev/null +++ b/test/test_cases/classic_basic.cfm @@ -0,0 +1,5 @@ + +
+ Classic engine has no support for border-radius, so the box should have rectilinear corners. +
+
diff --git a/test/test_cases/classic_images.cfm b/test/test_cases/classic_images.cfm new file mode 100644 index 0000000..a5243d8 --- /dev/null +++ b/test/test_cases/classic_images.cfm @@ -0,0 +1,27 @@ + + + Header
+ + + + +
+ + Body
+ + + + + + + Footer
+ + + + +
+
+ + + + diff --git a/test/test_cases/modern_basic.cfm b/test/test_cases/modern_basic.cfm new file mode 100644 index 0000000..26578a9 --- /dev/null +++ b/test/test_cases/modern_basic.cfm @@ -0,0 +1,5 @@ + +
+ Modern engine, as evidenced by the rounded corners of the box. +
+
diff --git a/test/test_cases/modern_section.cfm b/test/test_cases/modern_section.cfm new file mode 100644 index 0000000..db16bf6 --- /dev/null +++ b/test/test_cases/modern_section.cfm @@ -0,0 +1,7 @@ + + +
+ Modern engine in a cfdocumentsection. Border corners should be rounded. +
+
+
diff --git a/test/test_cases/support/_csubs_logo_inline.cfm b/test/test_cases/support/_csubs_logo_inline.cfm new file mode 100644 index 0000000..d3f2e2f --- /dev/null +++ b/test/test_cases/support/_csubs_logo_inline.cfm @@ -0,0 +1,4 @@ + +File
+ + diff --git a/test/test_cases/support/kitten.png b/test/test_cases/support/kitten.png new file mode 100644 index 0000000..2c95866 Binary files /dev/null and b/test/test_cases/support/kitten.png differ diff --git a/test/test_cases/support/puppy.png b/test/test_cases/support/puppy.png new file mode 100644 index 0000000..a2b893f Binary files /dev/null and b/test/test_cases/support/puppy.png differ