summaryrefslogtreecommitdiff
path: root/fpdf_test.go
diff options
context:
space:
mode:
authorKurt Jung <kurt.w.jung@gmail.com>2015-10-09 15:52:07 -0400
committerKurt Jung <kurt.w.jung@gmail.com>2015-10-09 15:52:07 -0400
commit25d0813f8f9210fcaf3a5797d72756a332ef2dbe (patch)
tree5c599f3b52ea108d69252bded77839f02d6ebba0 /fpdf_test.go
parent47143d5c2dabe888df2ff3e586c911468881b55c (diff)
Implement PDF comparison with rudimentary byte-difference display. If a reference file exists, it will be compared with its associated example file. If the reference file is missing, the associated example file is considered to be without differences. PDF files in any subdirectory named reference are not deleted when the test begins. This commit is broken -- it illustrates how the use of maps for fonts, images and other resources lead to different dictionary tables in the PDF document.
Diffstat (limited to 'fpdf_test.go')
-rw-r--r--fpdf_test.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/fpdf_test.go b/fpdf_test.go
index 966767f..e45f966 100644
--- a/fpdf_test.go
+++ b/fpdf_test.go
@@ -40,9 +40,14 @@ func init() {
func cleanup() {
filepath.Walk(example.PdfDir(),
func(path string, info os.FileInfo, err error) (reterr error) {
- if len(path) > 3 {
- if path[len(path)-4:] == ".pdf" {
- os.Remove(path)
+ if info.Mode().IsRegular() {
+ dir, _ := filepath.Split(path)
+ if "reference" != filepath.Base(dir) {
+ if len(path) > 3 {
+ if path[len(path)-4:] == ".pdf" {
+ os.Remove(path)
+ }
+ }
}
}
return