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 81% |
copy from testing/tools/run_javascript_tests.py |
copy to testing/tools/run_pixel_tests.py |
index 4361ea08f983009d630a0569f5bc37fe8372264f..07ea7d8ed8e2bbdd9b838f3a6ec9e7b4353ebeb3 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.%d.ppm') |
+ expected_path_template = os.path.join(source_dir, |
+ input_root + '_expected.pdf.%d.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) |
@@ -49,8 +56,8 @@ def main(): |
# 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 |
@@ -74,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) |