Let cc::FuzzyPixelComparator check large errors separately
Previously cc::FuzzyPixelComparator had overrall error parameters and tiny error parameters. For example, the following set of parameters error_pixels_percentage_limit: 3 small_error_pixel_percentage_limit: 2 max_abs_error_limit: 100 small_error_threshold: 2 allowed 3% of pixels to have diff<=100, and all of them can be >2. There was no way to allow 2% small error pixels and only 1% of large error pixels. The parameters actually applied stricter rule on small errors than large errors. Now add multiple methods to set parameters of FuzzyPixelComparator instead of the original constructor with many parameters. The error_pixels_percentage_limit parameter is changed to large_error_pixels_percentage_limit to check for large errors separately. The values of the parameter at callsites (only 2) where small_error_pixel_percentage_limit was zero are adjusted accordingly. check_critical_errors of FuzzyPixelComparator is removed and critical errors are always checked. discard_alpha parameter of all PixelComparator implementations is removed and is replaced with dedicated method and classes. Change-Id: Ic2be2882e432383a55f972f80f8e1c09fdde017c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4185898 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: Vladimir Levin <vmpstr@chromium.org> Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1096498}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
5fa93d7dff
commit
43fe4442da
ash
cc
paint
test
trees
chrome/browser
components
exo
viz
service
display
display_embedder
frame_sinks
video_capture
content/browser
gpu/command_buffer/service/shared_image
headless/test
pdf
ui/compositor
@ -154,25 +154,22 @@ TEST_F(SuggestionChipViewTest, DarkAndLightTheme) {
|
||||
EXPECT_EQ(label->GetEnabledColor(),
|
||||
ColorProvider::Get()->GetContentLayerColor(
|
||||
ColorProvider::ContentLayerType::kTextColorSecondary));
|
||||
EXPECT_TRUE(
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)
|
||||
.Compare(GetSuggestionChipViewBitmap(suggestion_chip_view),
|
||||
GetBitmapWithInnerRoundedRect(
|
||||
kSuggestionChipViewSize, /*stroke_width=*/1,
|
||||
ColorProvider::Get()->GetContentLayerColor(
|
||||
ColorProvider::ContentLayerType::kSeparatorColor))));
|
||||
EXPECT_TRUE(cc::ExactPixelComparator().Compare(
|
||||
GetSuggestionChipViewBitmap(suggestion_chip_view),
|
||||
GetBitmapWithInnerRoundedRect(
|
||||
kSuggestionChipViewSize, /*stroke_width=*/1,
|
||||
ColorProvider::Get()->GetContentLayerColor(
|
||||
ColorProvider::ContentLayerType::kSeparatorColor))));
|
||||
|
||||
// Focus the chip view and confirm that focus ring is rendered.
|
||||
suggestion_chip_view->RequestFocus();
|
||||
views::test::RunScheduledLayout(views::FocusRing::Get(suggestion_chip_view));
|
||||
EXPECT_TRUE(
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)
|
||||
.Compare(
|
||||
GetFocusRingBitmap(views::FocusRing::Get(suggestion_chip_view)),
|
||||
GetBitmapWithInnerRoundedRect(
|
||||
kSuggestionChipViewSize, /*stroke_width=*/2,
|
||||
ColorProvider::Get()->GetControlsLayerColor(
|
||||
ColorProvider::ControlsLayerType::kFocusRingColor))));
|
||||
EXPECT_TRUE(cc::ExactPixelComparator().Compare(
|
||||
GetFocusRingBitmap(views::FocusRing::Get(suggestion_chip_view)),
|
||||
GetBitmapWithInnerRoundedRect(
|
||||
kSuggestionChipViewSize, /*stroke_width=*/2,
|
||||
ColorProvider::Get()->GetControlsLayerColor(
|
||||
ColorProvider::ControlsLayerType::kFocusRingColor))));
|
||||
|
||||
suggestion_chip_view->GetFocusManager()->ClearFocus();
|
||||
|
||||
@ -184,24 +181,21 @@ TEST_F(SuggestionChipViewTest, DarkAndLightTheme) {
|
||||
EXPECT_EQ(label->GetEnabledColor(),
|
||||
ColorProvider::Get()->GetContentLayerColor(
|
||||
ColorProvider::ContentLayerType::kTextColorSecondary));
|
||||
EXPECT_TRUE(
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)
|
||||
.Compare(GetSuggestionChipViewBitmap(suggestion_chip_view),
|
||||
GetBitmapWithInnerRoundedRect(
|
||||
kSuggestionChipViewSize, /*stroke_width=*/1,
|
||||
ColorProvider::Get()->GetContentLayerColor(
|
||||
ColorProvider::ContentLayerType::kSeparatorColor))));
|
||||
EXPECT_TRUE(cc::ExactPixelComparator().Compare(
|
||||
GetSuggestionChipViewBitmap(suggestion_chip_view),
|
||||
GetBitmapWithInnerRoundedRect(
|
||||
kSuggestionChipViewSize, /*stroke_width=*/1,
|
||||
ColorProvider::Get()->GetContentLayerColor(
|
||||
ColorProvider::ContentLayerType::kSeparatorColor))));
|
||||
|
||||
// Focus the chip view and confirm that focus ring is rendered.
|
||||
suggestion_chip_view->RequestFocus();
|
||||
EXPECT_TRUE(
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)
|
||||
.Compare(
|
||||
GetFocusRingBitmap(views::FocusRing::Get(suggestion_chip_view)),
|
||||
GetBitmapWithInnerRoundedRect(
|
||||
kSuggestionChipViewSize, /*stroke_width=*/2,
|
||||
ColorProvider::Get()->GetControlsLayerColor(
|
||||
ColorProvider::ControlsLayerType::kFocusRingColor))));
|
||||
EXPECT_TRUE(cc::ExactPixelComparator().Compare(
|
||||
GetFocusRingBitmap(views::FocusRing::Get(suggestion_chip_view)),
|
||||
GetBitmapWithInnerRoundedRect(
|
||||
kSuggestionChipViewSize, /*stroke_width=*/2,
|
||||
ColorProvider::Get()->GetControlsLayerColor(
|
||||
ColorProvider::ControlsLayerType::kFocusRingColor))));
|
||||
}
|
||||
|
||||
TEST_F(SuggestionChipViewTest, FontWeight) {
|
||||
|
@ -972,16 +972,14 @@ TEST_F(SavedDeskTest, SaveDeskButtonFocusRingColor) {
|
||||
// Verify the focus ring of the given button is as expected.
|
||||
auto verify_button_focus_ring_color = [this](SavedDeskSaveDeskButton* button,
|
||||
bool highlighted) {
|
||||
EXPECT_EQ(
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)
|
||||
.Compare(
|
||||
GetFocusRingBitmap(views::FocusRing::Get(button)),
|
||||
GetBitmapWithInnerRoundedRect(
|
||||
views::FocusRing::Get(button)->size(),
|
||||
/*stroke_width=*/2,
|
||||
ColorProvider::Get()->GetControlsLayerColor(
|
||||
ColorProvider::ControlsLayerType::kFocusRingColor))),
|
||||
highlighted);
|
||||
EXPECT_EQ(cc::ExactPixelComparator().Compare(
|
||||
GetFocusRingBitmap(views::FocusRing::Get(button)),
|
||||
GetBitmapWithInnerRoundedRect(
|
||||
views::FocusRing::Get(button)->size(),
|
||||
/*stroke_width=*/2,
|
||||
ColorProvider::Get()->GetControlsLayerColor(
|
||||
ColorProvider::ControlsLayerType::kFocusRingColor))),
|
||||
highlighted);
|
||||
};
|
||||
|
||||
// Both buttons are not highlighted.
|
||||
|
@ -278,10 +278,10 @@ class OopPixelTest : public testing::Test,
|
||||
}
|
||||
|
||||
// Verifies |actual| matches the expected PNG image.
|
||||
void ExpectEquals(const SkBitmap& actual,
|
||||
const base::FilePath::StringType& ref_filename,
|
||||
const PixelComparator& comparator =
|
||||
ExactPixelComparator(/*discard_alpha=*/false)) {
|
||||
void ExpectEquals(
|
||||
const SkBitmap& actual,
|
||||
const base::FilePath::StringType& ref_filename,
|
||||
const PixelComparator& comparator = ExactPixelComparator()) {
|
||||
base::FilePath test_data_dir;
|
||||
ASSERT_TRUE(
|
||||
base::PathService::Get(viz::Paths::DIR_TEST_DATA, &test_data_dir));
|
||||
@ -296,10 +296,10 @@ class OopPixelTest : public testing::Test,
|
||||
}
|
||||
}
|
||||
|
||||
void ExpectEquals(SkBitmap actual,
|
||||
SkBitmap expected,
|
||||
const PixelComparator& comparator =
|
||||
ExactPixelComparator(/*discard_alpha=*/false)) {
|
||||
void ExpectEquals(
|
||||
SkBitmap actual,
|
||||
SkBitmap expected,
|
||||
const PixelComparator& comparator = ExactPixelComparator()) {
|
||||
EXPECT_TRUE(MatchesBitmap(actual, expected, comparator));
|
||||
}
|
||||
|
||||
@ -611,9 +611,9 @@ TEST_F(OopPixelTest, DrawImageWithTargetColorSpace) {
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Android has slight differences in color.
|
||||
FuzzyPixelOffByOneComparator comparator(/*discard_alpha=*/false);
|
||||
FuzzyPixelOffByOneComparator comparator;
|
||||
#else
|
||||
ExactPixelComparator comparator(/*discard_alpha=*/false);
|
||||
ExactPixelComparator comparator;
|
||||
#endif
|
||||
|
||||
ExpectEquals(actual, FILE_PATH_LITERAL("oop_image_target_color_space.png"),
|
||||
@ -738,15 +738,12 @@ TEST_F(OopPixelTest, DrawImageWithSourceColorSpace) {
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Android has slight differences in color.
|
||||
FuzzyPixelComparator comparator(
|
||||
/*discard_alpha=*/false,
|
||||
/*error_pixels_percentage_limit=*/100.0f,
|
||||
/*small_error_pixels_percentage_limit=*/0.0f,
|
||||
/*avg_abs_error_limit=*/1.2f,
|
||||
/*max_abs_error_limit=*/2,
|
||||
/*small_error_threshold=*/0);
|
||||
auto comparator = FuzzyPixelComparator()
|
||||
.SetErrorPixelsPercentageLimit(100.0f)
|
||||
.SetAvgAbsErrorLimit(1.2f)
|
||||
.SetAbsErrorLimit(2);
|
||||
#else
|
||||
ExactPixelComparator comparator(/*discard_alpha=*/false);
|
||||
ExactPixelComparator comparator;
|
||||
#endif
|
||||
|
||||
ExpectEquals(actual,
|
||||
@ -783,9 +780,9 @@ TEST_F(OopPixelTest, DrawImageWithSourceAndTargetColorSpace) {
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Android has slight differences in color.
|
||||
FuzzyPixelOffByOneComparator comparator(/*discard_alpha=*/false);
|
||||
FuzzyPixelOffByOneComparator comparator;
|
||||
#else
|
||||
ExactPixelComparator comparator(/*discard_alpha=*/false);
|
||||
ExactPixelComparator comparator;
|
||||
#endif
|
||||
|
||||
ExpectEquals(actual, FILE_PATH_LITERAL("oop_draw_image_both_color_space.png"),
|
||||
@ -1521,7 +1518,7 @@ TEST_F(OopPixelTest, DrawRectQueryMiddleOfDisplayList) {
|
||||
|
||||
auto actual = Raster(display_item_list, options);
|
||||
ExpectEquals(actual, FILE_PATH_LITERAL("oop_draw_rect_query.png"),
|
||||
FuzzyPixelOffByOneComparator(/*discard_alpha=*/false));
|
||||
FuzzyPixelOffByOneComparator());
|
||||
}
|
||||
|
||||
TEST_F(OopPixelTest, DrawRectColorSpace) {
|
||||
@ -1704,13 +1701,11 @@ class OopTextBlobPixelTest
|
||||
}
|
||||
}
|
||||
|
||||
FuzzyPixelComparator comparator(
|
||||
/*discard_alpha=*/false,
|
||||
/*error_pixels_percentage_limit=*/error_pixels_percentage,
|
||||
/*small_error_pixels_percentage_limit=*/0.0f,
|
||||
/*avg_abs_error_limit=*/avg_error,
|
||||
/*max_abs_error_limit=*/max_abs_error,
|
||||
/*small_error_threshold=*/0);
|
||||
auto comparator =
|
||||
FuzzyPixelComparator()
|
||||
.SetErrorPixelsPercentageLimit(error_pixels_percentage)
|
||||
.SetAvgAbsErrorLimit(avg_error)
|
||||
.SetAbsErrorLimit(max_abs_error);
|
||||
ExpectEquals(actual, expected, comparator);
|
||||
}
|
||||
|
||||
@ -2132,13 +2127,9 @@ TEST_F(OopPixelTest, DrawTextBlobPersistentShaderCache) {
|
||||
|
||||
// Allow 1% of pixels to be off by 1 due to differences between software and
|
||||
// GPU canvas.
|
||||
FuzzyPixelComparator comparator(
|
||||
/*discard_alpha=*/false,
|
||||
/*error_pixels_percentage_limit=*/1.0f,
|
||||
/*small_error_pixels_percentage_limit=*/0.0f,
|
||||
/*avg_abs_error_limit=*/1.0f,
|
||||
/*max_abs_error_limit=*/1,
|
||||
/*small_error_threshold=*/0);
|
||||
auto comparator = FuzzyPixelComparator()
|
||||
.SetErrorPixelsPercentageLimit(1.0f)
|
||||
.SetAbsErrorLimit(1);
|
||||
|
||||
ExpectEquals(actual, expected, comparator);
|
||||
|
||||
@ -2325,13 +2316,9 @@ TEST_P(OopYUVToRGBPixelTest, ConvertYUVToRGB) {
|
||||
options.resource_size, SkColor4f::FromColor(expected_color));
|
||||
|
||||
// Allow slight rounding error on all pixels.
|
||||
FuzzyPixelComparator comparator(
|
||||
/*discard_alpha=*/false,
|
||||
/*error_pixels_percentage_limit=*/100.0f,
|
||||
/*small_error_pixels_percentage_limit=*/0.0f,
|
||||
/*avg_abs_error_limit=*/2.f,
|
||||
/*max_abs_error_limit=*/2.f,
|
||||
/*small_error_threshold=*/0);
|
||||
auto comparator = FuzzyPixelComparator()
|
||||
.SetErrorPixelsPercentageLimit(100.0f)
|
||||
.SetAbsErrorLimit(2);
|
||||
ExpectEquals(actual_bitmap, expected_bitmap, comparator);
|
||||
|
||||
gpu::SyncToken sync_token;
|
||||
@ -2445,14 +2432,9 @@ class OopPathPixelTest : public OopPixelTest,
|
||||
display_item_list->Finalize();
|
||||
|
||||
// Allow 8 pixels in 100x100 image to be different due to non-AA pixel
|
||||
// rounding (hence 255 for error limit).
|
||||
FuzzyPixelComparator comparator(
|
||||
/*discard_alpha=*/false,
|
||||
/*error_pixels_percentage_limit=*/0.08f,
|
||||
/*small_error_pixels_percentage_limit=*/0.0f,
|
||||
/*avg_abs_error_limit=*/255,
|
||||
/*max_abs_error_limit=*/255,
|
||||
/*small_error_threshold=*/0);
|
||||
// rounding.
|
||||
auto comparator =
|
||||
FuzzyPixelComparator().SetErrorPixelsPercentageLimit(0.08f);
|
||||
auto actual = Raster(display_item_list, options);
|
||||
ExpectEquals(actual, FILE_PATH_LITERAL("oop_path.png"), comparator);
|
||||
}
|
||||
|
@ -56,7 +56,8 @@ TestRasterType GetDefaultRasterType(viz::RendererType renderer_type) {
|
||||
LayerTreePixelTest::LayerTreePixelTest(viz::RendererType renderer_type)
|
||||
: LayerTreeTest(renderer_type),
|
||||
raster_type_(GetDefaultRasterType(renderer_type)),
|
||||
pixel_comparator_(new ExactPixelComparator(true)),
|
||||
pixel_comparator_(
|
||||
std::make_unique<AlphaDiscardingExactPixelComparator>()),
|
||||
pending_texture_mailbox_callbacks_(0) {}
|
||||
|
||||
LayerTreePixelTest::~LayerTreePixelTest() = default;
|
||||
|
@ -14,10 +14,6 @@
|
||||
|
||||
namespace cc {
|
||||
|
||||
ExactPixelComparator::ExactPixelComparator(const bool discard_alpha)
|
||||
: discard_alpha_(discard_alpha) {
|
||||
}
|
||||
|
||||
bool ExactPixelComparator::Compare(const SkBitmap& actual_bmp,
|
||||
const SkBitmap& expected_bmp) const {
|
||||
// Number of pixels with an error
|
||||
@ -92,27 +88,21 @@ bool ManhattanDistancePixelComparator::Compare(
|
||||
return true;
|
||||
}
|
||||
|
||||
FuzzyPixelComparator::FuzzyPixelComparator(
|
||||
bool discard_alpha,
|
||||
float error_pixels_percentage_limit,
|
||||
float small_error_pixels_percentage_limit,
|
||||
float avg_abs_error_limit,
|
||||
int max_abs_error_limit,
|
||||
int small_error_threshold,
|
||||
bool check_critical_error)
|
||||
: discard_alpha_(discard_alpha),
|
||||
error_pixels_percentage_limit_(error_pixels_percentage_limit),
|
||||
small_error_pixels_percentage_limit_(small_error_pixels_percentage_limit),
|
||||
avg_abs_error_limit_(avg_abs_error_limit),
|
||||
max_abs_error_limit_(max_abs_error_limit),
|
||||
small_error_threshold_(small_error_threshold),
|
||||
check_critical_error_(check_critical_error) {}
|
||||
|
||||
bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp,
|
||||
const SkBitmap& expected_bmp) const {
|
||||
// Number of pixels with an error
|
||||
// Check that bitmaps have identical dimensions.
|
||||
DCHECK_EQ(actual_bmp.width(), expected_bmp.width());
|
||||
DCHECK_EQ(actual_bmp.height(), expected_bmp.height());
|
||||
|
||||
// Check that bitmaps are not empty.
|
||||
DCHECK_GT(actual_bmp.width(), 0);
|
||||
DCHECK_GT(actual_bmp.height(), 0);
|
||||
|
||||
DCHECK_GE(max_abs_error_limit_, small_abs_error_limit_);
|
||||
|
||||
// Number of pixels with an error.
|
||||
int error_pixels_count = 0;
|
||||
// Number of pixels with a small error
|
||||
// Number of pixels with a small error.
|
||||
int small_error_pixels_count = 0;
|
||||
// Number of pixels with a critical error.
|
||||
int critial_error_pixels_count = 0;
|
||||
@ -129,14 +119,6 @@ bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp,
|
||||
|
||||
gfx::Rect error_bounding_rect = gfx::Rect();
|
||||
|
||||
// Check that bitmaps have identical dimensions.
|
||||
DCHECK_EQ(actual_bmp.width(), expected_bmp.width());
|
||||
DCHECK_EQ(actual_bmp.height(), expected_bmp.height());
|
||||
|
||||
// Check that bitmaps are not empty.
|
||||
DCHECK_GT(actual_bmp.width(), 0);
|
||||
DCHECK_GT(actual_bmp.height(), 0);
|
||||
|
||||
for (int x = 0; x < actual_bmp.width(); ++x) {
|
||||
for (int y = 0; y < actual_bmp.height(); ++y) {
|
||||
SkColor actual_color = actual_bmp.getColor(x, y);
|
||||
@ -161,15 +143,18 @@ bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp,
|
||||
int abs_error_a = std::abs(error_a);
|
||||
|
||||
// Increment small error counter if error is below threshold
|
||||
if (abs_error_r <= small_error_threshold_ &&
|
||||
abs_error_g <= small_error_threshold_ &&
|
||||
abs_error_b <= small_error_threshold_ &&
|
||||
abs_error_a <= small_error_threshold_)
|
||||
if (abs_error_r <= small_abs_error_limit_ &&
|
||||
abs_error_g <= small_abs_error_limit_ &&
|
||||
abs_error_b <= small_abs_error_limit_ &&
|
||||
abs_error_a <= small_abs_error_limit_) {
|
||||
++small_error_pixels_count;
|
||||
}
|
||||
|
||||
if (check_critical_error_ && abs_error_a != 0 &&
|
||||
(expected_alpha == 0 || expected_alpha == 0xff))
|
||||
if (abs_error_a != 0 &&
|
||||
(expected_alpha == 0 || expected_alpha == 0xff)) {
|
||||
DCHECK(!discard_alpha_);
|
||||
++critial_error_pixels_count;
|
||||
}
|
||||
|
||||
// Update per channel maximum absolute errors
|
||||
max_abs_error_r = std::max(max_abs_error_r, abs_error_r);
|
||||
@ -188,14 +173,16 @@ bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp,
|
||||
|
||||
// Compute error metrics from collected data
|
||||
int pixels_count = actual_bmp.width() * actual_bmp.height();
|
||||
float error_pixels_percentage = 0.0f;
|
||||
DCHECK(pixels_count);
|
||||
|
||||
float large_error_pixels_percentage = 0.0f;
|
||||
float small_error_pixels_percentage = 0.0f;
|
||||
if (pixels_count > 0) {
|
||||
error_pixels_percentage = static_cast<float>(error_pixels_count) /
|
||||
pixels_count * 100.0f;
|
||||
small_error_pixels_percentage =
|
||||
static_cast<float>(small_error_pixels_count) / pixels_count * 100.0f;
|
||||
}
|
||||
int large_error_pixels_count = error_pixels_count - small_error_pixels_count;
|
||||
large_error_pixels_percentage =
|
||||
static_cast<float>(large_error_pixels_count) / pixels_count * 100.0f;
|
||||
small_error_pixels_percentage =
|
||||
static_cast<float>(small_error_pixels_count) / pixels_count * 100.0f;
|
||||
|
||||
float avg_abs_error_r = 0.0f;
|
||||
float avg_abs_error_g = 0.0f;
|
||||
float avg_abs_error_b = 0.0f;
|
||||
@ -207,7 +194,7 @@ bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp,
|
||||
avg_abs_error_a = static_cast<float>(sum_abs_error_a) / error_pixels_count;
|
||||
}
|
||||
|
||||
if (error_pixels_percentage > error_pixels_percentage_limit_ ||
|
||||
if (large_error_pixels_percentage > large_error_pixels_percentage_limit_ ||
|
||||
small_error_pixels_percentage > small_error_pixels_percentage_limit_ ||
|
||||
avg_abs_error_r > avg_abs_error_limit_ ||
|
||||
avg_abs_error_g > avg_abs_error_limit_ ||
|
||||
@ -217,11 +204,17 @@ bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp,
|
||||
max_abs_error_g > max_abs_error_limit_ ||
|
||||
max_abs_error_b > max_abs_error_limit_ ||
|
||||
max_abs_error_a > max_abs_error_limit_ || critial_error_pixels_count) {
|
||||
LOG(ERROR) << "Percentage of pixels with an error: "
|
||||
<< error_pixels_percentage;
|
||||
LOG(ERROR) << "Percentage of pixels with errors not greater than "
|
||||
<< small_error_threshold_ << ": "
|
||||
<< small_error_pixels_percentage;
|
||||
if (small_abs_error_limit_) {
|
||||
LOG(ERROR) << "Percentage of pixels with errors >"
|
||||
<< small_abs_error_limit_ << ": "
|
||||
<< large_error_pixels_percentage;
|
||||
LOG(ERROR) << "Percentage of pixels with errors <="
|
||||
<< small_abs_error_limit_ << ": "
|
||||
<< small_error_pixels_percentage;
|
||||
} else {
|
||||
LOG(ERROR) << "Percentage of pixels with an error: "
|
||||
<< large_error_pixels_percentage;
|
||||
}
|
||||
LOG(ERROR) << "Average absolute error (excluding identical pixels): "
|
||||
<< "R=" << avg_abs_error_r << " "
|
||||
<< "G=" << avg_abs_error_g << " "
|
||||
@ -232,7 +225,7 @@ bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp,
|
||||
<< "G=" << max_abs_error_g << " "
|
||||
<< "B=" << max_abs_error_b << " "
|
||||
<< "A=" << max_abs_error_a;
|
||||
LOG(ERROR) << "Critical error: " << critial_error_pixels_count;
|
||||
LOG(ERROR) << "Critical errors: " << critial_error_pixels_count;
|
||||
|
||||
for (int x = 0; x < actual_bmp.width(); ++x) {
|
||||
for (int y = 0; y < actual_bmp.height(); ++y) {
|
||||
|
@ -22,18 +22,19 @@ class PixelComparator {
|
||||
// Exact pixel comparator. Counts the number of pixel with an error.
|
||||
class ExactPixelComparator : public PixelComparator {
|
||||
public:
|
||||
explicit ExactPixelComparator(const bool discard_alpha);
|
||||
~ExactPixelComparator() override = default;
|
||||
|
||||
// Returns true if the two bitmaps are identical. Otherwise, returns false
|
||||
// and report the number of pixels with an error on LOG(ERROR). Differences
|
||||
// in the alpha channel are ignored.
|
||||
// and report the number of pixels with an error on LOG(ERROR).
|
||||
bool Compare(const SkBitmap& actual_bmp,
|
||||
const SkBitmap& expected_bmp) const override;
|
||||
|
||||
private:
|
||||
protected:
|
||||
// Exclude alpha channel from comparison?
|
||||
bool discard_alpha_;
|
||||
bool discard_alpha_ = false;
|
||||
};
|
||||
|
||||
class AlphaDiscardingExactPixelComparator : public ExactPixelComparator {
|
||||
public:
|
||||
AlphaDiscardingExactPixelComparator() { discard_alpha_ = true; }
|
||||
};
|
||||
|
||||
// Different platforms have slightly different pixel output, due to different
|
||||
@ -58,49 +59,83 @@ class ManhattanDistancePixelComparator : public PixelComparator {
|
||||
};
|
||||
|
||||
// Fuzzy pixel comparator. Counts small and arbitrary errors separately and
|
||||
// computes average and maximum absolute errors per color channel.
|
||||
// computes average and maximum absolute errors per color channel. It can be
|
||||
// configured to discard alpha channel. If alpha channel is not discarded
|
||||
// (by default), alpha changing among fully transparent, translucent and fully
|
||||
// opaque (e.g. 0 to 1, 254 to 255) are always reported.
|
||||
class FuzzyPixelComparator : public PixelComparator {
|
||||
public:
|
||||
FuzzyPixelComparator(bool discard_alpha,
|
||||
float error_pixels_percentage_limit,
|
||||
float small_error_pixels_percentage_limit,
|
||||
float avg_abs_error_limit,
|
||||
int max_abs_error_limit,
|
||||
int small_error_threshold,
|
||||
bool check_critical_error = true);
|
||||
~FuzzyPixelComparator() override = default;
|
||||
FuzzyPixelComparator& DiscardAlpha() {
|
||||
discard_alpha_ = true;
|
||||
return *this;
|
||||
}
|
||||
// Sets the limits for percentages of pixels with errors:
|
||||
// - large errors: >small_abs_error_limit_,
|
||||
// - small errors: >0 and <= small_abs_error_limit_.
|
||||
// If small_abs_error_limit_ is zero (by default),
|
||||
// `large_error_pixels_percentage_limit` is for all errors.
|
||||
FuzzyPixelComparator& SetErrorPixelsPercentageLimit(
|
||||
float large_error_pixels_percentage_limit,
|
||||
float small_error_pixels_percentage_limit = 0) {
|
||||
large_error_pixels_percentage_limit_ = large_error_pixels_percentage_limit;
|
||||
small_error_pixels_percentage_limit_ = small_error_pixels_percentage_limit;
|
||||
return *this;
|
||||
}
|
||||
// Sets limit for average absolute error (excluding identical pixels).
|
||||
// The default is 255.0, which means it's not checked.
|
||||
FuzzyPixelComparator& SetAvgAbsErrorLimit(float avg_abs_error_limit) {
|
||||
avg_abs_error_limit_ = avg_abs_error_limit;
|
||||
return *this;
|
||||
}
|
||||
// Sets limits of the largest absolute error and the small absolute error.
|
||||
// The default of `max_abs_error_limit` is 255, which means it's not checked
|
||||
// by default. The default of `small_abs_eror_limit` is 0, which means all
|
||||
// errors are treated as large errors by default.
|
||||
FuzzyPixelComparator& SetAbsErrorLimit(int max_abs_error_limit,
|
||||
int small_abs_error_limit = 0) {
|
||||
max_abs_error_limit_ = max_abs_error_limit;
|
||||
small_abs_error_limit_ = small_abs_error_limit;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Computes error metrics and returns true if the errors don't exceed the
|
||||
// specified limits. Otherwise, returns false and reports the error metrics on
|
||||
// LOG(ERROR). Differences in the alpha channel are ignored.
|
||||
// LOG(ERROR).
|
||||
bool Compare(const SkBitmap& actual_bmp,
|
||||
const SkBitmap& expected_bmp) const override;
|
||||
|
||||
private:
|
||||
// Exclude alpha channel from comparison?
|
||||
bool discard_alpha_;
|
||||
// Limit for percentage of pixels with an error.
|
||||
float error_pixels_percentage_limit_;
|
||||
// Limit for percentage of pixels with a small error.
|
||||
float small_error_pixels_percentage_limit_;
|
||||
// Limit for average absolute error (excluding identical pixels).
|
||||
float avg_abs_error_limit_;
|
||||
// Limit for largest absolute error.
|
||||
int max_abs_error_limit_;
|
||||
// Threshold for small errors.
|
||||
int small_error_threshold_;
|
||||
// If true, comparator will report critical errors. For example:
|
||||
// alpha value goes from 0 to 1 or 256 to 255.
|
||||
bool check_critical_error_;
|
||||
bool discard_alpha_ = false;
|
||||
float large_error_pixels_percentage_limit_ = 0;
|
||||
// Limit for percentage of pixels with a small error
|
||||
// (>0 and <= small_abs_error_limit_).
|
||||
float small_error_pixels_percentage_limit_ = 0;
|
||||
float avg_abs_error_limit_ = 255.0;
|
||||
int max_abs_error_limit_ = 255;
|
||||
int small_abs_error_limit_ = 0;
|
||||
};
|
||||
|
||||
// All pixels can be off by one, but any more than that is an error.
|
||||
class FuzzyPixelOffByOneComparator : public FuzzyPixelComparator {
|
||||
public:
|
||||
explicit FuzzyPixelOffByOneComparator(bool discard_alpha)
|
||||
: FuzzyPixelComparator(discard_alpha, 100.f, 0.f, 1.f, 1, 0) {}
|
||||
FuzzyPixelOffByOneComparator() {
|
||||
SetErrorPixelsPercentageLimit(100.f);
|
||||
SetAbsErrorLimit(1);
|
||||
}
|
||||
|
||||
protected:
|
||||
using FuzzyPixelComparator::DiscardAlpha;
|
||||
using FuzzyPixelComparator::SetAbsErrorLimit;
|
||||
using FuzzyPixelComparator::SetAvgAbsErrorLimit;
|
||||
using FuzzyPixelComparator::SetErrorPixelsPercentageLimit;
|
||||
};
|
||||
|
||||
class AlphaDiscardingFuzzyPixelOffByOneComparator
|
||||
: public FuzzyPixelOffByOneComparator {
|
||||
public:
|
||||
AlphaDiscardingFuzzyPixelOffByOneComparator() { DiscardAlpha(); }
|
||||
};
|
||||
} // namespace cc
|
||||
|
||||
#endif // CC_TEST_PIXEL_COMPARATOR_H_
|
||||
|
@ -72,7 +72,8 @@ class LayerTreeHostBlendingPixelTest
|
||||
LayerTreeHostBlendingPixelTest()
|
||||
: LayerTreeHostPixelResourceTest(resource_type()),
|
||||
force_antialiasing_(false) {
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true);
|
||||
pixel_comparator_ =
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
}
|
||||
|
||||
RasterTestConfig resource_type() const {
|
||||
@ -224,17 +225,10 @@ class LayerTreeHostBlendingPixelTest
|
||||
|
||||
if (renderer_type_ == viz::RendererType::kSkiaVk) {
|
||||
// Blending results might differ with one pixel.
|
||||
float percentage_pixels_error = 35.f;
|
||||
float percentage_pixels_small_error = 0.f;
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 1;
|
||||
int small_error_allowed = 0;
|
||||
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
false, // discard_alpha
|
||||
percentage_pixels_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.SetErrorPixelsPercentageLimit(35.f)
|
||||
.SetAbsErrorLimit(1));
|
||||
}
|
||||
|
||||
RunPixelResourceTest(root, CreateBlendingWithRenderPassExpected(
|
||||
|
@ -111,16 +111,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, BackdropFilterBlurRect) {
|
||||
|
||||
#if BUILDFLAG(IS_WIN) || defined(ARCH_CPU_ARM64)
|
||||
// Windows and ARM64 have 436 pixels off by 1: crbug.com/259915
|
||||
float percentage_pixels_large_error = 1.09f; // 436px / (200*200)
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 1;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(1.09f) // 436px / (200*200)
|
||||
.SetAbsErrorLimit(1));
|
||||
#endif
|
||||
|
||||
RunPixelTest(background,
|
||||
@ -176,22 +171,20 @@ TEST_P(LayerTreeHostFiltersPixelTest, BackdropFilterBlurRadius) {
|
||||
blur->SetBackdropFilterBounds(backdrop_filter_bounds);
|
||||
|
||||
#if BUILDFLAG(IS_FUCHSIA)
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(false);
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>();
|
||||
#elif BUILDFLAG(IS_WIN) || defined(ARCH_CPU_ARM64)
|
||||
// Windows and ARM64 have 436 pixels off by 1: crbug.com/259915
|
||||
float percentage_pixels_large_error = 1.09f; // 436px / (200*200)
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 2;
|
||||
int small_error_allowed = 0;
|
||||
// Windows and ARM64 have 436 pixels off by 1 or 2: crbug.com/259915
|
||||
float percentage_pixels_error = 1.09f; // 436px / (200*200)
|
||||
// Windows using Dawn D3D12 has 4044 pixels off by max of 2.
|
||||
if (use_d3d12())
|
||||
percentage_pixels_large_error = 2.5275f; // 4044px / (400*400)
|
||||
if (use_d3d12()) {
|
||||
percentage_pixels_error = 2.5275f; // 4044px / (400*400)
|
||||
}
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(percentage_pixels_error)
|
||||
.SetAvgAbsErrorLimit(1.f)
|
||||
.SetAbsErrorLimit(2));
|
||||
#endif
|
||||
RunPixelTest(
|
||||
background,
|
||||
@ -228,15 +221,16 @@ TEST_P(LayerTreeHostFiltersPixelTest, BackdropFilterBlurRounded) {
|
||||
// Allow for ~1 perimeter of the clip path to have a small error.
|
||||
float percentage_pixels_small_error = 100.f * (100*4) / (200*200);
|
||||
int large_error_limit = 128; // Off by two samples in 4 MSAA.
|
||||
float percentage_pixels_large_or_small_error =
|
||||
1.01f * percentage_pixels_small_error;
|
||||
float percentage_pixels_large_error = 0.01f * percentage_pixels_small_error;
|
||||
// Divide average error by 4 since we blur most of the result.
|
||||
float average_error_allowed_in_bad_pixels = small_error_threshold / 4.f;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_or_small_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_limit,
|
||||
small_error_threshold);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(percentage_pixels_large_error,
|
||||
percentage_pixels_small_error)
|
||||
.SetAvgAbsErrorLimit(average_error_allowed_in_bad_pixels)
|
||||
.SetAbsErrorLimit(large_error_limit, small_error_threshold));
|
||||
|
||||
RunPixelTest(background, use_software_renderer()
|
||||
? base::FilePath(FILE_PATH_LITERAL(
|
||||
@ -273,23 +267,21 @@ TEST_P(LayerTreeHostFiltersPixelTest, BackdropFilterBlurOutsets) {
|
||||
#if BUILDFLAG(IS_WIN) || defined(_MIPS_ARCH_LOONGSON) || defined(ARCH_CPU_ARM64)
|
||||
#if BUILDFLAG(IS_WIN) || defined(ARCH_CPU_ARM64)
|
||||
// Windows has 5.9325% pixels by at most 2: crbug.com/259922
|
||||
float percentage_pixels_large_error = 6.0f;
|
||||
float percentage_pixels_error = 6.0f;
|
||||
#else
|
||||
// Loongson has 8.685% pixels by at most 2: crbug.com/819110
|
||||
float percentage_pixels_large_error = 8.7f;
|
||||
float percentage_pixels_error = 8.7f;
|
||||
#endif
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 2.f;
|
||||
int large_error_allowed = 2;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(percentage_pixels_error)
|
||||
.SetAbsErrorLimit(2));
|
||||
#else
|
||||
if (use_skia_vulkan())
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true);
|
||||
if (use_skia_vulkan()) {
|
||||
pixel_comparator_ =
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
}
|
||||
#endif
|
||||
|
||||
RunPixelTest(
|
||||
@ -383,26 +375,26 @@ TEST_P(LayerTreeHostBlurFiltersPixelTestGPULayerList,
|
||||
#if BUILDFLAG(IS_WIN) || defined(ARCH_CPU_ARM64)
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Windows has 116 pixels off by at most 2: crbug.com/225027
|
||||
float percentage_pixels_large_error = 0.3f; // 116px / (200*200), rounded up
|
||||
int large_error_allowed = 2;
|
||||
float percentage_pixels_error = 0.3f; // 116px / (200*200), rounded up
|
||||
int error_allowed = 2;
|
||||
// Windows on SkiaRenderer Dawn has 447 pixels off by at most 2.
|
||||
if (use_d3d12())
|
||||
percentage_pixels_large_error = 1.12f; // 447px / (200*200), rounded up
|
||||
percentage_pixels_error = 1.12f; // 447px / (200*200), rounded up
|
||||
#else
|
||||
float percentage_pixels_large_error = 0.25f; // 96px / (200*200), rounded up
|
||||
int large_error_allowed = 1;
|
||||
float percentage_pixels_error = 0.25f; // 96px / (200*200), rounded up
|
||||
int error_allowed = 1;
|
||||
#endif
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(percentage_pixels_error)
|
||||
.SetAvgAbsErrorLimit(average_error_allowed_in_bad_pixels)
|
||||
.SetAbsErrorLimit(error_allowed));
|
||||
#else
|
||||
if (use_skia_vulkan() || renderer_type_ == viz::RendererType::kSkiaDawn)
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true);
|
||||
pixel_comparator_ =
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
#endif
|
||||
|
||||
RunPixelTestWithLayerList(
|
||||
@ -595,39 +587,37 @@ TEST_P(LayerTreeHostFiltersPixelTest, ImageFilterScaled) {
|
||||
|
||||
#if BUILDFLAG(IS_FUCHSIA)
|
||||
if (renderer_type() == viz::RendererType::kSkiaVk) {
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(false);
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>();
|
||||
}
|
||||
#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || \
|
||||
defined(_MIPS_ARCH_LOONGSON) || defined(ARCH_CPU_ARM64)
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Windows has 153 pixels off by at most 2: crbug.com/225027
|
||||
float percentage_pixels_large_error = 0.3825f; // 153px / (200*200)
|
||||
int large_error_allowed = 2;
|
||||
float percentage_pixels_error = 0.3825f; // 153px / (200*200)
|
||||
int error_allowed = 2;
|
||||
// Windows using Dawn D3D12 has 166 pixels off by 1.
|
||||
if (use_d3d12()) {
|
||||
percentage_pixels_large_error = 0.415f; // 166px / (200*200)
|
||||
large_error_allowed = 1;
|
||||
percentage_pixels_error = 0.415f; // 166px / (200*200)
|
||||
error_allowed = 1;
|
||||
}
|
||||
#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
|
||||
// There's a 1 pixel error on MacOS and ChromeOS
|
||||
float percentage_pixels_large_error = 0.0025f; // 1px / (200*200)
|
||||
int large_error_allowed = 1;
|
||||
float percentage_pixels_error = 0.0025f; // 1px / (200*200)
|
||||
int error_allowed = 1;
|
||||
#elif defined(_MIPS_ARCH_LOONGSON)
|
||||
// Loongson has 2 pixels off by at most 2: crbug.com/819075
|
||||
float percentage_pixels_large_error = 0.005f; // 2px / (200*200)
|
||||
int large_error_allowed = 2;
|
||||
float percentage_pixels_error = 0.005f; // 2px / (200*200)
|
||||
int error_allowed = 2;
|
||||
#else
|
||||
float percentage_pixels_large_error = 0.0325f; // 13px / (200*200)
|
||||
int large_error_allowed = 1;
|
||||
float percentage_pixels_error = 0.0325f; // 13px / (200*200)
|
||||
int error_allowed = 1;
|
||||
#endif
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(percentage_pixels_error)
|
||||
.SetAvgAbsErrorLimit(1.f)
|
||||
.SetAbsErrorLimit(error_allowed));
|
||||
#endif
|
||||
|
||||
RunPixelTest(
|
||||
@ -682,16 +672,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, BackdropFilterRotated) {
|
||||
// changes to blur or rectangle rendering.
|
||||
// Fuchsia/Flutter forces off the lowp skia raster pipeline resulting
|
||||
// in a totally different code path for software rendering.
|
||||
float percentage_pixels_large_error = 5.f;
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 2.f;
|
||||
int large_error_allowed = 2;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(5.f)
|
||||
.SetAbsErrorLimit(2));
|
||||
|
||||
RunPixelTest(background,
|
||||
base::FilePath(FILE_PATH_LITERAL("backdrop_filter_rotated_.png"))
|
||||
@ -728,27 +713,27 @@ TEST_P(LayerTreeHostFiltersPixelTest, ImageRenderSurfaceScaled) {
|
||||
|
||||
background->AddChild(render_surface_layer);
|
||||
|
||||
float percentage_pixels_large_error = 0.0f;
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float percentage_pixels_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 0.0f;
|
||||
int large_error_allowed = 0;
|
||||
int small_error_allowed = 0;
|
||||
int error_allowed = 0;
|
||||
if (use_software_renderer()) {
|
||||
// Software has some huge differences in the AA'd pixels on the different
|
||||
// trybots. See crbug.com/452198.
|
||||
percentage_pixels_large_error = 0.686f;
|
||||
percentage_pixels_error = 0.686f;
|
||||
average_error_allowed_in_bad_pixels = 16.f;
|
||||
large_error_allowed = 17;
|
||||
error_allowed = 17;
|
||||
} else if (use_d3d12()) {
|
||||
// Windows using Dawn D3D12 has 25 pixels off by 1.
|
||||
percentage_pixels_large_error = 0.028;
|
||||
percentage_pixels_error = 0.028;
|
||||
average_error_allowed_in_bad_pixels = 1.f;
|
||||
large_error_allowed = 1;
|
||||
error_allowed = 1;
|
||||
}
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
/*discard_alpha=*/true, percentage_pixels_large_error,
|
||||
percentage_pixels_small_error, average_error_allowed_in_bad_pixels,
|
||||
large_error_allowed, small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(percentage_pixels_error)
|
||||
.SetAvgAbsErrorLimit(average_error_allowed_in_bad_pixels)
|
||||
.SetAbsErrorLimit(error_allowed));
|
||||
|
||||
RunPixelTest(
|
||||
background,
|
||||
@ -808,16 +793,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, ZoomFilter) {
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Windows has 1 pixel off by 1: crbug.com/259915
|
||||
float percentage_pixels_large_error = 0.00111112f; // 1px / (300*300)
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 1;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(0.00111112f) // 1px / (300*300)
|
||||
.SetAbsErrorLimit(1));
|
||||
#endif
|
||||
|
||||
RunPixelTest(std::move(root),
|
||||
@ -851,29 +831,28 @@ TEST_P(LayerTreeHostFiltersPixelTest, RotatedFilter) {
|
||||
#if defined(ARCH_CPU_ARM64)
|
||||
// Windows, macOS, and Fuchsia on ARM64 has some pixels difference
|
||||
// crbug.com/1029728, crbug.com/1048249, crbug.com/1128443
|
||||
float percentage_pixels_large_error = 1.f;
|
||||
float percentage_pixels_error = 1.f;
|
||||
float average_error_allowed_in_bad_pixels = 2.f;
|
||||
int large_error_allowed = 3;
|
||||
int error_allowed = 3;
|
||||
#elif BUILDFLAG(IS_WIN)
|
||||
// Windows has 1 pixel off by 1: crbug.com/259915
|
||||
float percentage_pixels_large_error = 0.00111112f; // 1px / (300*300)
|
||||
float percentage_pixels_error = 0.00111112f; // 1px / (300*300)
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 1;
|
||||
int error_allowed = 1;
|
||||
// Windows using Dawn D3D12 has 104 pixels off by 1.
|
||||
if (use_d3d12())
|
||||
percentage_pixels_large_error = 0.115556f; // 104px / (300*300)
|
||||
percentage_pixels_error = 0.115556f; // 104px / (300*300)
|
||||
#else
|
||||
float percentage_pixels_large_error = 0.0f; // 1px / (300*300)
|
||||
float percentage_pixels_error = 0.0f; // 1px / (300*300)
|
||||
float average_error_allowed_in_bad_pixels = 0.0f;
|
||||
int large_error_allowed = 0;
|
||||
int error_allowed = 0;
|
||||
#endif
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(percentage_pixels_error)
|
||||
.SetAvgAbsErrorLimit(average_error_allowed_in_bad_pixels)
|
||||
.SetAbsErrorLimit(error_allowed));
|
||||
#endif
|
||||
|
||||
RunPixelTest(background,
|
||||
@ -914,33 +893,34 @@ TEST_P(LayerTreeHostFiltersPixelTest, RotatedDropShadowFilter) {
|
||||
(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_MAC))
|
||||
// Windows, macOS, and Fuchsia on ARM64 has some pixels difference.
|
||||
// crbug.com/1029728, crbug.com/1128443
|
||||
float percentage_pixels_large_error = 0.89f;
|
||||
float percentage_pixels_error = 0.89f;
|
||||
float average_error_allowed_in_bad_pixels = 5.f;
|
||||
int large_error_allowed = 17;
|
||||
int error_allowed = 17;
|
||||
#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE)
|
||||
// There's a 1 pixel error on MacOS and ChromeOS
|
||||
float percentage_pixels_large_error = 0.00111112f; // 1px / (300*300)
|
||||
float percentage_pixels_error = 0.00111112f; // 1px / (300*300)
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 1;
|
||||
int error_allowed = 1;
|
||||
#else
|
||||
// Windows and all other ARM64 have 3 pixels off by 1: crbug.com/259915
|
||||
float percentage_pixels_large_error = 0.00333334f; // 3px / (300*300)
|
||||
float percentage_pixels_error = 0.00333334f; // 3px / (300*300)
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 1;
|
||||
int error_allowed = 1;
|
||||
// Windows using Dawn D3D12 has 22 pixels off by 1.
|
||||
if (use_d3d12())
|
||||
percentage_pixels_large_error = 0.02445; // 22px / (300*300)
|
||||
percentage_pixels_error = 0.02445; // 22px / (300*300)
|
||||
#endif
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(percentage_pixels_error)
|
||||
.SetAvgAbsErrorLimit(average_error_allowed_in_bad_pixels)
|
||||
.SetAbsErrorLimit(error_allowed));
|
||||
#else
|
||||
if (use_skia_vulkan())
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true);
|
||||
if (use_skia_vulkan()) {
|
||||
pixel_comparator_ =
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
}
|
||||
#endif
|
||||
|
||||
RunPixelTest(
|
||||
@ -983,8 +963,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, TranslatedFilter) {
|
||||
parent->AddChild(child);
|
||||
clip->AddChild(parent);
|
||||
|
||||
if (use_software_renderer() || renderer_type_ == viz::RendererType::kSkiaDawn)
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true);
|
||||
if (use_software_renderer() ||
|
||||
renderer_type_ == viz::RendererType::kSkiaDawn) {
|
||||
pixel_comparator_ =
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
}
|
||||
|
||||
RunPixelTest(clip, base::FilePath(
|
||||
FILE_PATH_LITERAL("translated_blue_green_alpha.png")));
|
||||
@ -1095,21 +1078,18 @@ TEST_P(LayerTreeHostFiltersPixelTest, BlurFilterWithClip) {
|
||||
#if BUILDFLAG(IS_WIN) || defined(ARCH_CPU_ARM64)
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Windows has 1880 pixels off by 1: crbug.com/259915
|
||||
float percentage_pixels_large_error = 4.7f; // 1880px / (200*200)
|
||||
float percentage_pixels_error = 4.7f; // 1880px / (200*200)
|
||||
#else
|
||||
// Differences in floating point calculation on ARM means a small percentage
|
||||
// of pixels will have small differences.
|
||||
float percentage_pixels_large_error = 2.76f; // 1104px / (200*200)
|
||||
float percentage_pixels_error = 2.76f; // 1104px / (200*200)
|
||||
#endif
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 2;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(percentage_pixels_error)
|
||||
.SetAvgAbsErrorLimit(1.f)
|
||||
.SetAbsErrorLimit(2));
|
||||
#endif
|
||||
|
||||
RunPixelTest(filter_layer,
|
||||
@ -1224,16 +1204,11 @@ class BackdropFilterInvertTest : public LayerTreeHostFiltersPixelTest {
|
||||
expected_result = expected_result.InsertBeforeExtensionASCII("_sw");
|
||||
} else if (use_d3d12()) {
|
||||
// Windows using Dawn D3D12 has 16 pixels off by 1.
|
||||
float percentage_pixels_large_error = 0.04f; // 16px / (200*200)
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 1;
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(0.04f) // 16px / (200*200)
|
||||
.SetAbsErrorLimit(1));
|
||||
}
|
||||
RunPixelTest(std::move(root), expected_result);
|
||||
}
|
||||
|
@ -105,7 +105,8 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayer) {
|
||||
mask->SetIsDrawable(true);
|
||||
green->SetMaskLayer(mask);
|
||||
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true);
|
||||
pixel_comparator_ =
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
|
||||
RunPixelResourceTest(background,
|
||||
base::FilePath(FILE_PATH_LITERAL("mask_of_layer.png")));
|
||||
@ -163,7 +164,7 @@ TEST_P(LayerTreeHostMaskPixelTestWithLayerList, MaskWithEffect) {
|
||||
mask_layer_ = PictureLayer::Create(&client);
|
||||
|
||||
pixel_comparator_ =
|
||||
std::make_unique<FuzzyPixelOffByOneComparator>(true /* discard_alpha */);
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
RunPixelResourceTestWithLayerList(
|
||||
base::FilePath(FILE_PATH_LITERAL("mask_with_effect.png")));
|
||||
}
|
||||
@ -298,7 +299,7 @@ TEST_P(LayerTreeHostMaskPixelTest_ScaledMaskWithEffect, Test) {
|
||||
mask_layer_ = PictureLayer::Create(&client);
|
||||
|
||||
pixel_comparator_ =
|
||||
std::make_unique<FuzzyPixelOffByOneComparator>(true /* discard_alpha */);
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
|
||||
RunPixelResourceTestWithLayerList(
|
||||
base::FilePath(FILE_PATH_LITERAL("scaled_mask_with_effect_.png"))
|
||||
@ -311,7 +312,7 @@ TEST_P(LayerTreeHostMaskPixelTestWithLayerList, MaskWithEffectDifferentSize) {
|
||||
mask_layer_ = PictureLayer::Create(&client);
|
||||
|
||||
pixel_comparator_ =
|
||||
std::make_unique<FuzzyPixelOffByOneComparator>(true /* discard_alpha */);
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
|
||||
// The mask is half the size of thing it's masking. In layer-list mode,
|
||||
// the mask is not automatically scaled to match the other layer.
|
||||
@ -334,7 +335,7 @@ TEST_P(LayerTreeHostMaskPixelTestWithLayerList, ImageMaskWithEffect) {
|
||||
mask_layer_ = FakePictureLayer::Create(&layer_client);
|
||||
|
||||
pixel_comparator_ =
|
||||
std::make_unique<FuzzyPixelOffByOneComparator>(true /* discard_alpha */);
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
|
||||
// The mask is half the size of thing it's masking. In layer-list mode,
|
||||
// the mask is not automatically scaled to match the other layer.
|
||||
@ -368,7 +369,7 @@ TEST_P(LayerTreeHostMasksPixelTest, ImageMaskOfLayer) {
|
||||
background->AddChild(green);
|
||||
|
||||
pixel_comparator_ =
|
||||
std::make_unique<FuzzyPixelOffByOneComparator>(true /* discard_alpha */);
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
|
||||
RunPixelResourceTest(
|
||||
background, base::FilePath(FILE_PATH_LITERAL("image_mask_of_layer.png")));
|
||||
@ -397,7 +398,7 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskOfClippedLayer) {
|
||||
green->SetMaskLayer(mask);
|
||||
|
||||
pixel_comparator_ =
|
||||
std::make_unique<FuzzyPixelOffByOneComparator>(true /* discard_alpha */);
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
|
||||
RunPixelResourceTest(
|
||||
background,
|
||||
@ -421,7 +422,7 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayerNonExactTextureSize) {
|
||||
green->SetMaskLayer(mask);
|
||||
|
||||
pixel_comparator_ =
|
||||
std::make_unique<FuzzyPixelOffByOneComparator>(true /* discard_alpha */);
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
|
||||
RunPixelResourceTest(background,
|
||||
base::FilePath(FILE_PATH_LITERAL(
|
||||
@ -577,15 +578,11 @@ TEST_P(LayerTreeHostMasksForBackdropFiltersPixelTestWithLayerList, Test) {
|
||||
if (use_skia_vulkan() && use_accelerated_raster()) {
|
||||
// Vulkan with OOP raster has 3 pixels errors (the circle mask shape is
|
||||
// slightly different).
|
||||
float percentage_pixels_large_error = 0.031f; // 3px / (100*100)
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 182.f;
|
||||
int large_error_allowed = 182;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true /* discard_alpha */, percentage_pixels_large_error,
|
||||
percentage_pixels_small_error, average_error_allowed_in_bad_pixels,
|
||||
large_error_allowed, small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(0.031f) // 3px / (100*100)
|
||||
.SetAbsErrorLimit(182));
|
||||
}
|
||||
|
||||
RunPixelResourceTestWithLayerList(image_name);
|
||||
@ -637,15 +634,11 @@ TEST_P(LayerTreeHostMasksForBackdropFiltersPixelTestWithLayerTree, Test) {
|
||||
if (use_skia_vulkan() && use_accelerated_raster()) {
|
||||
// Vulkan with OOP raster has 3 pixels errors (the circle mask shape is
|
||||
// slightly different).
|
||||
float percentage_pixels_large_error = 0.031f; // 3px / (100*100)
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 182.f;
|
||||
int large_error_allowed = 182;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true /* discard_alpha */, percentage_pixels_large_error,
|
||||
percentage_pixels_small_error, average_error_allowed_in_bad_pixels,
|
||||
large_error_allowed, small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(0.031f) // 3px / (100*100)
|
||||
.SetAbsErrorLimit(182));
|
||||
}
|
||||
|
||||
RunPixelResourceTest(background, image_name);
|
||||
@ -682,18 +675,11 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayerWithBlend) {
|
||||
mask->SetIsDrawable(true);
|
||||
picture_horizontal->SetMaskLayer(mask);
|
||||
|
||||
float percentage_pixels_large_error = 0.04f; // 0.04%, ~6px / (128*128)
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 256.0f;
|
||||
int large_error_allowed = 256;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error,
|
||||
percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels,
|
||||
large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(0.04f) // 0.04%, ~6px / (128*128)
|
||||
.SetAbsErrorLimit(255));
|
||||
|
||||
RunPixelResourceTest(background,
|
||||
base::FilePath(
|
||||
@ -744,14 +730,14 @@ class LayerTreeHostMaskAsBlendingPixelTest
|
||||
: LayerTreeHostPixelResourceTest(GetParam().test_config),
|
||||
use_antialiasing_(GetParam().flags & kUseAntialiasing),
|
||||
force_shaders_(GetParam().flags & kForceShaders) {
|
||||
float percentage_pixels_error = 0.f;
|
||||
float percentage_pixels_large_error = 0.f;
|
||||
float percentage_pixels_small_error = 0.f;
|
||||
float average_error_allowed_in_bad_pixels = 0.f;
|
||||
int large_error_allowed = 0;
|
||||
int small_error_allowed = 0;
|
||||
if (!use_software_renderer()) {
|
||||
percentage_pixels_error = 6.0f;
|
||||
percentage_pixels_small_error = 2.f;
|
||||
percentage_pixels_large_error = 4.0f;
|
||||
percentage_pixels_small_error = 2.0f;
|
||||
average_error_allowed_in_bad_pixels = 2.1f;
|
||||
large_error_allowed = 11;
|
||||
small_error_allowed = 1;
|
||||
@ -761,13 +747,13 @@ class LayerTreeHostMaskAsBlendingPixelTest
|
||||
// ARM Windows, macOS, and Fuchsia has some pixels difference
|
||||
// Affected tests: RotatedClippedCircle, RotatedClippedCircleUnderflow
|
||||
// crbug.com/1030244, crbug.com/1048249, crbug.com/1128443
|
||||
percentage_pixels_error = 7.f;
|
||||
percentage_pixels_large_error = 7.f;
|
||||
average_error_allowed_in_bad_pixels = 5.f;
|
||||
large_error_allowed = 20;
|
||||
#else
|
||||
// Differences in floating point calculation on ARM means a small
|
||||
// percentage of pixels will be off by 1.
|
||||
percentage_pixels_error = 0.112f;
|
||||
percentage_pixels_large_error = 0.112f;
|
||||
average_error_allowed_in_bad_pixels = 1.f;
|
||||
large_error_allowed = 1;
|
||||
#endif
|
||||
@ -775,10 +761,11 @@ class LayerTreeHostMaskAsBlendingPixelTest
|
||||
}
|
||||
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
false, // discard_alpha
|
||||
percentage_pixels_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
FuzzyPixelComparator()
|
||||
.SetErrorPixelsPercentageLimit(percentage_pixels_large_error,
|
||||
percentage_pixels_small_error)
|
||||
.SetAvgAbsErrorLimit(average_error_allowed_in_bad_pixels)
|
||||
.SetAbsErrorLimit(large_error_allowed, small_error_allowed));
|
||||
}
|
||||
|
||||
static scoped_refptr<Layer> CreateCheckerboardLayer(const gfx::Size& bounds) {
|
||||
|
@ -50,20 +50,18 @@ TEST_P(LayerTreeHostMirrorPixelTest, MirrorLayer) {
|
||||
background->AddChild(mirror_layer);
|
||||
|
||||
if (use_software_renderer()) {
|
||||
const bool discard_alpha = true;
|
||||
const float error_pixels_percentage_limit = 3.f;
|
||||
const float small_error_pixels_percentage_limit = 0.f;
|
||||
const float avg_abs_error_limit = 65.f;
|
||||
const int max_abs_error_limit = 120;
|
||||
const int small_error_threshold = 0;
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
discard_alpha, error_pixels_percentage_limit,
|
||||
small_error_pixels_percentage_limit, avg_abs_error_limit,
|
||||
max_abs_error_limit, small_error_threshold);
|
||||
FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(3.f)
|
||||
.SetAvgAbsErrorLimit(65.f)
|
||||
.SetAbsErrorLimit(120));
|
||||
}
|
||||
|
||||
if (use_skia_vulkan())
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true);
|
||||
if (use_skia_vulkan()) {
|
||||
pixel_comparator_ =
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
}
|
||||
|
||||
RunPixelTest(background,
|
||||
base::FilePath(FILE_PATH_LITERAL("mirror_layer.png")));
|
||||
|
@ -176,7 +176,8 @@ TEST_P(LayerTreeHostScrollbarsPixelTest, MAYBE_HugeTransformScale) {
|
||||
scale_transform.Scale(scale, scale);
|
||||
layer->SetTransform(scale_transform);
|
||||
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true);
|
||||
pixel_comparator_ =
|
||||
std::make_unique<AlphaDiscardingFuzzyPixelOffByOneComparator>();
|
||||
|
||||
RunPixelTest(background,
|
||||
base::FilePath(use_skia_vulkan()
|
||||
|
@ -337,7 +337,7 @@ TEST_P(LayerTreeHostTilesTestRasterColorSpace, GenericRGB) {
|
||||
|
||||
TEST_P(LayerTreeHostTilesTestRasterColorSpace, CustomColorSpace) {
|
||||
#if BUILDFLAG(IS_FUCHSIA)
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(false);
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>();
|
||||
#endif
|
||||
// Create a color space with a different blue point.
|
||||
SkColorSpacePrimaries primaries;
|
||||
|
@ -215,9 +215,8 @@ TEST_F(AppIconFactoryTest, LoadFromFileSuccess) {
|
||||
EXPECT_FALSE(fallback_called);
|
||||
ASSERT_TRUE(result);
|
||||
|
||||
EXPECT_TRUE(
|
||||
cc::MatchesBitmap(*bitmap, *result->uncompressed.bitmap(),
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)));
|
||||
EXPECT_TRUE(cc::MatchesBitmap(*bitmap, *result->uncompressed.bitmap(),
|
||||
cc::ExactPixelComparator()));
|
||||
}
|
||||
|
||||
TEST_F(AppIconFactoryTest, LoadFromFileFallback) {
|
||||
|
@ -36,20 +36,16 @@
|
||||
// Mac has subtle rendering differences between different versions of MacOS, so
|
||||
// we account for them with these fuzzy pixel comparators. These two comparators
|
||||
// are used in different tests in order to keep the matching somewhat strict.
|
||||
const cc::FuzzyPixelComparator mac_strict_comparator(
|
||||
/* discard_alpha */ true,
|
||||
/* error_pixels_percentage_limit */ 3.f,
|
||||
/* small_error_pixels_percentage_limit */ 0.f,
|
||||
/* avg_abs_error_limit */ 20.f,
|
||||
/* max_abs_error_limit */ 49.f,
|
||||
/* small_error_threshold */ 0);
|
||||
const cc::FuzzyPixelComparator mac_loose_comparator(
|
||||
/* discard_alpha */ true,
|
||||
/* error_pixels_percentage_limit */ 8.7f,
|
||||
/* small_error_pixels_percentage_limit */ 0.f,
|
||||
/* avg_abs_error_limit */ 20.f,
|
||||
/* max_abs_error_limit */ 43.f,
|
||||
/* small_error_threshold */ 0);
|
||||
const auto mac_strict_comparator = cc::FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(3.f)
|
||||
.SetAvgAbsErrorLimit(20.f)
|
||||
.SetAbsErrorLimit(49);
|
||||
const auto mac_loose_comparator = cc::FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(8.7f)
|
||||
.SetAvgAbsErrorLimit(20.f)
|
||||
.SetAbsErrorLimit(43);
|
||||
#endif
|
||||
|
||||
class FocusRingBrowserTest : public InProcessBrowserTest {
|
||||
@ -119,9 +115,9 @@ class FocusRingBrowserTest : public InProcessBrowserTest {
|
||||
#endif
|
||||
IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, MAYBE_Checkbox) {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
cc::FuzzyPixelComparator comparator = mac_strict_comparator;
|
||||
auto comparator = mac_strict_comparator;
|
||||
#else
|
||||
cc::ExactPixelComparator comparator(/*discard_alpha=*/true);
|
||||
cc::AlphaDiscardingExactPixelComparator comparator;
|
||||
#endif
|
||||
RunTest("focus_ring_browsertest_checkbox",
|
||||
"<input type=checkbox autofocus>"
|
||||
@ -138,9 +134,9 @@ IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, MAYBE_Checkbox) {
|
||||
#endif
|
||||
IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, MAYBE_Radio) {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
cc::FuzzyPixelComparator comparator = mac_loose_comparator;
|
||||
auto comparator = mac_loose_comparator;
|
||||
#else
|
||||
cc::ExactPixelComparator comparator(/*discard_alpha=*/true);
|
||||
cc::AlphaDiscardingExactPixelComparator comparator;
|
||||
#endif
|
||||
RunTest("focus_ring_browsertest_radio",
|
||||
"<input type=radio autofocus>"
|
||||
@ -157,9 +153,9 @@ IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, MAYBE_Radio) {
|
||||
#endif
|
||||
IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, MAYBE_Button) {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
cc::FuzzyPixelComparator comparator = mac_strict_comparator;
|
||||
auto comparator = mac_strict_comparator;
|
||||
#else
|
||||
cc::ExactPixelComparator comparator(/*discard_alpha=*/true);
|
||||
cc::AlphaDiscardingExactPixelComparator comparator;
|
||||
#endif
|
||||
RunTest("focus_ring_browsertest_button",
|
||||
"<button autofocus style=\"width:40px;height:20px;\"></button>"
|
||||
@ -178,9 +174,9 @@ IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, MAYBE_Button) {
|
||||
#endif
|
||||
IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, MAYBE_Anchor) {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
cc::FuzzyPixelComparator comparator = mac_strict_comparator;
|
||||
auto comparator = mac_strict_comparator;
|
||||
#else
|
||||
cc::ExactPixelComparator comparator(/*discard_alpha=*/true);
|
||||
cc::AlphaDiscardingExactPixelComparator comparator;
|
||||
#endif
|
||||
RunTest("focus_ring_browsertest_anchor",
|
||||
"<div style='text-align: center; width: 80px;'>"
|
||||
@ -204,9 +200,9 @@ IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, MAYBE_DarkModeButton) {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
if (!MacOSVersionSupportsDarkMode())
|
||||
return;
|
||||
cc::FuzzyPixelComparator comparator = mac_strict_comparator;
|
||||
auto comparator = mac_strict_comparator;
|
||||
#else
|
||||
cc::ExactPixelComparator comparator(/*discard_alpha=*/true);
|
||||
cc::AlphaDiscardingExactPixelComparator comparator;
|
||||
#endif
|
||||
RunTest("focus_ring_browsertest_dark_mode_button",
|
||||
"<meta name=\"color-scheme\" content=\"dark\">"
|
||||
|
@ -240,7 +240,7 @@ class ReadbackHolder : public base::RefCountedThreadSafe<ReadbackHolder> {
|
||||
std::unique_ptr<base::RunLoop> run_loop_;
|
||||
};
|
||||
|
||||
const cc::ExactPixelComparator pixel_comparator(/*discard_alpha=*/false);
|
||||
const cc::ExactPixelComparator pixel_comparator;
|
||||
|
||||
// Flaky on Lacros: https://crbug.com/1289366
|
||||
#if (BUILDFLAG(IS_MAC) && \
|
||||
|
@ -220,7 +220,7 @@ class SecurePaymentConfirmationDialogViewTest
|
||||
DialogViewID::INSTRUMENT_ICON)))
|
||||
->GetImage()
|
||||
.bitmap()),
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)));
|
||||
cc::ExactPixelComparator()));
|
||||
|
||||
ExpectLabelText(
|
||||
model_.total_label(),
|
||||
|
@ -850,8 +850,7 @@ TEST_F(DataOfferTest, SetClipboardDataImage) {
|
||||
ASSERT_TRUE(gfx::PNGCodec::Decode(
|
||||
reinterpret_cast<const unsigned char*>(result.data()), result.size(),
|
||||
&decoded));
|
||||
EXPECT_TRUE(cc::MatchesBitmap(
|
||||
image, decoded, cc::ExactPixelComparator(/*discard_alpha=*/false)));
|
||||
EXPECT_TRUE(cc::MatchesBitmap(image, decoded, cc::ExactPixelComparator()));
|
||||
std::string good = result;
|
||||
ASSERT_TRUE(ReadString(std::move(read_pipe2), &result));
|
||||
EXPECT_EQ(good, result);
|
||||
|
@ -929,7 +929,7 @@ TEST_P(RendererPixelTest, SimpleGreenRect) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, SimpleGreenRectNonRootRenderPass) {
|
||||
@ -966,7 +966,7 @@ TEST_P(RendererPixelTest, SimpleGreenRectNonRootRenderPass) {
|
||||
EXPECT_TRUE(this->RunPixelTestWithReadbackTarget(
|
||||
&pass_list, child_pass_ptr,
|
||||
base::FilePath(FILE_PATH_LITERAL("green_small.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, PremultipliedTextureWithoutBackground) {
|
||||
@ -995,7 +995,7 @@ TEST_P(RendererPixelTest, PremultipliedTextureWithoutBackground) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("green_alpha.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, PremultipliedTextureWithBackground) {
|
||||
@ -1027,7 +1027,7 @@ TEST_P(RendererPixelTest, PremultipliedTextureWithBackground) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("green_alpha.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, TextureDrawQuadVisibleRectInsetTopLeft) {
|
||||
@ -1061,7 +1061,7 @@ TEST_P(RendererPixelTest, TextureDrawQuadVisibleRectInsetTopLeft) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("inset_top_left.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
// This tests drawing a TextureDrawQuad with a visible_rect strictly included in
|
||||
@ -1105,7 +1105,7 @@ TEST_P(RendererPixelTest,
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("offset_inset_top_left.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, TextureDrawQuadVisibleRectInsetBottomRight) {
|
||||
@ -1146,7 +1146,7 @@ TEST_P(RendererPixelTest, TextureDrawQuadVisibleRectInsetBottomRight) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("inset_bottom_right.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(GPURendererPixelTest, SolidColorBlend) {
|
||||
@ -1180,7 +1180,7 @@ TEST_P(GPURendererPixelTest, SolidColorBlend) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("dark_grey.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(/*discard_alpha=*/true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(GPURendererPixelTest, SolidColorWithTemperature) {
|
||||
@ -1206,7 +1206,7 @@ TEST_P(GPURendererPixelTest, SolidColorWithTemperature) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("temperature_brown.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(GPURendererPixelTest, SolidColorWithTemperatureNonRootRenderPass) {
|
||||
@ -1248,7 +1248,7 @@ TEST_P(GPURendererPixelTest, SolidColorWithTemperatureNonRootRenderPass) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&render_passes_in_draw_order,
|
||||
base::FilePath(FILE_PATH_LITERAL("temperature_brown_non_root.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(GPURendererPixelTest,
|
||||
@ -1284,7 +1284,7 @@ TEST_P(GPURendererPixelTest,
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("green_alpha_vertex_opacity.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
class IntersectingQuadPixelTest : public VizPixelTestWithParam {
|
||||
@ -1413,7 +1413,7 @@ TEST_P(IntersectingQuadPixelTest, SolidColorQuads) {
|
||||
quad2->SetNew(this->back_quad_state_, this->quad_rect_, this->quad_rect_,
|
||||
SkColors::kGreen, false);
|
||||
this->AppendBackgroundAndRunTest(
|
||||
cc::FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f),
|
||||
cc::FuzzyPixelComparator().SetErrorPixelsPercentageLimit(2.f),
|
||||
FILE_PATH_LITERAL("intersecting_blue_green.png"));
|
||||
}
|
||||
|
||||
@ -1435,7 +1435,7 @@ TEST_P(IntersectingQuadPixelTest, TexturedQuads) {
|
||||
this->child_context_provider_, this->render_pass_.get());
|
||||
|
||||
this->AppendBackgroundAndRunTest(
|
||||
cc::FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f),
|
||||
cc::FuzzyPixelComparator().SetErrorPixelsPercentageLimit(2.f),
|
||||
FILE_PATH_LITERAL("intersecting_blue_green_squares.png"));
|
||||
}
|
||||
|
||||
@ -1461,7 +1461,7 @@ TEST_P(IntersectingQuadPixelTest, NonFlippedTexturedQuads) {
|
||||
this->child_context_provider_, this->render_pass_.get());
|
||||
|
||||
this->AppendBackgroundAndRunTest(
|
||||
cc::FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f),
|
||||
cc::FuzzyPixelComparator().SetErrorPixelsPercentageLimit(2.f),
|
||||
FILE_PATH_LITERAL(
|
||||
"intersecting_non_flipped_blue_green_half_size_rectangles.png"));
|
||||
}
|
||||
@ -1488,7 +1488,7 @@ TEST_P(IntersectingQuadPixelTest, FlippedTexturedQuads) {
|
||||
this->child_context_provider_, this->render_pass_.get());
|
||||
|
||||
this->AppendBackgroundAndRunTest(
|
||||
cc::FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f),
|
||||
cc::FuzzyPixelComparator().SetErrorPixelsPercentageLimit(2.f),
|
||||
FILE_PATH_LITERAL(
|
||||
"intersecting_flipped_blue_green_half_size_rectangles.png"));
|
||||
}
|
||||
@ -1543,7 +1543,7 @@ TEST_P(IntersectingQuadSoftwareTest, PictureQuads) {
|
||||
this->quad_rect_, 1.f, {},
|
||||
green_raster_source->GetDisplayItemList());
|
||||
this->AppendBackgroundAndRunTest(
|
||||
cc::FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f),
|
||||
cc::FuzzyPixelComparator().SetErrorPixelsPercentageLimit(2.f),
|
||||
FILE_PATH_LITERAL("intersecting_blue_green_squares.png"));
|
||||
}
|
||||
|
||||
@ -1586,7 +1586,7 @@ TEST_P(IntersectingQuadPixelTest, RenderPassQuads) {
|
||||
this->pass_list_.push_back(std::move(child_pass1));
|
||||
this->pass_list_.push_back(std::move(child_pass2));
|
||||
this->AppendBackgroundAndRunTest(
|
||||
cc::FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f),
|
||||
cc::FuzzyPixelComparator().SetErrorPixelsPercentageLimit(2.f),
|
||||
FILE_PATH_LITERAL("intersecting_blue_green_squares.png"));
|
||||
}
|
||||
|
||||
@ -1615,7 +1615,11 @@ TEST_P(IntersectingVideoQuadPixelTest, YUVVideoQuads) {
|
||||
this->child_context_provider_.get());
|
||||
|
||||
this->AppendBackgroundAndRunTest(
|
||||
cc::FuzzyPixelComparator(true, 0.50f, 0.f, 1.2f, 2, 0),
|
||||
cc::FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(0.50f)
|
||||
.SetAvgAbsErrorLimit(1.2f)
|
||||
.SetAbsErrorLimit(2),
|
||||
FILE_PATH_LITERAL("intersecting_blue_green_squares_video.png"));
|
||||
}
|
||||
|
||||
@ -1642,7 +1646,7 @@ TEST_P(IntersectingVideoQuadPixelTest, Y16VideoQuads) {
|
||||
this->child_context_provider_.get());
|
||||
|
||||
this->AppendBackgroundAndRunTest(
|
||||
cc::FuzzyPixelOffByOneComparator(false),
|
||||
cc::FuzzyPixelOffByOneComparator(),
|
||||
FILE_PATH_LITERAL("intersecting_light_dark_squares_video.png"));
|
||||
}
|
||||
|
||||
@ -1673,7 +1677,7 @@ TEST_P(GPURendererPixelTest, NonPremultipliedTextureWithoutBackground) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("green_alpha.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
// TODO(skaslev): The software renderer does not support non-premultplied alpha.
|
||||
@ -1706,7 +1710,7 @@ TEST_P(GPURendererPixelTest, NonPremultipliedTextureWithBackground) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("green_alpha.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
class VideoRendererPixelTestBase : public VizPixelTest {
|
||||
@ -1813,7 +1817,7 @@ TEST_P(VideoRendererPixelHiLoTest, SimpleYUVRect) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("yuv_stripes.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(VideoRendererPixelHiLoTest, ClippedYUVRect) {
|
||||
@ -1841,7 +1845,7 @@ TEST_P(VideoRendererPixelHiLoTest, ClippedYUVRect) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("yuv_stripes_clipped.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
#endif // #if BUILDFLAG(ENABLE_GL_BACKEND_TESTS)
|
||||
|
||||
@ -1886,7 +1890,7 @@ TEST_P(VideoRendererPixelTest, OffsetYUVRect) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("yuv_stripes_offset.png")),
|
||||
cc::FuzzyPixelComparator(true, 100.0f, 1.0f, 1.0f, 1, 0)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(VideoRendererPixelTest, SimpleYUVRectBlack) {
|
||||
@ -1913,9 +1917,9 @@ TEST_P(VideoRendererPixelTest, SimpleYUVRectBlack) {
|
||||
|
||||
// If we didn't get black out of the YUV values above, then we probably have a
|
||||
// color range issue.
|
||||
EXPECT_TRUE(this->RunPixelTest(&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("black.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("black.png")),
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(VideoRendererPixelTest, SimpleYUVJRect) {
|
||||
@ -1938,9 +1942,9 @@ TEST_P(VideoRendererPixelTest, SimpleYUVJRect) {
|
||||
AggregatedRenderPassList pass_list;
|
||||
pass_list.push_back(std::move(pass));
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(VideoRendererPixelTest, SimpleYUVJRectWithTemperature) {
|
||||
@ -1971,7 +1975,7 @@ TEST_P(VideoRendererPixelTest, SimpleYUVJRectWithTemperature) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("temperature_brown.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(VideoRendererPixelTest, SimpleNV12JRect) {
|
||||
@ -1994,9 +1998,9 @@ TEST_P(VideoRendererPixelTest, SimpleNV12JRect) {
|
||||
AggregatedRenderPassList pass_list;
|
||||
pass_list.push_back(std::move(pass));
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
// Test that a YUV video doesn't bleed outside of its tex coords when the
|
||||
@ -2005,9 +2009,9 @@ TEST_P(VideoRendererPixelTest, YUVEdgeBleed) {
|
||||
AggregatedRenderPassList pass_list;
|
||||
this->CreateEdgeBleedPass(media::PIXEL_FORMAT_I420,
|
||||
gfx::ColorSpace::CreateJpeg(), &pass_list);
|
||||
EXPECT_TRUE(this->RunPixelTest(&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(VideoRendererPixelTest, YUVAEdgeBleed) {
|
||||
@ -2016,9 +2020,9 @@ TEST_P(VideoRendererPixelTest, YUVAEdgeBleed) {
|
||||
gfx::ColorSpace::CreateREC601(), &pass_list);
|
||||
// Set the output color space to match the input primaries and transfer.
|
||||
this->display_color_spaces_ = kRec601DisplayColorSpaces;
|
||||
EXPECT_TRUE(this->RunPixelTest(&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(VideoRendererPixelTest, SimpleYUVJRectGrey) {
|
||||
@ -2043,7 +2047,7 @@ TEST_P(VideoRendererPixelTest, SimpleYUVJRectGrey) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("dark_grey.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(VideoRendererPixelTest, SimpleYUVARect) {
|
||||
@ -2072,7 +2076,7 @@ TEST_P(VideoRendererPixelTest, SimpleYUVARect) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("yuv_stripes_alpha.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(VideoRendererPixelTest, FullyTransparentYUVARect) {
|
||||
@ -2101,7 +2105,7 @@ TEST_P(VideoRendererPixelTest, FullyTransparentYUVARect) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("black.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
TEST_P(VideoRendererPixelTest, TwoColorY16Rect) {
|
||||
@ -2126,7 +2130,7 @@ TEST_P(VideoRendererPixelTest, TwoColorY16Rect) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("blue_yellow_filter_chain.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, FastPassColorFilterAlpha) {
|
||||
@ -2205,7 +2209,7 @@ TEST_P(RendererPixelTest, FastPassColorFilterAlpha) {
|
||||
// renderer so use a fuzzy comparator.
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(false)));
|
||||
cc::FuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, FastPassSaturateFilter) {
|
||||
@ -2266,7 +2270,7 @@ TEST_P(RendererPixelTest, FastPassSaturateFilter) {
|
||||
// renderer so use a fuzzy comparator.
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(false)));
|
||||
cc::FuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, FastPassFilterChain) {
|
||||
@ -2329,7 +2333,7 @@ TEST_P(RendererPixelTest, FastPassFilterChain) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("blue_yellow_filter_chain.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(false)));
|
||||
cc::FuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, FastPassColorFilterAlphaTranslation) {
|
||||
@ -2413,7 +2417,7 @@ TEST_P(RendererPixelTest, FastPassColorFilterAlphaTranslation) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha_translate.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(false)));
|
||||
cc::FuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, EnlargedRenderPassTexture) {
|
||||
@ -2457,7 +2461,7 @@ TEST_P(RendererPixelTest, EnlargedRenderPassTexture) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, EnlargedRenderPassTextureWithAntiAliasing) {
|
||||
@ -2512,7 +2516,11 @@ TEST_P(RendererPixelTest, EnlargedRenderPassTextureWithAntiAliasing) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("blue_yellow_anti_aliasing.png")),
|
||||
cc::FuzzyPixelComparator(true, 100.f, 0.f, 5.f, 7, 0)));
|
||||
cc::FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(100.f)
|
||||
.SetAvgAbsErrorLimit(5.f)
|
||||
.SetAbsErrorLimit(7)));
|
||||
}
|
||||
|
||||
// This tests the case where we have a RenderPass with a mask, but the quad
|
||||
@ -2609,7 +2617,7 @@ TEST_P(RendererPixelTest, RenderPassAndMaskWithPartialQuad) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("mask_bottom_right.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
// This tests the case where we have a RenderPass with a mask, but the quad
|
||||
@ -2706,7 +2714,7 @@ TEST_P(RendererPixelTest, RenderPassAndMaskWithPartialQuad2) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("mask_middle.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, RenderPassAndMaskForRoundedCorner) {
|
||||
@ -2795,7 +2803,8 @@ TEST_P(RendererPixelTest, RenderPassAndMaskForRoundedCorner) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("rounded_corner_simple.png")),
|
||||
cc::FuzzyPixelComparator(true, 0.6f, 0.f, 255.f, 255, 0)));
|
||||
cc::FuzzyPixelComparator().DiscardAlpha().SetErrorPixelsPercentageLimit(
|
||||
0.6f)));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, RenderPassAndMaskForRoundedCornerMultiRadii) {
|
||||
@ -2896,7 +2905,8 @@ TEST_P(RendererPixelTest, RenderPassAndMaskForRoundedCornerMultiRadii) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("rounded_corner_multi_radii.png")),
|
||||
cc::FuzzyPixelComparator(true, 0.6f, 0.f, 255.f, 255, 0)));
|
||||
cc::FuzzyPixelComparator().DiscardAlpha().SetErrorPixelsPercentageLimit(
|
||||
0.6f)));
|
||||
}
|
||||
|
||||
class RendererPixelTestWithBackdropFilter : public VizPixelTestWithParam {
|
||||
@ -3075,7 +3085,7 @@ TEST_P(RendererPixelTestWithBackdropFilter, InvertFilter) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&this->pass_list_,
|
||||
base::FilePath(FILE_PATH_LITERAL("backdrop_filter.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTestWithBackdropFilter, InvertFilterWithMask) {
|
||||
@ -3093,7 +3103,7 @@ TEST_P(RendererPixelTestWithBackdropFilter, InvertFilterWithMask) {
|
||||
: FILE_PATH_LITERAL("backdrop_filter_masked.png"));
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(&this->pass_list_, expected_path,
|
||||
cc::FuzzyPixelOffByOneComparator(false)));
|
||||
cc::FuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
// Software renderer does not support anti-aliased edges.
|
||||
@ -3135,7 +3145,7 @@ TEST_P(GPURendererPixelTest, AntiAliasing) {
|
||||
this->RunPixelTest(&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("anti_aliasing_.png"))
|
||||
.InsertBeforeExtensionASCII(this->renderer_str()),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
// Software renderer does not support anti-aliased edges.
|
||||
@ -3173,7 +3183,7 @@ TEST_P(GPURendererPixelTest, AntiAliasingPerspective) {
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("anti_aliasing_perspective_.png"))
|
||||
.InsertBeforeExtensionASCII(this->renderer_str()),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
// This test tests that anti-aliasing works for axis aligned quads.
|
||||
@ -3201,7 +3211,7 @@ TEST_P(GPURendererPixelTest, AxisAligned) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("axis_aligned.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
// This test tests that forcing anti-aliasing off works as expected for
|
||||
@ -3240,7 +3250,7 @@ TEST_P(GPURendererPixelTest, SolidColorDrawQuadForceAntiAliasingOff) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("force_anti_aliasing_off.png")),
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
// This test tests that forcing anti-aliasing off works as expected for
|
||||
@ -3299,7 +3309,7 @@ TEST_P(GPURendererPixelTest, RenderPassDrawQuadForceAntiAliasingOff) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("force_anti_aliasing_off.png")),
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
// This test tests that forcing anti-aliasing off works as expected for
|
||||
@ -3367,7 +3377,7 @@ TEST_P(GPURendererPixelTest, TileDrawQuadForceAntiAliasingOff) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("force_anti_aliasing_off.png")),
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
// This test tests that forcing anti-aliasing off works as expected while
|
||||
@ -3397,7 +3407,7 @@ TEST_P(GPURendererPixelTest, BlendingWithoutAntiAliasing) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("translucent_quads_no_aa.png")),
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
TEST_P(GPURendererPixelTest, TrilinearFiltering) {
|
||||
@ -3456,12 +3466,12 @@ TEST_P(GPURendererPixelTest, TrilinearFiltering) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("trilinear_filtering_skia_vk.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
} else {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("trilinear_filtering.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3542,7 +3552,7 @@ TEST_F(SoftwareRendererPixelTest, PictureDrawQuadIdentityScale) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
// Not WithSkiaGPUBackend since that path currently requires tiles for opacity.
|
||||
@ -3602,7 +3612,7 @@ TEST_F(SoftwareRendererPixelTest, PictureDrawQuadOpacity) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("green_alpha.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_F(SoftwareRendererPixelTest, PictureDrawQuadOpacityWithAlpha) {
|
||||
@ -3659,9 +3669,9 @@ TEST_F(SoftwareRendererPixelTest, PictureDrawQuadOpacityWithAlpha) {
|
||||
AggregatedRenderPassList pass_list;
|
||||
pass_list.push_back(std::move(pass));
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("white.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("white.png")),
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
void draw_point_color(SkCanvas* canvas,
|
||||
@ -3721,7 +3731,7 @@ TEST_F(SoftwareRendererPixelTest, PictureDrawQuadDisableImageFiltering) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
// This disables filtering by setting |nearest_neighbor| on the
|
||||
@ -3770,7 +3780,7 @@ TEST_F(SoftwareRendererPixelTest, PictureDrawQuadNearestNeighbor) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
// This disables filtering by setting |nearest_neighbor| on the
|
||||
@ -3832,7 +3842,7 @@ TEST_P(RendererPixelTest, TileDrawQuadNearestNeighbor) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
// This disables filtering by setting |nearest_neighbor| to true on the
|
||||
@ -3884,7 +3894,7 @@ TEST_F(SoftwareRendererPixelTest, TextureDrawQuadNearestNeighbor) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
|
||||
cc::FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f)));
|
||||
cc::FuzzyPixelComparator().SetErrorPixelsPercentageLimit(2.f)));
|
||||
}
|
||||
|
||||
// This ensures filtering is enabled by setting |nearest_neighbor| to false on
|
||||
@ -3941,7 +3951,9 @@ TEST_F(SoftwareRendererPixelTest, TextureDrawQuadLinear) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers_linear.png")),
|
||||
cc::FuzzyPixelComparator(false, 100.f, 0.f, 16.f, 16.f, 0.f)));
|
||||
cc::FuzzyPixelComparator()
|
||||
.SetErrorPixelsPercentageLimit(100.f)
|
||||
.SetAbsErrorLimit(16)));
|
||||
}
|
||||
|
||||
TEST_F(SoftwareRendererPixelTest, PictureDrawQuadNonIdentityScale) {
|
||||
@ -4076,7 +4088,7 @@ TEST_F(SoftwareRendererPixelTest, PictureDrawQuadNonIdentityScale) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
class RendererPixelTestWithFlippedOutputSurface : public VizPixelTestWithParam {
|
||||
@ -4138,7 +4150,7 @@ TEST_P(RendererPixelTestWithFlippedOutputSurface, ExplicitFlipTest) {
|
||||
// right-side up result regardless (i.e., NOT blue_yellow_flipped.png).
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTestWithFlippedOutputSurface, CheckChildPassUnflipped) {
|
||||
@ -4183,7 +4195,7 @@ TEST_P(RendererPixelTestWithFlippedOutputSurface, CheckChildPassUnflipped) {
|
||||
EXPECT_TRUE(this->RunPixelTestWithReadbackTarget(
|
||||
&pass_list, pass_list.front().get(),
|
||||
base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
TEST_P(GPURendererPixelTest, CheckReadbackSubset) {
|
||||
@ -4232,7 +4244,7 @@ TEST_P(GPURendererPixelTest, CheckReadbackSubset) {
|
||||
EXPECT_TRUE(this->RunPixelTestWithReadbackTargetAndArea(
|
||||
&pass_list, pass_list.front().get(),
|
||||
base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")),
|
||||
cc::ExactPixelComparator(true), &capture_rect));
|
||||
cc::AlphaDiscardingExactPixelComparator(), &capture_rect));
|
||||
}
|
||||
|
||||
TEST_P(GPURendererPixelTest, TextureQuadBatching) {
|
||||
@ -4317,7 +4329,7 @@ TEST_P(GPURendererPixelTest, TextureQuadBatching) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, base::FilePath(FILE_PATH_LITERAL("spiral.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(GPURendererPixelTest, TileQuadClamping) {
|
||||
@ -4390,7 +4402,7 @@ TEST_P(GPURendererPixelTest, TileQuadClamping) {
|
||||
|
||||
EXPECT_TRUE(this->RunPixelTest(&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, RoundedCornerSimpleSolidDrawQuad) {
|
||||
@ -4429,7 +4441,8 @@ TEST_P(RendererPixelTest, RoundedCornerSimpleSolidDrawQuad) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("rounded_corner_simple.png")),
|
||||
cc::FuzzyPixelComparator(true, 0.55f, 0.f, 255.f, 255, 0)));
|
||||
cc::FuzzyPixelComparator().DiscardAlpha().SetErrorPixelsPercentageLimit(
|
||||
0.55f)));
|
||||
}
|
||||
|
||||
TEST_P(GPURendererPixelTest, RoundedCornerSimpleTextureDrawQuad) {
|
||||
@ -4488,7 +4501,8 @@ TEST_P(GPURendererPixelTest, RoundedCornerSimpleTextureDrawQuad) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("rounded_corner_simple.png")),
|
||||
cc::FuzzyPixelComparator(true, 0.6f, 0.f, 255.f, 255, 0)));
|
||||
cc::FuzzyPixelComparator().DiscardAlpha().SetErrorPixelsPercentageLimit(
|
||||
0.6f)));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, RoundedCornerOnRenderPass) {
|
||||
@ -4548,8 +4562,8 @@ TEST_P(RendererPixelTest, RoundedCornerOnRenderPass) {
|
||||
|
||||
base::FilePath path(FILE_PATH_LITERAL("rounded_corner_render_pass_.png"));
|
||||
path = path.InsertBeforeExtensionASCII(this->renderer_str());
|
||||
EXPECT_TRUE(this->RunPixelTest(&pass_list, path,
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list, path, cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
TEST_P(GPURendererPixelTest, LinearGradientOnRenderPass) {
|
||||
@ -4593,12 +4607,8 @@ TEST_P(GPURendererPixelTest, LinearGradientOnRenderPass) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("linear_gradient_render_pass.png")),
|
||||
cc::FuzzyPixelComparator(/*discard_alpha=*/true,
|
||||
/*error_pixels_percentage_limit=*/0.6f,
|
||||
/*small_error_pixels_percentage_limit=*/0.f,
|
||||
/*avg_abs_error_limit=*/255.f,
|
||||
/*max_abs_error_limit=*/255,
|
||||
/*small_error_threshold=*/0)));
|
||||
cc::FuzzyPixelComparator().DiscardAlpha().SetErrorPixelsPercentageLimit(
|
||||
0.6f)));
|
||||
}
|
||||
|
||||
TEST_P(GPURendererPixelTest, MultiLinearGradientOnRenderPass) {
|
||||
@ -4663,12 +4673,8 @@ TEST_P(GPURendererPixelTest, MultiLinearGradientOnRenderPass) {
|
||||
&pass_list,
|
||||
base::FilePath(
|
||||
FILE_PATH_LITERAL("multi_linear_gradient_render_pass.png")),
|
||||
cc::FuzzyPixelComparator(/*discard_alpha=*/true,
|
||||
/*error_pixels_percentage_limit=*/0.6f,
|
||||
/*small_error_pixels_percentage_limit=*/0.f,
|
||||
/*avg_abs_error_limit=*/255.f,
|
||||
/*max_abs_error_limit=*/255,
|
||||
/*small_error_threshold=*/0)));
|
||||
cc::FuzzyPixelComparator().DiscardAlpha().SetErrorPixelsPercentageLimit(
|
||||
0.6f)));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, RoundedCornerMultiRadii) {
|
||||
@ -4715,7 +4721,8 @@ TEST_P(RendererPixelTest, RoundedCornerMultiRadii) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("rounded_corner_multi_radii.png")),
|
||||
cc::FuzzyPixelComparator(true, 0.55f, 0.f, 255.f, 255, 0)));
|
||||
cc::FuzzyPixelComparator().DiscardAlpha().SetErrorPixelsPercentageLimit(
|
||||
0.55f)));
|
||||
}
|
||||
|
||||
TEST_P(RendererPixelTest, RoundedCornerMultipleQads) {
|
||||
@ -4792,7 +4799,9 @@ TEST_P(RendererPixelTest, RoundedCornerMultipleQads) {
|
||||
AggregatedRenderPassList pass_list;
|
||||
pass_list.push_back(std::move(root_pass));
|
||||
|
||||
cc::FuzzyPixelComparator comparator(true, 0.55f, 0.f, 255.f, 255, 0);
|
||||
auto comparator =
|
||||
cc::FuzzyPixelComparator().DiscardAlpha().SetErrorPixelsPercentageLimit(
|
||||
0.55f);
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("rounded_corner_multi_quad.png")),
|
||||
@ -4834,7 +4843,7 @@ TEST_P(RendererPixelTestWithOverdrawFeedback, TranslucentRectangles) {
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
&pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("translucent_rectangles.png")),
|
||||
cc::FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f)));
|
||||
cc::FuzzyPixelComparator().SetErrorPixelsPercentageLimit(2.f)));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(,
|
||||
@ -4990,8 +4999,10 @@ class ColorTransformPixelTest
|
||||
}
|
||||
#endif
|
||||
|
||||
cc::FuzzyPixelComparator comparator(false, 100.f, 0.f, avg_abs_error_limit,
|
||||
max_abs_error_limit, 0);
|
||||
auto comparator = cc::FuzzyPixelComparator()
|
||||
.SetErrorPixelsPercentageLimit(100.f)
|
||||
.SetAvgAbsErrorLimit(avg_abs_error_limit)
|
||||
.SetAbsErrorLimit(max_abs_error_limit);
|
||||
EXPECT_TRUE(
|
||||
this->RunPixelTest(&pass_list, &expected_output_colors, comparator))
|
||||
<< " src:" << src_color_space_ << ", dst:" << dst_color_space_;
|
||||
@ -5110,8 +5121,9 @@ class DelegatedInkTest : public VizPixelTestWithParam,
|
||||
AggregatedRenderPassList pass_list;
|
||||
pass_list.push_back(std::move(pass));
|
||||
|
||||
return this->RunPixelTest(&pass_list, base::FilePath(file),
|
||||
cc::FuzzyPixelOffByOneComparator(true));
|
||||
return this->RunPixelTest(
|
||||
&pass_list, base::FilePath(file),
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator());
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -5307,7 +5319,7 @@ TEST_P(DelegatedInkWithPredictionTest, DelegatedInkTrailAfterBatchedQuads) {
|
||||
&pass_list,
|
||||
base::FilePath(
|
||||
FILE_PATH_LITERAL("delegated_ink_trail_on_batched_quads.png")),
|
||||
cc::FuzzyPixelOffByOneComparator(true)));
|
||||
cc::AlphaDiscardingFuzzyPixelOffByOneComparator()));
|
||||
}
|
||||
|
||||
// Confirm that delegated ink trails are not drawn on non-root render passes.
|
||||
@ -5354,7 +5366,7 @@ TEST_P(DelegatedInkWithPredictionTest, SimpleTrailNonRootRenderPass) {
|
||||
EXPECT_TRUE(this->RunPixelTestWithReadbackTarget(
|
||||
&pass_list, child_pass_ptr,
|
||||
base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
cc::ExactPixelComparator(true)));
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
// Draw two different trails that are made up of sets of DelegatedInkPoints with
|
||||
|
@ -50,8 +50,10 @@ constexpr float kAvgAbsoluteErrorLimit = 8.f;
|
||||
constexpr int kMaxAbsoluteErrorLimit = 32;
|
||||
|
||||
cc::FuzzyPixelComparator GetDefaultFuzzyPixelComparator() {
|
||||
return cc::FuzzyPixelComparator(false, 100.f, 0.f, kAvgAbsoluteErrorLimit,
|
||||
kMaxAbsoluteErrorLimit, 0);
|
||||
return cc::FuzzyPixelComparator()
|
||||
.SetErrorPixelsPercentageLimit(100.f)
|
||||
.SetAvgAbsErrorLimit(kAvgAbsoluteErrorLimit)
|
||||
.SetAbsErrorLimit(kMaxAbsoluteErrorLimit);
|
||||
}
|
||||
|
||||
base::FilePath GetTestFilePath(const base::FilePath::CharType* basename) {
|
||||
@ -439,8 +441,7 @@ TEST_P(SkiaReadbackPixelTestRGBA, ExecutesCopyRequest) {
|
||||
EXPECT_TRUE(cc::WritePNGFile(actual, expected_path, false));
|
||||
}
|
||||
|
||||
if (!cc::MatchesPNGFile(actual, expected_path,
|
||||
cc::ExactPixelComparator(false))) {
|
||||
if (!cc::MatchesPNGFile(actual, expected_path, cc::ExactPixelComparator())) {
|
||||
LOG(ERROR) << "Entire source: " << cc::GetPNGDataUrl(GetSourceBitmap());
|
||||
ADD_FAILURE();
|
||||
}
|
||||
|
@ -114,8 +114,7 @@ TEST_P(SurfaceAggregatorPixelTest, DrawSimpleFrame) {
|
||||
auto aggregated_frame = aggregator.Aggregate(
|
||||
root_surface_id, this->GetNextDisplayTime(), gfx::OVERLAY_TRANSFORM_NONE);
|
||||
|
||||
bool discard_alpha = false;
|
||||
cc::ExactPixelComparator pixel_comparator(discard_alpha);
|
||||
cc::ExactPixelComparator pixel_comparator;
|
||||
auto* pass_list = &aggregated_frame.render_pass_list;
|
||||
EXPECT_TRUE(this->RunPixelTest(pass_list,
|
||||
base::FilePath(FILE_PATH_LITERAL("green.png")),
|
||||
@ -193,8 +192,7 @@ TEST_P(SurfaceAggregatorPixelTest, DrawSimpleAggregatedFrame) {
|
||||
auto aggregated_frame = aggregator.Aggregate(
|
||||
root_surface_id, this->GetNextDisplayTime(), gfx::OVERLAY_TRANSFORM_NONE);
|
||||
|
||||
bool discard_alpha = false;
|
||||
cc::ExactPixelComparator pixel_comparator(discard_alpha);
|
||||
cc::ExactPixelComparator pixel_comparator;
|
||||
auto* pass_list = &aggregated_frame.render_pass_list;
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
pass_list, base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
|
||||
@ -327,8 +325,7 @@ TEST_P(SurfaceAggregatorPixelTest, DrawAggregatedFrameWithSurfaceTransforms) {
|
||||
auto aggregated_frame = aggregator.Aggregate(
|
||||
root_surface_id, this->GetNextDisplayTime(), gfx::OVERLAY_TRANSFORM_NONE);
|
||||
|
||||
bool discard_alpha = false;
|
||||
cc::ExactPixelComparator pixel_comparator(discard_alpha);
|
||||
cc::ExactPixelComparator pixel_comparator;
|
||||
auto* pass_list = &aggregated_frame.render_pass_list;
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
pass_list,
|
||||
@ -380,8 +377,7 @@ TEST_P(SurfaceAggregatorPixelTest, DrawAndEraseDelegatedInkTrail) {
|
||||
auto aggregated_frame = aggregator.Aggregate(
|
||||
root_surface_id, this->GetNextDisplayTime(), gfx::OVERLAY_TRANSFORM_NONE);
|
||||
|
||||
bool discard_alpha = false;
|
||||
cc::FuzzyPixelOffByOneComparator pixel_comparator(discard_alpha);
|
||||
cc::FuzzyPixelOffByOneComparator pixel_comparator;
|
||||
auto* pass_list = &aggregated_frame.render_pass_list;
|
||||
EXPECT_TRUE(this->RunPixelTest(
|
||||
pass_list, base::FilePath(FILE_PATH_LITERAL("delegated_ink_trail.png")),
|
||||
|
@ -133,8 +133,8 @@ void SkiaOutputSurfaceImplTest::CopyRequestCallbackOnGpuThread(
|
||||
output_rect.width(), output_rect.height(), color_space.ToSkColorSpace()));
|
||||
expected.eraseColor(kOutputColor, /*colorSpace=*/nullptr);
|
||||
|
||||
EXPECT_TRUE(cc::MatchesBitmap(result_bitmap, expected,
|
||||
cc::ExactPixelComparator(false)));
|
||||
EXPECT_TRUE(
|
||||
cc::MatchesBitmap(result_bitmap, expected, cc::ExactPixelComparator()));
|
||||
|
||||
UnblockMainThread();
|
||||
}
|
||||
|
@ -448,9 +448,10 @@ class VideoCaptureOverlayRenderTest
|
||||
// (16/255 for YUV tests). The YUV tests allow for more error due to the
|
||||
// expected errors introduced by both color space (dynamic range) and format
|
||||
// (chroma subsampling) conversion.
|
||||
cc::FuzzyPixelComparator comparator(false, 100.0f, 0.0f,
|
||||
is_argb_test() ? 1.0f : 16.0f,
|
||||
is_argb_test() ? 1 : 64, 0);
|
||||
auto comparator = cc::FuzzyPixelComparator()
|
||||
.SetErrorPixelsPercentageLimit(100.0f)
|
||||
.SetAvgAbsErrorLimit(is_argb_test() ? 1.0f : 16.0f)
|
||||
.SetAbsErrorLimit(is_argb_test() ? 1 : 64);
|
||||
const bool matches_golden_file =
|
||||
cc::MatchesPNGFile(canonical_bitmap, golden_file_path, comparator);
|
||||
// If MatchesPNGFile() returned false, it will have LOG(ERROR)'ed the
|
||||
|
@ -101,30 +101,26 @@ class FormControlsBrowserTest : public ContentBrowserTest {
|
||||
// This fuzzy pixel comparator handles several mac behaviors:
|
||||
// - Different font rendering after 10.14
|
||||
// - Slight differences in radio and checkbox rendering in 10.15
|
||||
// - Tiny errors (difference <= 1) are ignored for more pixels
|
||||
cc::FuzzyPixelComparator comparator(
|
||||
/* discard_alpha */ true,
|
||||
/* error_pixels_percentage_limit */ 26.f,
|
||||
/* small_error_pixels_percentage_limit */ 0.f,
|
||||
/* avg_abs_error_limit */ 20.f,
|
||||
/* max_abs_error_limit */ 120.f,
|
||||
/* small_error_threshold */ 0);
|
||||
// TODO(wangxianzhu): Tighten these parameters.
|
||||
auto comparator = cc::FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(26.f)
|
||||
.SetAvgAbsErrorLimit(20.f)
|
||||
.SetAbsErrorLimit(120);
|
||||
#elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN) || (OS_LINUX) || \
|
||||
BUILDFLAG(IS_FUCHSIA)
|
||||
// Different versions of android may have slight differences in rendering.
|
||||
// Some versions have more significant differences than others, which are
|
||||
// tracked separately in separate baseline image files. The less significant
|
||||
// differences are accommodated for with this fuzzy pixel comparator.
|
||||
// This also applies to different versions of Windows.
|
||||
cc::FuzzyPixelComparator comparator(
|
||||
/* discard_alpha */ true,
|
||||
/* error_pixels_percentage_limit */ 11.f,
|
||||
/* small_error_pixels_percentage_limit */ 0.f,
|
||||
/* avg_abs_error_limit */ 5.f,
|
||||
/* max_abs_error_limit */ 140.f,
|
||||
/* small_error_threshold */ 0);
|
||||
// This also applies to different versions of other OSes.
|
||||
auto comparator = cc::FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(11.f)
|
||||
.SetAvgAbsErrorLimit(5.f)
|
||||
.SetAbsErrorLimit(140);
|
||||
#else
|
||||
cc::ExactPixelComparator comparator(/* disard_alpha */ true);
|
||||
cc::AlphaDiscardingExactPixelComparator comparator;
|
||||
#endif
|
||||
EXPECT_TRUE(CompareWebContentsOutputToReference(
|
||||
shell()->web_contents(), golden_filepath,
|
||||
|
@ -192,9 +192,8 @@ TEST(RepackUtilsTest, UnpackStride) {
|
||||
// Result bitmap should have red pixels after.
|
||||
UnpackPixelDataWithStride(size, repacked_data, expected_stride, pixmap);
|
||||
|
||||
EXPECT_TRUE(
|
||||
cc::MatchesBitmap(result_bitmap, source_bitmap,
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)));
|
||||
EXPECT_TRUE(cc::MatchesBitmap(result_bitmap, source_bitmap,
|
||||
cc::ExactPixelComparator()));
|
||||
}
|
||||
|
||||
TEST(RepackUtilsTest, SwizzleRedAndBlue) {
|
||||
@ -210,9 +209,8 @@ TEST(RepackUtilsTest, SwizzleRedAndBlue) {
|
||||
SkBitmap expected_bitmap =
|
||||
MakeSolidColorBitmap(size, kRGBA_8888_SkColorType, SK_ColorBLUE);
|
||||
|
||||
EXPECT_TRUE(
|
||||
cc::MatchesBitmap(swizzled_bitmap, expected_bitmap,
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)));
|
||||
EXPECT_TRUE(cc::MatchesBitmap(swizzled_bitmap, expected_bitmap,
|
||||
cc::ExactPixelComparator()));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -638,8 +638,8 @@ TEST_P(GLTextureImageBackingFactoryWithReadbackTest, ReadbackToMemory) {
|
||||
SkPixmap result_pixmap;
|
||||
ASSERT_TRUE(result_bitmap.peekPixels(&result_pixmap));
|
||||
ASSERT_TRUE(backing->ReadbackToMemory(result_pixmap));
|
||||
EXPECT_TRUE(cc::MatchesBitmap(result_bitmap, bitmap,
|
||||
cc::ExactPixelComparator(false)));
|
||||
EXPECT_TRUE(
|
||||
cc::MatchesBitmap(result_bitmap, bitmap, cc::ExactPixelComparator()));
|
||||
}
|
||||
|
||||
{
|
||||
@ -650,8 +650,8 @@ TEST_P(GLTextureImageBackingFactoryWithReadbackTest, ReadbackToMemory) {
|
||||
SkPixmap result_pixmap;
|
||||
ASSERT_TRUE(result_bitmap.peekPixels(&result_pixmap));
|
||||
ASSERT_TRUE(backing->ReadbackToMemory(result_pixmap));
|
||||
EXPECT_TRUE(cc::MatchesBitmap(result_bitmap, bitmap,
|
||||
cc::ExactPixelComparator(false)));
|
||||
EXPECT_TRUE(
|
||||
cc::MatchesBitmap(result_bitmap, bitmap, cc::ExactPixelComparator()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -620,9 +620,8 @@ class HeadlessWebContentsBeginFrameControlViewportTest
|
||||
SkImageInfo::MakeN32(300, 300, kOpaque_SkAlphaType), /*rowBytes=*/0);
|
||||
expected_bitmap.eraseColor(SkColorSetRGB(0x00, 0x00, 0xff));
|
||||
|
||||
EXPECT_TRUE(
|
||||
cc::MatchesBitmap(result_bitmap, expected_bitmap,
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)));
|
||||
EXPECT_TRUE(cc::MatchesBitmap(result_bitmap, expected_bitmap,
|
||||
cc::ExactPixelComparator()));
|
||||
|
||||
// Post completion to avoid deleting the WebContents on the same callstack
|
||||
// as frame finished callback.
|
||||
|
@ -123,9 +123,8 @@ class PaintManagerTest : public testing::Test {
|
||||
ASSERT_TRUE(expected_surface->makeImageSnapshot()->asLegacyBitmap(
|
||||
&expected_bitmap));
|
||||
|
||||
EXPECT_TRUE(
|
||||
cc::MatchesBitmap(snapshot_bitmap, expected_bitmap,
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)));
|
||||
EXPECT_TRUE(cc::MatchesBitmap(snapshot_bitmap, expected_bitmap,
|
||||
cc::ExactPixelComparator()));
|
||||
}
|
||||
|
||||
void TestScroll(const gfx::Vector2d& scroll_amount,
|
||||
|
@ -498,9 +498,8 @@ class PdfViewWebPluginTest : public PdfViewWebPluginWithoutInitializeTest {
|
||||
// color.
|
||||
SkBitmap expected_bitmap = GenerateExpectedBitmapForPaint(
|
||||
expected_clipped_rect, plugin_->GetBackgroundColor());
|
||||
EXPECT_TRUE(
|
||||
cc::MatchesBitmap(canvas_.GetBitmap(), expected_bitmap,
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)))
|
||||
EXPECT_TRUE(cc::MatchesBitmap(canvas_.GetBitmap(), expected_bitmap,
|
||||
cc::ExactPixelComparator()))
|
||||
<< "Failure at device scale of " << device_scale << ", window rect of "
|
||||
<< window_rect.ToString();
|
||||
}
|
||||
@ -520,9 +519,8 @@ class PdfViewWebPluginTest : public PdfViewWebPluginWithoutInitializeTest {
|
||||
// Expect the clipped area on canvas to be filled with `kPaintColor`.
|
||||
SkBitmap expected_bitmap =
|
||||
GenerateExpectedBitmapForPaint(expected_clipped_rect, kPaintColor);
|
||||
EXPECT_TRUE(
|
||||
cc::MatchesBitmap(canvas_.GetBitmap(), expected_bitmap,
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false)))
|
||||
EXPECT_TRUE(cc::MatchesBitmap(canvas_.GetBitmap(), expected_bitmap,
|
||||
cc::ExactPixelComparator()))
|
||||
<< "Failure at device scale of " << device_scale << ", window rect of "
|
||||
<< window_rect.ToString();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ testing::AssertionResult MatchesPngFile(
|
||||
return testing::AssertionFailure() << "Reference: " << expected_png_file;
|
||||
|
||||
if (!cc::MatchesPNGFile(actual_bitmap, GetTestDataFilePath(expected_png_file),
|
||||
cc::ExactPixelComparator(/*discard_alpha=*/false))) {
|
||||
cc::ExactPixelComparator())) {
|
||||
return testing::AssertionFailure() << "Reference: " << expected_png_file;
|
||||
}
|
||||
|
||||
|
@ -1768,7 +1768,7 @@ TEST_F(LayerWithRealCompositorTest, DrawAlphaBlendedPixels) {
|
||||
original_bitmap.allocPixels(bitmap.info());
|
||||
original_bitmap.eraseColor(blend_color);
|
||||
|
||||
cc::FuzzyPixelOffByOneComparator comparator(false);
|
||||
cc::FuzzyPixelOffByOneComparator comparator;
|
||||
EXPECT_TRUE(comparator.Compare(bitmap, original_bitmap));
|
||||
}
|
||||
|
||||
@ -1948,42 +1948,48 @@ TEST_F(LayerWithRealCompositorTest, ModifyHierarchy) {
|
||||
ReadPixels(&bitmap);
|
||||
ASSERT_FALSE(bitmap.empty());
|
||||
// WritePNGFile(bitmap, ref_img1);
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img1, cc::ExactPixelComparator(true)));
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img1,
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
|
||||
l0->StackAtTop(l11.get());
|
||||
DrawTree(l0.get());
|
||||
ReadPixels(&bitmap);
|
||||
ASSERT_FALSE(bitmap.empty());
|
||||
// WritePNGFile(bitmap, ref_img2);
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img2, cc::ExactPixelComparator(true)));
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img2,
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
|
||||
// should restore to original configuration
|
||||
l0->StackAbove(l12.get(), l11.get());
|
||||
DrawTree(l0.get());
|
||||
ReadPixels(&bitmap);
|
||||
ASSERT_FALSE(bitmap.empty());
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img1, cc::ExactPixelComparator(true)));
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img1,
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
|
||||
// l11 back to front
|
||||
l0->StackAtTop(l11.get());
|
||||
DrawTree(l0.get());
|
||||
ReadPixels(&bitmap);
|
||||
ASSERT_FALSE(bitmap.empty());
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img2, cc::ExactPixelComparator(true)));
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img2,
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
|
||||
// should restore to original configuration
|
||||
l0->StackAbove(l12.get(), l11.get());
|
||||
DrawTree(l0.get());
|
||||
ReadPixels(&bitmap);
|
||||
ASSERT_FALSE(bitmap.empty());
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img1, cc::ExactPixelComparator(true)));
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img1,
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
|
||||
// l11 back to front
|
||||
l0->StackAbove(l11.get(), l12.get());
|
||||
DrawTree(l0.get());
|
||||
ReadPixels(&bitmap);
|
||||
ASSERT_FALSE(bitmap.empty());
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img2, cc::ExactPixelComparator(true)));
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img2,
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
// Checks that basic background blur is working.
|
||||
@ -2015,7 +2021,10 @@ TEST_F(LayerWithRealCompositorTest, BackgroundBlur) {
|
||||
SkBitmap bitmap;
|
||||
|
||||
// 25% of image can have up to a difference of 3.
|
||||
cc::FuzzyPixelComparator fuzzy_comparator(true, 25.f, 0.0f, 3.f, 3, 0);
|
||||
auto fuzzy_comparator = cc::FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(25.f)
|
||||
.SetAbsErrorLimit(3);
|
||||
|
||||
l0->Add(l1.get());
|
||||
l0->Add(l2.get());
|
||||
@ -2059,7 +2068,10 @@ TEST_F(LayerWithRealCompositorTest, BackgroundBlurChangeDeviceScale) {
|
||||
SkBitmap bitmap;
|
||||
|
||||
// 25% of image can have up to a difference of 3.
|
||||
cc::FuzzyPixelComparator fuzzy_comparator(true, 25.f, 0.0f, 3.f, 3, 0);
|
||||
auto fuzzy_comparator = cc::FuzzyPixelComparator()
|
||||
.DiscardAlpha()
|
||||
.SetErrorPixelsPercentageLimit(25.f)
|
||||
.SetAbsErrorLimit(3);
|
||||
|
||||
l0->Add(l1.get());
|
||||
l0->Add(l2.get());
|
||||
@ -2105,7 +2117,8 @@ TEST_F(LayerWithRealCompositorTest, Opacity) {
|
||||
ReadPixels(&bitmap);
|
||||
ASSERT_FALSE(bitmap.empty());
|
||||
// WritePNGFile(bitmap, ref_img);
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img, cc::ExactPixelComparator(true)));
|
||||
EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img,
|
||||
cc::AlphaDiscardingExactPixelComparator()));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
Reference in New Issue
Block a user