Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fibeamer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
External Relations
Document Templates
fibeamer
Commits
2057fdfd
There was an error fetching the commit references. Please try again later.
Commit
2057fdfd
authored
8 years ago
by
Vít Novotný
Committed by
Vít Starý Novotný
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Updated the tests.
parent
0eb7ec63
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/comparepdf.sh
+46
-0
46 additions, 0 deletions
test/comparepdf.sh
test/mu/Makefile
+2
-1
2 additions, 1 deletion
test/mu/Makefile
with
48 additions
and
1 deletion
test/comparepdf.sh
0 → 100755
+
46
−
0
View file @
2057fdfd
#!/bin/sh
# This script visually compares two PDF documents on a page-by-page basis.
# Print an error message and die.
die
()
{
FORMAT
=
"
$1
"
;
shift
printf
"
$FORMAT
\n
"
"
$@
"
1>&2
exit
1
}
# Check if a file exist.
exists
()
{
[
-e
"
$1
"
]
||
die
'File "%s" does not exist.'
"
$1
"
}
# Check that the input files exist.
exists
"
$1
"
||
exit
1
exists
"
$2
"
||
exit
1
# Burst the input files into temporary directories.
SOURCE_DIR
=
`
mktemp
-d
`
&&
trap
'rm -r $SOURCE_DIR'
EXIT
&&
pdftk
"
$1
"
burst output
$SOURCE_DIR
/%04d.pdf
DEST_DIR
=
`
mktemp
-d
`
&&
trap
'rm -r $SOURCE_DIR $DEST_DIR'
EXIT
&&
pdftk
"
$2
"
burst output
$DEST_DIR
/%04d.pdf
# Compare the individual pages.
DIFFER
=
false
;
PAGES
=
""
for
PAGE
in
`
((
cd
$SOURCE_DIR
&&
ls
*
.pdf
)
&&
(
cd
$DEST_DIR
&&
ls
*
.pdf
))
|
sort
-u
`
;
do
PAGENUM
=
`
echo
${
PAGE
%%.pdf
}
|
sed
's/^0*//'
`
if
[
-e
$SOURCE_DIR
/
$PAGE
-a
!
-e
$DEST_DIR
/
$PAGE
]
;
then
die
'The document "%s" does not contain page "%d".'
"
$2
"
$PAGENUM
elif
[
!
-e
$SOURCE_DIR
/
$PAGE
-a
-e
$DEST_DIR
/
$PAGE
]
;
then
die
'The document "%s" does not contain page "%d".'
"
$1
"
$PAGENUM
else
if
!
comparepdf
--compare
=
appearance
--verbose
=
0
$SOURCE_DIR
/
$PAGE
$DEST_DIR
/
$PAGE
;
then
DIFFER
=
true
PAGES
=
"
$PAGES
,
$PAGENUM
"
fi
fi
done
# Print out the result.
if
$DIFFER
;
then
PAGES
=
"
$(
echo
"
$PAGES
"
|
tail
-c
+3
)
"
die
'The documents "%s" and "%s" differ in pages %s.'
"
$1
"
"
$2
"
"
$PAGES
"
fi
This diff is collapsed.
Click to expand it.
test/mu/Makefile
+
2
−
1
View file @
2057fdfd
...
...
@@ -18,7 +18,8 @@ all:
# This target runs a single test.
expected-%.pdf
:
$(EXAMPLEDIR)/%.pdf
comparepdf
--compare
=
appearance
--verbose
=
1
$<
$@
../comparepdf.sh
$<
$@
||
\
{
[
"
$(
UPDATE_FAILED
)
"
=
true
]
&&
mv
$<
$@
;
}
# This is a dummy target.
implode
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment