diff options
author | dpranke@google.com <dpranke@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 01:35:32 +0000 |
---|---|---|
committer | dpranke@google.com <dpranke@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 01:35:32 +0000 |
commit | 23903b8960be7c0b606c2ca622af3fef00437d92 (patch) | |
tree | 6e326cfe3963666181f407964bf1adf13fe43911 /webkit | |
parent | f6fb871bbf0a7d33e56bce5c447f0474522736a1 (diff) | |
download | chromium_src-23903b8960be7c0b606c2ca622af3fef00437d92.zip chromium_src-23903b8960be7c0b606c2ca622af3fef00437d92.tar.gz chromium_src-23903b8960be7c0b606c2ca622af3fef00437d92.tar.bz2 |
We are mistakenly copying the -actual.png files every time, instead of just
when they fail. Stop that.
BUG=none
TEST=none
R=ojan@chromium.org
Review URL: http://codereview.chromium.org/502043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34796 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/tools/layout_tests/test_types/image_diff.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/webkit/tools/layout_tests/test_types/image_diff.py b/webkit/tools/layout_tests/test_types/image_diff.py index f814cb6..51b06e4 100644 --- a/webkit/tools/layout_tests/test_types/image_diff.py +++ b/webkit/tools/layout_tests/test_types/image_diff.py @@ -24,21 +24,19 @@ _compare_available = True _compare_msg_printed = False class ImageDiff(test_type_base.TestTypeBase): - def _CopyOutputPNGs(self, filename, actual_png, expected_png): + def _CopyOutputPNG(self, test_filename, source_image, extension): """Copies result files into the output directory with appropriate names. Args: - filename: the test filename - actual_png: path to the actual result file - expected_png: path to the expected result file + test_filename: the test filename + source_file: path to the image file (either actual or expected) + extension: extension to indicate -actual.png or -expected.png """ - self._MakeOutputDirectory(filename) - actual_filename = self.OutputFilename(filename, "-actual.png") - expected_filename = self.OutputFilename(filename, "-expected.png") + self._MakeOutputDirectory(test_filename) + dest_image = self.OutputFilename(test_filename, extension) - shutil.copyfile(actual_png, actual_filename) try: - shutil.copyfile(expected_png, expected_filename) + shutil.copyfile(source_image, dest_image) except IOError, e: # A missing expected PNG has already been recorded as an error. if errno.ENOENT != e.errno: @@ -136,22 +134,26 @@ class ImageDiff(test_type_base.TestTypeBase): raise expected_hash = '' - self.WriteOutputFiles(filename, '', '.checksum', test_args.hash, - expected_hash, diff=False, wdiff=False) - self._CopyOutputPNGs(filename, test_args.png_path, - expected_png_file) if not os.path.isfile(expected_png_file): # Report a missing expected PNG file. + self.WriteOutputFiles(filename, '', '.checksum', test_args.hash, + expected_hash, diff=False, wdiff=False) + self._CopyOutputPNG(filename, test_args.png_path, '-actual.png') failures.append(test_failures.FailureMissingImage(self)) return failures elif test_args.hash == expected_hash: + # Hash matched (no diff needed, okay to return). return failures # Even though we only use result in one codepath below but we still need to # call CreateImageDiff for other codepaths. result = self._CreateImageDiff(filename, target) + self.WriteOutputFiles(filename, '', '.checksum', test_args.hash, + expected_hash, diff=False, wdiff=False) + self._CopyOutputPNG(filename, test_args.png_path, '-actual.png') + self._CopyOutputPNG(filename, expected_png_file, '-expected.png') if expected_hash == '': failures.append(test_failures.FailureMissingImageHash(self)) elif test_args.hash != expected_hash: |