summaryrefslogtreecommitdiff
path: root/testing/tools/pngdiffer.py
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-10-26 11:22:52 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-26 15:36:06 +0000
commit352e251c6af1f2a3c2eca24468f98eae30099185 (patch)
treea529bc3eccb5f678311c4f007e3377aa6a9af785 /testing/tools/pngdiffer.py
parent53d443f042b590ae2d920def16bc9daf66f8427d (diff)
downloadpdfium-352e251c6af1f2a3c2eca24468f98eae30099185.tar.xz
Add option to regenerate only platform-specific expected pngs.
Change-Id: Id4798fe9a4d297678a76d0511cde7fecbf130e3e Reviewed-on: https://pdfium-review.googlesource.com/16613 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Diffstat (limited to 'testing/tools/pngdiffer.py')
-rwxr-xr-xtesting/tools/pngdiffer.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/testing/tools/pngdiffer.py b/testing/tools/pngdiffer.py
index 95acb198a6..a9bc9d6529 100755
--- a/testing/tools/pngdiffer.py
+++ b/testing/tools/pngdiffer.py
@@ -66,7 +66,7 @@ class PNGDiffer():
i += 1
return False
- def Regenerate(self, input_filename, source_dir, working_dir):
+ def Regenerate(self, input_filename, source_dir, working_dir, platform_only):
path_templates = PathTemplates(input_filename, source_dir, working_dir)
page = 0
@@ -81,13 +81,16 @@ class PNGDiffer():
self.os_name, page)
# If there is a platform expected png, we will overwrite it. Otherwise,
- # overwrite the generic png.
+ # overwrite the generic png in "all" mode, or do nothing in "platform"
+ # mode.
if os.path.exists(platform_expected_path):
expected_path = platform_expected_path
- else:
+ elif not platform_only:
expected_path = path_templates.GetExpectedPath(page)
+ else:
+ expected_path = None
- if os.path.exists(expected_path):
+ if expected_path is not None and os.path.exists(expected_path):
shutil.copyfile(actual_path, expected_path)
page += 1