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"
16 TEST(CursorLoaderX11Test, ScaleAndRotate) {
18 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 5);
21 gfx::Point hotpoint(3,4);
23 ScaleAndRotateCursorBitmapAndHotpoint(1.0f,
24 gfx::Display::ROTATE_0,
27 EXPECT_EQ(10, bitmap.width());
28 EXPECT_EQ(5, bitmap.height());
29 EXPECT_EQ("3,4", hotpoint.ToString());
31 ScaleAndRotateCursorBitmapAndHotpoint(1.0f,
32 gfx::Display::ROTATE_90,
36 EXPECT_EQ(5, bitmap.width());
37 EXPECT_EQ(10, bitmap.height());
38 EXPECT_EQ("1,3", hotpoint.ToString());
40 ScaleAndRotateCursorBitmapAndHotpoint(2.0f,
41 gfx::Display::ROTATE_180,
44 EXPECT_EQ(10, bitmap.width());
45 EXPECT_EQ(20, bitmap.height());
46 EXPECT_EQ("8,14", hotpoint.ToString());
48 ScaleAndRotateCursorBitmapAndHotpoint(1.0f,
49 gfx::Display::ROTATE_270,
52 EXPECT_EQ(20, bitmap.width());
53 EXPECT_EQ(10, bitmap.height());
54 EXPECT_EQ("14,2", hotpoint.ToString());