Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Unified Diff: testing/tools/run_pixel_tests.py

Issue 926173002: Run pixel tests via automated script. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Check multiple pages. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/resources/pixel/font_size_expected.pdf.0.ppm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/tools/run_pixel_tests.py
diff --git a/testing/tools/run_javascript_tests.py b/testing/tools/run_pixel_tests.py
similarity index 77%
copy from testing/tools/run_javascript_tests.py
copy to testing/tools/run_pixel_tests.py
index 237321e34346146a56d78db82f793360e7638ceb..eac4b9f168ae0a46d4c99ffe2f380f193662ec1d 100755
--- a/testing/tools/run_javascript_tests.py
+++ b/testing/tools/run_pixel_tests.py
@@ -20,14 +20,21 @@ def generate_and_test(input_filename, source_dir, working_dir,
input_root, _ = os.path.splitext(input_filename)
input_path = os.path.join(source_dir, input_root + '.in')
pdf_path = os.path.join(working_dir, input_root + '.pdf')
- txt_path = os.path.join(working_dir, input_root + '.txt')
- expected_path = os.path.join(source_dir, input_root + '_expected.txt')
+ actual_path_template = os.path.join(working_dir, input_root + '.pdf.%s.ppm')
Lei Zhang 2015/02/14 00:39:43 Shouldn't that be %d ? I think it works with %s be
Tom Sepez 2015/02/14 00:44:50 Done.
+ expected_path_template = os.path.join(source_dir,
+ input_root + '_expected.pdf.%s.ppm')
try:
subprocess.check_call(
[fixup_path, '--output-dir=' + working_dir, input_path])
- with open(txt_path, 'w') as outfile:
- subprocess.check_call([pdfium_test_path, pdf_path], stdout=outfile)
- subprocess.check_call(['diff', expected_path, txt_path])
+ subprocess.check_call([pdfium_test_path, '--ppm', pdf_path])
+ i = 0;
+ while True:
+ expected_path = expected_path_template % i;
+ actual_path = actual_path_template % i;
+ if not os.path.exists(expected_path):
+ break
+ subprocess.check_call(['diff', expected_path, actual_path])
+ i += 1
except subprocess.CalledProcessError as e:
print "FAILURE: " + input_filename + "; " + str(e)
@@ -41,15 +48,16 @@ def main():
my_dir = os.path.dirname(os.path.realpath(__file__))
testing_dir = os.path.dirname(my_dir)
pdfium_dir = os.path.dirname(testing_dir)
- if os.path.basename(pdfium_dir) != 'pdfium':
- print 'Confused, can not find pdfium directory, aborting.'
+ if (os.path.basename(my_dir) != 'tools' or
+ os.path.basename(testing_dir) != 'testing'):
+ print 'Confused, can not find pdfium root directory, aborting.'
return 1
# Other scripts are found in the same directory as this one.
fixup_path = os.path.join(my_dir, 'fixup_pdf_template.py')
- # test files are in .../pdfium/testing/resources/javascript.
- source_dir = os.path.join(testing_dir, 'resources', 'javascript')
+ # test files are in .../pdfium/testing/resources/pixel.
+ source_dir = os.path.join(testing_dir, 'resources', 'pixel')
# Find path to build directory. This depends on whether this is a
# standalone build vs. a build as part of a chromium checkout. For
@@ -73,7 +81,7 @@ def main():
# Place generated files under the build directory, not source directory.
gen_dir = os.path.join(build_dir, 'gen', 'pdfium')
- working_dir = os.path.join(gen_dir, 'testing', 'javascript')
+ working_dir = os.path.join(gen_dir, 'testing', 'pixel')
if not os.path.exists(working_dir):
os.makedirs(working_dir)
« no previous file with comments | « testing/resources/pixel/font_size_expected.pdf.0.ppm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698