summaryrefslogtreecommitdiff
path: root/testing/tools/pngdiffer.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing/tools/pngdiffer.py')
-rwxr-xr-xtesting/tools/pngdiffer.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/testing/tools/pngdiffer.py b/testing/tools/pngdiffer.py
index f40cc2596f..baed33be0c 100755
--- a/testing/tools/pngdiffer.py
+++ b/testing/tools/pngdiffer.py
@@ -3,6 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import distutils.spawn
import itertools
import os
import shutil
@@ -15,6 +16,13 @@ class PNGDiffer():
self.pdfium_diff_path = finder.ExecutablePath('pdfium_diff')
self.os_name = finder.os_name
+ def CheckMissingTools(self, regenerate_expected):
+ if (regenerate_expected and
+ self.os_name == 'linux' and
+ not distutils.spawn.find_executable('optipng')):
+ return 'Please install "optipng" to regenerate expected images.'
+ return None
+
def GetActualFiles(self, input_filename, source_dir, working_dir):
actual_paths = []
path_templates = PathTemplates(input_filename, source_dir, working_dir)
@@ -93,6 +101,7 @@ class PNGDiffer():
continue
shutil.copyfile(actual_path, expected_path)
+ common.RunCommand(['optipng', expected_path])
ACTUAL_TEMPLATE = '.pdf.%d.png'