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

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

Issue 562003002: Use the resource scale factor for cursor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cros only Created 6 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
« no previous file with comments | « ash/wm/ash_native_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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/ash_native_cursor_manager.h" 5 #include "ash/wm/ash_native_cursor_manager.h"
6 6
7 #include "ash/display/display_info.h" 7 #include "ash/display/display_info.h"
8 #include "ash/display/display_manager.h" 8 #include "ash/display/display_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 CursorManagerTestApi test_api(cursor_manager); 139 CursorManagerTestApi test_api(cursor_manager);
140 UpdateDisplay("800x100*2"); 140 UpdateDisplay("800x100*2");
141 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); 141 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor());
142 EXPECT_EQ(gfx::Display::ROTATE_0, test_api.GetCurrentCursorRotation()); 142 EXPECT_EQ(gfx::Display::ROTATE_0, test_api.GetCurrentCursorRotation());
143 143
144 UpdateDisplay("800x100/l"); 144 UpdateDisplay("800x100/l");
145 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); 145 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor());
146 EXPECT_EQ(gfx::Display::ROTATE_270, test_api.GetCurrentCursorRotation()); 146 EXPECT_EQ(gfx::Display::ROTATE_270, test_api.GetCurrentCursorRotation());
147 } 147 }
148 148
149 #if defined(OS_CHROMEOS)
150 // TODO(oshima): crbug.com/143619
151 TEST_F(AshNativeCursorManagerTest, FractionalScale) {
152 ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
153 CursorManagerTestApi test_api(cursor_manager);
154 // Cursor should use the resource scale factor.
155 UpdateDisplay("800x100*1.25");
156 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor());
157 }
158 #endif
159
149 TEST_F(AshNativeCursorManagerTest, UIScaleShouldNotChangeCursor) { 160 TEST_F(AshNativeCursorManagerTest, UIScaleShouldNotChangeCursor) {
150 int64 display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); 161 int64 display_id = Shell::GetScreen()->GetPrimaryDisplay().id();
151 gfx::Display::SetInternalDisplayId(display_id); 162 gfx::Display::SetInternalDisplayId(display_id);
152 163
153 ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); 164 ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
154 CursorManagerTestApi test_api(cursor_manager); 165 CursorManagerTestApi test_api(cursor_manager);
155 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 166 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
156 167
157 DisplayInfo::SetAllowUpgradeToHighDPI(false); 168 DisplayInfo::SetAllowUpgradeToHighDPI(false);
158 display_manager->SetDisplayUIScale(display_id, 0.5f); 169 display_manager->SetDisplayUIScale(display_id, 0.5f);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 loader.set_scale(2.0f); 209 loader.set_scale(2.0f);
199 loader.LoadImageCursor(kCursorId, IDR_AURA_CURSOR_MOVE, gfx::Point()); 210 loader.LoadImageCursor(kCursorId, IDR_AURA_CURSOR_MOVE, gfx::Point());
200 image = loader.GetXcursorImageForTest(kCursorId); 211 image = loader.GetXcursorImageForTest(kCursorId);
201 EXPECT_EQ(height * 2, static_cast<int>(image->height)); 212 EXPECT_EQ(height * 2, static_cast<int>(image->height));
202 EXPECT_EQ(width * 2, static_cast<int>(image->width)); 213 EXPECT_EQ(width * 2, static_cast<int>(image->width));
203 } 214 }
204 #endif 215 #endif
205 216
206 } // namespace test 217 } // namespace test
207 } // namespace ash 218 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/ash_native_cursor_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698