1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/base/cursor/cursor_loader_x11.h"
10 #include "base/logging.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "ui/base/cursor/cursor_util.h"
17 TEST(CursorLoaderX11Test, ScaleAndRotate) {
19 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 5);
21 bitmap.eraseColor(SK_ColorBLACK);
23 gfx::Point hotpoint(3,4);
25 ScaleAndRotateCursorBitmapAndHotpoint(1.0f,
26 gfx::Display::ROTATE_0,
29 EXPECT_EQ(10, bitmap.width());
30 EXPECT_EQ(5, bitmap.height());
31 EXPECT_EQ("3,4", hotpoint.ToString());
33 ScaleAndRotateCursorBitmapAndHotpoint(1.0f,
34 gfx::Display::ROTATE_90,
38 EXPECT_EQ(5, bitmap.width());
39 EXPECT_EQ(10, bitmap.height());
40 EXPECT_EQ("1,3", hotpoint.ToString());
42 ScaleAndRotateCursorBitmapAndHotpoint(2.0f,
43 gfx::Display::ROTATE_180,
46 EXPECT_EQ(10, bitmap.width());
47 EXPECT_EQ(20, bitmap.height());
48 EXPECT_EQ("8,14", hotpoint.ToString());
50 ScaleAndRotateCursorBitmapAndHotpoint(1.0f,
51 gfx::Display::ROTATE_270,
54 EXPECT_EQ(20, bitmap.width());
55 EXPECT_EQ(10, bitmap.height());
56 EXPECT_EQ("14,2", hotpoint.ToString());