summaryrefslogtreecommitdiff
path: root/testing/tools/test_runner.py
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-04-26 15:55:07 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-26 15:55:07 +0000
commit15bc974936fd14598214a37aafd62f29c3b42a61 (patch)
tree9efda15e29032901863bb00529a2edd9b309676e /testing/tools/test_runner.py
parent789a227a635b13b782a38f0a38bcb35b099f12d8 (diff)
downloadpdfium-15bc974936fd14598214a37aafd62f29c3b42a61.tar.xz
Improve diffing and regeneration of expected pngs.
- If a .pdf had more than one page and any of them except the first had no expectation, that page and the ones after it were not diff'ed. - If a .pdf did not have expectations for any or all pages, --regen did not generate those expectations. Change-Id: Ie6dacf07e44feb4a14a6a92eb20c9aa19858a8f9 Reviewed-on: https://pdfium-review.googlesource.com/25770 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'testing/tools/test_runner.py')
-rw-r--r--testing/tools/test_runner.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/testing/tools/test_runner.py b/testing/tools/test_runner.py
index 90202f8e55..5acda86f54 100644
--- a/testing/tools/test_runner.py
+++ b/testing/tools/test_runner.py
@@ -80,21 +80,27 @@ class TestRunner:
if actual_images:
if self.image_differ.HasDifferences(input_filename, source_dir,
self.working_dir):
- if (self.options.regenerate_expected
- and not self.test_suppressor.IsResultSuppressed(input_filename)
- and not self.test_suppressor.IsImageDiffSuppressed(input_filename)):
- platform_only = (self.options.regenerate_expected == 'platform')
- self.image_differ.Regenerate(input_filename, source_dir,
- self.working_dir, platform_only)
+ self.RegenerateIfNeeded_(input_filename, source_dir)
return False, results
else:
if (self.enforce_expected_images
and not self.test_suppressor.IsImageDiffSuppressed(input_filename)):
+ self.RegenerateIfNeeded_(input_filename, source_dir)
print 'FAILURE: %s; Missing expected images' % input_filename
return False, results
return True, results
+ def RegenerateIfNeeded_(self, input_filename, source_dir):
+ if (not self.options.regenerate_expected
+ or self.test_suppressor.IsResultSuppressed(input_filename)
+ or self.test_suppressor.IsImageDiffSuppressed(input_filename)):
+ return
+
+ platform_only = (self.options.regenerate_expected == 'platform')
+ self.image_differ.Regenerate(input_filename, source_dir,
+ self.working_dir, platform_only)
+
def Generate(self, source_dir, input_filename, input_root, pdf_path):
original_path = os.path.join(source_dir, input_filename)
input_path = os.path.join(source_dir, input_root + '.in')