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

Unified Diff: ui/base/cursor/cursor_loader_x11_unittest.cc

Issue 280133002: Do not scale cursor image for 2x image (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added test 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
Index: ui/base/cursor/cursor_loader_x11_unittest.cc
diff --git a/ui/base/cursor/cursor_loader_x11_unittest.cc b/ui/base/cursor/cursor_loader_x11_unittest.cc
index 9584cf12613ef5f1dc99ad12309f23ff3f0ee367..bf89cb780d279708a71cdcb48858a39b95aa07a7 100644
--- a/ui/base/cursor/cursor_loader_x11_unittest.cc
+++ b/ui/base/cursor/cursor_loader_x11_unittest.cc
@@ -8,13 +8,15 @@
#undef Bool
#include "base/logging.h"
+#include "grit/ui_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/cursor/cursor_util.h"
+#include "ui/gfx/geometry/point.h"
namespace ui {
-TEST(CursorLoaderX11Test, ScaleAndRotate) {
+TEST(CursorLoaderX11Test, ScaleAndRotateCursorBitmapAndHotpoint) {
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 5);
bitmap.allocPixels();
@@ -56,4 +58,27 @@ TEST(CursorLoaderX11Test, ScaleAndRotate) {
EXPECT_EQ("14,2", hotpoint.ToString());
}
+TEST(CursorLoaderX11Test, Scale) {
+ const int kCursorId = 1;
+ test::ResetXCursorCache();
+ CursorLoaderX11 loader;
+ loader.set_scale(1.0f);
+
+ loader.LoadImageCursor(kCursorId, IDR_AURA_CURSOR_MOVE, gfx::Point());
+ const XcursorImage* image =
+ test::GetCachedXcursorImage(loader.GetCursorForTest(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 = test::GetCachedXcursorImage(loader.GetCursorForTest(kCursorId));
+ EXPECT_EQ(height * 2, static_cast<int>(image->height));
+ EXPECT_EQ(width * 2, static_cast<int>(image->width));
+
+ test::ResetXCursorCache();
+}
+
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698