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

Side by Side Diff: ash/wm/cursor_manager_unittest.cc

Issue 10965020: Fix cursor getting invisible after moving a window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/cursor_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 #include "ash/wm/cursor_manager.h"
6
7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h"
9 #include "ash/test/cursor_manager_test_api.h"
10 #include "ash/wm/image_cursors.h"
11
12 namespace ash {
13 namespace test {
14
15 typedef test::AshTestBase CursorManagerTest;
16
17 TEST_F(CursorManagerTest, LockCursor) {
18 CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
19 CursorManagerTestApi test_api(cursor_manager);
20
21 cursor_manager->SetCursor(ui::kCursorCopy);
22 EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type());
23 cursor_manager->SetDeviceScaleFactor(2.0f);
24 EXPECT_EQ(2.0f, test_api.GetDeviceScaleFactor());
25 EXPECT_TRUE(test_api.GetCurrentCursor().platform());
26
27 cursor_manager->LockCursor();
28 EXPECT_TRUE(cursor_manager->is_cursor_locked());
29
30 // Cursor type does not change while cursor is locked.
31 cursor_manager->SetCursor(ui::kCursorPointer);
32 EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type());
33
34 // Device scale factor does change even while cursor is locked.
35 cursor_manager->SetDeviceScaleFactor(1.0f);
36 EXPECT_EQ(1.0f, test_api.GetDeviceScaleFactor());
37
38 cursor_manager->UnlockCursor();
39 EXPECT_FALSE(cursor_manager->is_cursor_locked());
40
41 // Cursor type changes to the one specified while cursor is locked.
42 EXPECT_EQ(ui::kCursorPointer, test_api.GetCurrentCursor().native_type());
43 EXPECT_EQ(1.0f, test_api.GetDeviceScaleFactor());
44 EXPECT_TRUE(test_api.GetCurrentCursor().platform());
45 }
46
47 TEST_F(CursorManagerTest, SetCursor) {
48 CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
49 CursorManagerTestApi test_api(cursor_manager);
50
51 cursor_manager->SetCursor(ui::kCursorCopy);
52 EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type());
53 EXPECT_TRUE(test_api.GetCurrentCursor().platform());
54 cursor_manager->SetCursor(ui::kCursorPointer);
55 EXPECT_EQ(ui::kCursorPointer, test_api.GetCurrentCursor().native_type());
56 EXPECT_TRUE(test_api.GetCurrentCursor().platform());
57 }
58
59 TEST_F(CursorManagerTest, SetDeviceScaleFactor) {
60 CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
61 CursorManagerTestApi test_api(cursor_manager);
62
63 cursor_manager->SetDeviceScaleFactor(2.0f);
64 EXPECT_EQ(2.0f, test_api.GetDeviceScaleFactor());
65 cursor_manager->SetDeviceScaleFactor(1.0f);
66 EXPECT_EQ(1.0f, test_api.GetDeviceScaleFactor());
67 }
68
69 } // namespace test
70 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/cursor_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698