Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Unified Diff: content/common/cursors/webcursor_unittest.cc

Issue 1416023002: Fix custom cursor transparency compositing on MacOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix indent Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/cursors/webcursor_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/cursors/webcursor_unittest.cc
diff --git a/content/common/cursors/webcursor_unittest.cc b/content/common/cursors/webcursor_unittest.cc
index 0fd1a751273643fee10b727255d3181223df2bb6..25c236a459994d134a57bf138789b735838ac03b 100644
--- a/content/common/cursors/webcursor_unittest.cc
+++ b/content/common/cursors/webcursor_unittest.cc
@@ -222,7 +222,7 @@ TEST(WebCursorTest, AlphaConversion) {
cursor_info.image_scale_factor = 1;
WebCursor custom_cursor;
- // This round trip will convert the cursor to unpremultiplied form
+ // This round trip will convert the cursor to unpremultiplied form.
custom_cursor.InitFromCursorInfo(cursor_info);
custom_cursor.GetCursorInfo(&cursor_info);
{
@@ -232,8 +232,8 @@ TEST(WebCursorTest, AlphaConversion) {
SkPreMultiplyColor(*cursor_info.custom_image.getAddr32(0,0)));
}
- // Second round trip should not do any conversion because data is alread
- // unpremultiplied
+ // Second round trip should not do any conversion because data is already
+ // unpremultiplied.
custom_cursor.InitFromCursorInfo(cursor_info);
custom_cursor.GetCursorInfo(&cursor_info);
{
@@ -242,6 +242,19 @@ TEST(WebCursorTest, AlphaConversion) {
EXPECT_EQ(testColor,
SkPreMultiplyColor(*cursor_info.custom_image.getAddr32(0,0)));
}
+
+#if defined(OS_MACOSX)
+ // On MacOS, test roundtrip through NSCursor conversion.
+ WebCursor custom_cursor_copy;
+ custom_cursor_copy.InitFromNSCursor(custom_cursor.GetNativeCursor());
+ custom_cursor_copy.GetCursorInfo(&cursor_info);
+ {
+ SkAutoLockPixels lock(cursor_info.custom_image);
+ EXPECT_EQ(kUnpremul_SkAlphaType, cursor_info.custom_image.alphaType());
+ EXPECT_EQ(testColor,
+ SkPreMultiplyColor(*cursor_info.custom_image.getAddr32(0,0)));
+ }
+#endif
}
} // namespace content
« no previous file with comments | « content/common/cursors/webcursor_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698