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

Unified Diff: ash/wm/ash_native_cursor_manager_unittest.cc

Issue 280133002: Do not scale cursor image for 2x image (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | ui/aura/test/aura_test_helper.cc » ('j') | ui/base/x/x11_util.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/ash_native_cursor_manager_unittest.cc
diff --git a/ash/wm/ash_native_cursor_manager_unittest.cc b/ash/wm/ash_native_cursor_manager_unittest.cc
index e31d81437759b3967c2c57106f9dde4663c2ec83..ba7de8a5d1c16026c370c87ba0c15858c2972ecb 100644
--- a/ash/wm/ash_native_cursor_manager_unittest.cc
+++ b/ash/wm/ash_native_cursor_manager_unittest.cc
@@ -22,6 +22,11 @@
#include "ui/base/cursor/cursor_loader_win.h"
#endif
+#if defined(USE_X11)
+#include "grit/ui_resources.h"
+#include "ui/base/cursor/cursor_loader_x11.h"
+#endif
+
namespace ash {
namespace test {
@@ -175,5 +180,28 @@ TEST_F(AshNativeCursorManagerTest, UIScaleShouldNotChangeCursor) {
EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor());
}
+#if defined(USE_X11)
+// This test is in ash_unittests becuase ui_unittests does not include
+// 2x assets. crbug.com/372541.
+TEST_F(AshNativeCursorManagerTest, CursorLoaderX11Test) {
+ const int kCursorId = 1;
+ ui::CursorLoaderX11 loader;
+ loader.set_scale(1.0f);
+
+ loader.LoadImageCursor(kCursorId, IDR_AURA_CURSOR_MOVE, gfx::Point());
+ const XcursorImage* image = loader.GetXcursorImageForTest(kCursorId);
+ int height = image->height;
+ int width = image->width;
+ loader.UnloadAll();
+
+ // Load 2x cursor and make sure its size is 2x of the 1x cusor.
+ loader.set_scale(2.0f);
+ loader.LoadImageCursor(kCursorId, IDR_AURA_CURSOR_MOVE, gfx::Point());
+ image = loader.GetXcursorImageForTest(kCursorId);
+ EXPECT_EQ(height * 2, static_cast<int>(image->height));
+ EXPECT_EQ(width * 2, static_cast<int>(image->width));
+}
+#endif
+
} // namespace test
} // namespace ash
« no previous file with comments | « no previous file | ui/aura/test/aura_test_helper.cc » ('j') | ui/base/x/x11_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698