Chromium Code Reviews| Index: content/common/cursors/webcursor_unittest.cc |
| diff --git a/content/common/cursors/webcursor_unittest.cc b/content/common/cursors/webcursor_unittest.cc |
| index 25c236a459994d134a57bf138789b735838ac03b..a68d9da1f8f35427977701e096632d856cb79a58 100644 |
| --- a/content/common/cursors/webcursor_unittest.cc |
| +++ b/content/common/cursors/webcursor_unittest.cc |
| @@ -2,6 +2,10 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#if defined(OS_WIN) |
| +#include <windows.h> |
| +#endif |
| + |
| #include "base/pickle.h" |
| #include "content/common/cursors/webcursor.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -257,4 +261,46 @@ TEST(WebCursorTest, AlphaConversion) { |
| #endif |
| } |
| +#if defined(USE_AURA) |
| +TEST(WebCursorTest, CursorScaleFactor) { |
| + gfx::Display display; |
| + display.set_device_scale_factor(80.2f); |
| + |
| + WebCursor::CursorInfo info; |
| + info.image_scale_factor = 2.0f; |
| + |
| + WebCursor cursor; |
| + cursor.InitFromCursorInfo(info); |
| + cursor.SetDisplayInfo(display); |
| + |
| + EXPECT_EQ(40.1f, cursor.GetCursorScaleFactor()); |
| +} |
| +#endif |
| + |
| +#if defined(OS_WIN) |
| +TEST(WebCursorTest, WindowsCursorScaledAtHiDpi) { |
| + gfx::Display display; |
| + display.set_device_scale_factor(2.0f); |
|
ananta
2015/12/15 23:28:17
It would be good to add more test cases like 1.25/
Bret
2015/12/16 19:03:59
Done.
|
| + |
| + WebCursor::CursorInfo info; |
| + info.type = WebCursorInfo::TypeCustom; |
| + info.hotspot = gfx::Point(4, 6); |
| + |
| + info.custom_image = SkBitmap(); |
| + info.custom_image.allocN32Pixels(10, 10); |
| + |
| + WebCursor cursor; |
| + cursor.SetDisplayInfo(display); |
| + cursor.InitFromCursorInfo(info); |
| + |
| + HCURSOR windowsCursorHandle = cursor.GetPlatformCursor(); |
| + EXPECT_NE(nullptr, windowsCursorHandle); |
| + ICONINFO windowsIconInfo; |
| + EXPECT_TRUE(GetIconInfo(windowsCursorHandle, &windowsIconInfo)); |
| + EXPECT_FALSE(windowsIconInfo.fIcon); |
| + EXPECT_EQ(8, windowsIconInfo.xHotspot); |
| + EXPECT_EQ(12, windowsIconInfo.yHotspot); |
| +} |
| +#endif |
| + |
| } // namespace content |