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

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
« ash/wm/cursor_manager.h ('K') | « 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"
oshima 2012/09/20 20:19:03 new line
mazda 2012/09/20 20:29:31 Done.
6 #include "ash/shell.h"
7 #include "ash/test/ash_test_base.h"
8
9 namespace ash {
10 namespace test {
11
12 typedef test::AshTestBase CursorManagerTest;
13
14 TEST_F(CursorManagerTest, LockCursor) {
15 CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
16 CursorManager::TestApi test_api(cursor_manager);
17
18 cursor_manager->SetCursor(ui::kCursorCopy);
19 EXPECT_EQ(ui::kCursorCopy, test_api.current_cursor().native_type());
20 cursor_manager->SetDeviceScaleFactor(2.0f);
21 EXPECT_EQ(2.0f, test_api.GetDeviceScaleFactor());
22 EXPECT_NE(0UL, test_api.current_cursor().platform());
23
24 cursor_manager->LockCursor();
25 EXPECT_TRUE(cursor_manager->is_cursor_locked());
26
27 // Cursor type does not change while cursor is locked.
28 cursor_manager->SetCursor(ui::kCursorPointer);
29 EXPECT_EQ(ui::kCursorCopy, test_api.current_cursor().native_type());
30
31 // Device scale factor does change even while cursor is locked.
32 cursor_manager->SetDeviceScaleFactor(1.0f);
33 EXPECT_EQ(1.0f, test_api.GetDeviceScaleFactor());
34
35 cursor_manager->UnlockCursor();
36 EXPECT_FALSE(cursor_manager->is_cursor_locked());
37
38 // Cursor type changes to the one specified while cursor is locked.
39 EXPECT_EQ(ui::kCursorPointer, test_api.current_cursor().native_type());
40 EXPECT_EQ(1.0f, test_api.GetDeviceScaleFactor());
41 EXPECT_NE(0UL, test_api.current_cursor().platform());
42 }
43
44 TEST_F(CursorManagerTest, SetCursor) {
45 CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
46 CursorManager::TestApi test_api(cursor_manager);
47
48 cursor_manager->SetCursor(ui::kCursorCopy);
49 EXPECT_EQ(ui::kCursorCopy, test_api.current_cursor().native_type());
50 EXPECT_NE(0UL, test_api.current_cursor().platform());
51 cursor_manager->SetCursor(ui::kCursorPointer);
52 EXPECT_EQ(ui::kCursorPointer, test_api.current_cursor().native_type());
53 EXPECT_NE(0UL, test_api.current_cursor().platform());
54 }
55
56 TEST_F(CursorManagerTest, SetDeviceScaleFactor) {
57 CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
58 CursorManager::TestApi test_api(cursor_manager);
59
60 cursor_manager->SetDeviceScaleFactor(2.0f);
61 EXPECT_EQ(2.0f, test_api.GetDeviceScaleFactor());
62 cursor_manager->SetDeviceScaleFactor(1.0f);
63 EXPECT_EQ(1.0f, test_api.GetDeviceScaleFactor());
64 }
65
66 } // namespace test
67 } // namespace ash
OLDNEW
« ash/wm/cursor_manager.h ('K') | « ash/wm/cursor_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698