summaryrefslogtreecommitdiffstats
path: root/cc/test/pixel_comparator.cc
diff options
context:
space:
mode:
authorsohan.jyoti@samsung.com <sohan.jyoti@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-09 21:23:45 +0000
committersohan.jyoti@samsung.com <sohan.jyoti@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-09 21:23:45 +0000
commitcea624b2e02b4c7d0d02b0b6aaec52a59091a471 (patch)
tree4c24034b1b79e58e99fd4c4c88dd3ccdef304c38 /cc/test/pixel_comparator.cc
parent4c40e06ed86c6512ddaa958fdb649d96c2a69286 (diff)
downloadchromium_src-cea624b2e02b4c7d0d02b0b6aaec52a59091a471.zip
chromium_src-cea624b2e02b4c7d0d02b0b6aaec52a59091a471.tar.gz
chromium_src-cea624b2e02b4c7d0d02b0b6aaec52a59091a471.tar.bz2
cc: For cc pixel test, create data url for pngs and print bounding rect.
This creates data url for both output and expected pngs, and prints the error bounding rect. BUG=236196 Review URL: https://codereview.chromium.org/371863002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/pixel_comparator.cc')
-rw-r--r--cc/test/pixel_comparator.cc36
1 files changed, 10 insertions, 26 deletions
diff --git a/cc/test/pixel_comparator.cc b/cc/test/pixel_comparator.cc
index 44fa7dd..73807ed 100644
--- a/cc/test/pixel_comparator.cc
+++ b/cc/test/pixel_comparator.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/logging.h"
+#include "ui/gfx/rect.h"
namespace cc {
@@ -19,6 +20,8 @@ bool ExactPixelComparator::Compare(const SkBitmap& actual_bmp,
// Number of pixels with an error
int error_pixels_count = 0;
+ gfx::Rect error_bounding_rect = gfx::Rect();
+
// Check that bitmaps have identical dimensions.
DCHECK(actual_bmp.width() == expected_bmp.width() &&
actual_bmp.height() == expected_bmp.height());
@@ -34,26 +37,16 @@ bool ExactPixelComparator::Compare(const SkBitmap& actual_bmp,
actual_color = SkColorSetA(actual_color, 0);
expected_color = SkColorSetA(expected_color, 0);
}
-
if (actual_color != expected_color) {
++error_pixels_count;
- LOG(ERROR) << "Pixel error at x=" << x << " y=" << y << "; "
- << "actual RGBA=("
- << SkColorGetR(actual_color) << ","
- << SkColorGetG(actual_color) << ","
- << SkColorGetB(actual_color) << ","
- << SkColorGetA(actual_color) << "); "
- << "expected RGBA=("
- << SkColorGetR(expected_color) << ","
- << SkColorGetG(expected_color) << ","
- << SkColorGetB(expected_color) << ","
- << SkColorGetA(expected_color) << ")";
+ error_bounding_rect.Union(gfx::Rect(x, y, 1, 1));
}
}
}
if (error_pixels_count != 0) {
LOG(ERROR) << "Number of pixel with an error: " << error_pixels_count;
+ LOG(ERROR) << "Error Bounding Box : " << error_bounding_rect.ToString();
return false;
}
@@ -92,6 +85,8 @@ bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp,
int max_abs_error_b = 0;
int max_abs_error_a = 0;
+ gfx::Rect error_bounding_rect = gfx::Rect();
+
// Check that bitmaps have identical dimensions.
DCHECK(actual_bmp.width() == expected_bmp.width() &&
actual_bmp.height() == expected_bmp.height());
@@ -201,22 +196,11 @@ bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp,
actual_color = SkColorSetA(actual_color, 0);
expected_color = SkColorSetA(expected_color, 0);
}
- if (actual_color != expected_color) {
- LOG(ERROR) << "Pixel error at x=" << x << " y=" << y << "; "
- << "actual RGBA=("
- << SkColorGetR(actual_color) << ","
- << SkColorGetG(actual_color) << ","
- << SkColorGetB(actual_color) << ","
- << SkColorGetA(actual_color) << "); "
- << "expected RGBA=("
- << SkColorGetR(expected_color) << ","
- << SkColorGetG(expected_color) << ","
- << SkColorGetB(expected_color) << ","
- << SkColorGetA(expected_color) << ")";
- }
+ if (actual_color != expected_color)
+ error_bounding_rect.Union(gfx::Rect(x, y, 1, 1));
}
}
-
+ LOG(ERROR) << "Error Bounding Box : " << error_bounding_rect.ToString();
return false;
} else {
return true;