diff options
author | edisonn@google.com <edisonn@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-10 15:20:34 +0000 |
---|---|---|
committer | edisonn@google.com <edisonn@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-10 15:20:34 +0000 |
commit | 2a827e81b3334f33b0f8ff05b6a39a11d532568f (patch) | |
tree | 2ef18e09c4ed922ca162a181e66171bb9c6a79b4 /tools/test_pdfs.py | |
parent | 1b6c73d67a8a7666e13fe774cfed3bc6f38538f5 (diff) |
Add an SKP to PDF rendered. test_pdfs.py will be hooked up in buildbot testing later.
Review URL: https://codereview.appspot.com/6610056
git-svn-id: http://skia.googlecode.com/svn/trunk@5880 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools/test_pdfs.py')
-rw-r--r-- | tools/test_pdfs.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tools/test_pdfs.py b/tools/test_pdfs.py new file mode 100644 index 0000000000..ac3eab9a33 --- /dev/null +++ b/tools/test_pdfs.py @@ -0,0 +1,60 @@ +''' +Compares the rendererings of serialized SkPictures to expected images. + +Launch with --help to see more information. + + +Copyright 2012 Google Inc. + +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +''' +# common Python modules +import os +import optparse +import sys +import shutil +import tempfile +import test_rendering + +USAGE_STRING = 'Usage: %s input... expectedDir' +HELP_STRING = ''' + +Takes input SkPicture files and renders them as PDF files, and then compares +those resulting PDF files against PDF files found in expectedDir. + +Each instance of "input" can be either a file (name must end in .skp), or a +directory (in which case this script will process all .skp files within the +directory). +''' + + +def Main(args): + """Allow other scripts to call this script with fake command-line args. + + @param The commandline argument list + """ + parser = optparse.OptionParser(USAGE_STRING % '%prog' + HELP_STRING) + parser.add_option('--render_dir', dest='render_dir', + help = ('specify the location to output the rendered ' + 'files. Default is a temp directory.')) + parser.add_option('--diff_dir', dest='diff_dir', + help = ('specify the location to output the diff files. ' + 'Default is a temp directory.')) + + options, arguments = parser.parse_args(args) + + if (len(arguments) < 3): + print("Expected at least one input and one ouput folder.") + parser.print_help() + sys.exit(-1) + + inputs = arguments[1:-1] + expected_dir = arguments[-1] + + test_rendering.TestRenderSkps(inputs, expected_dir, options.render_dir, + options.diff_dir, 'render_pdfs', '') + +if __name__ == '__main__': + Main(sys.argv) + |