summaryrefslogtreecommitdiffstats
path: root/cc/test/pixel_test_utils.h
diff options
context:
space:
mode:
authorernstm@chromium.org <ernstm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-29 04:09:47 +0000
committerernstm@chromium.org <ernstm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-29 04:09:47 +0000
commitca43568db4c8e1d54bddeac27fa8e95387476556 (patch)
treeb2474fd80562c16f303df5725740ad7de48ab287 /cc/test/pixel_test_utils.h
parent292ff3178fd8c6037b9d7dda01904b15fb4662f9 (diff)
downloadchromium_src-ca43568db4c8e1d54bddeac27fa8e95387476556.zip
chromium_src-ca43568db4c8e1d54bddeac27fa8e95387476556.tar.gz
chromium_src-ca43568db4c8e1d54bddeac27fa8e95387476556.tar.bz2
cc: Made image comparison for pixel tests error tolerant.
Added PixelComparator interface and two implementations of it: ExactPixelComparator and FuzzyPixelComparator. The FuzzyPixelComparator tolerates an adjustable amount of error in the image. BUG=180460 Review URL: https://chromiumcodereview.appspot.com/12558003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191288 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/pixel_test_utils.h')
-rw-r--r--cc/test/pixel_test_utils.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/cc/test/pixel_test_utils.h b/cc/test/pixel_test_utils.h
index 2ee2ecd..e581e95 100644
--- a/cc/test/pixel_test_utils.h
+++ b/cc/test/pixel_test_utils.h
@@ -6,6 +6,7 @@
#define CC_TEST_PIXEL_TEST_UTILS_H_
#include "base/files/file_path.h"
+#include "cc/test/pixel_comparator.h"
class SkBitmap;
@@ -20,10 +21,11 @@ bool WritePNGFile(const SkBitmap& bitmap, const base::FilePath& file_path,
// should have been encoded using |gfx::PNGCodec::Encode|.
bool ReadPNGFile(const base::FilePath& file_path, SkBitmap* bitmap);
-// Compares with a PNG file on disk, and returns true if it is the same as
-// the given image. |ref_img_path| is absolute.
-bool IsSameAsPNGFile(const SkBitmap& gen_bmp, base::FilePath ref_img_path,
- bool discard_transparency);
+// Compares with a PNG file on disk using the given PixelComparator, and returns
+// true if the comparator returns a match. |ref_img_path| is absolute.
+bool MatchesPNGFile(const SkBitmap& gen_bmp,
+ base::FilePath ref_img_path,
+ const PixelComparator& comparator);
} // namespace cc