Commit 65bc021c authored by Alexey Baskakov's avatar Alexey Baskakov Committed by Commit Bot

Reland "WebApp: Check pixel at the center of the generated icon."

This is a reland of 5a0adcbe

Let's exclude Win platform for now. This is a useful finding which
requires investigation.

Original change's description:
> WebApp: Check pixel at the center of the generated icon.
>
> We generate an icon placeholder using a letter with some solid
> background color.
>
> Let the test check if letter_color is actually presented in the icon.
>
> This is a follow up test enhancement for the previous CL:
> https://chromium-review.googlesource.com/c/chromium/src/+/1888234
>
> Bug: 1019102
> Change-Id: I10e196926dff78032dcd8f00e93e24715d1be913
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1891816
> Commit-Queue: Alexey Baskakov <loyso@chromium.org>
> Reviewed-by: Alan Cutter <alancutter@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#711143}

Bug: 1019102
Change-Id: I2d01c2a9f5eb94107a4dfc4fea041bdb18871fc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1892651
Commit-Queue: Alexey Baskakov <loyso@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711164}
parent 9a767fe1
......@@ -9,6 +9,7 @@
#include "base/stl_util.h"
#include "base/strings/string16.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "chrome/browser/web_applications/test/web_app_icon_test_utils.h"
#include "chrome/common/web_application_info.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -393,7 +394,21 @@ TEST_F(WebAppIconGeneratorTest, GenerateIcons) {
// We don't check corner colors here: the icon is rounded by border_radius.
EXPECT_EQ(bg_color, icon_info.data.getColor(border_radius * 2, center_y));
EXPECT_EQ(bg_color, icon_info.data.getColor(center_x, border_radius * 2));
// TODO(loyso): Peek a pixel at the center of icon and check the color.
// Only for large icons with a sharp letter: Peek a pixel at the center of
// icon.
//
// TODO(crbug.com/1019102): Investigate if Win7 x64 doesn't generate
// unicode characters in our GeneratedIconImageSource implementation.
#if !defined(OS_WIN)
const SkColor letter_color = color_utils::GetColorWithMaxContrast(bg_color);
if (icon_info.width >= icon_size::k256) {
SkColor center_color = icon_info.data.getColor(center_x, center_y);
SCOPED_TRACE(letter_color);
SCOPED_TRACE(center_color);
EXPECT_TRUE(AreColorsEqual(letter_color, center_color, /*threshold=*/50));
}
#endif // !defined(OS_WIN)
sizes.erase(icon_info.width);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment