OLD | NEW |
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 EXPECT_EQ(2.0f, | 177 EXPECT_EQ(2.0f, |
178 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 178 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
179 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); | 179 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); |
180 display_manager->SetDisplayUIScale(display_id, 2.0f); | 180 display_manager->SetDisplayUIScale(display_id, 2.0f); |
181 EXPECT_EQ(1.0f, | 181 EXPECT_EQ(1.0f, |
182 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 182 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
183 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); | 183 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); |
184 } | 184 } |
185 | 185 |
186 #if defined(USE_X11) | 186 #if defined(USE_X11) |
187 // This test is in ash_unittests becuase ui_unittests does not include | 187 // This test is in ash_unittests because ui_base_unittests does not include |
188 // 2x assets. crbug.com/372541. | 188 // 2x assets. crbug.com/372541. |
189 TEST_F(AshNativeCursorManagerTest, CursorLoaderX11Test) { | 189 TEST_F(AshNativeCursorManagerTest, CursorLoaderX11Test) { |
190 const int kCursorId = 1; | 190 const int kCursorId = 1; |
191 ui::CursorLoaderX11 loader; | 191 ui::CursorLoaderX11 loader; |
192 loader.set_scale(1.0f); | 192 loader.set_scale(1.0f); |
193 | 193 |
194 loader.LoadImageCursor(kCursorId, IDR_AURA_CURSOR_MOVE, gfx::Point()); | 194 loader.LoadImageCursor(kCursorId, IDR_AURA_CURSOR_MOVE, gfx::Point()); |
195 const XcursorImage* image = loader.GetXcursorImageForTest(kCursorId); | 195 const XcursorImage* image = loader.GetXcursorImageForTest(kCursorId); |
196 int height = image->height; | 196 int height = image->height; |
197 int width = image->width; | 197 int width = image->width; |
198 loader.UnloadAll(); | 198 loader.UnloadAll(); |
199 | 199 |
200 // Load 2x cursor and make sure its size is 2x of the 1x cusor. | 200 // Load 2x cursor and make sure its size is 2x of the 1x cusor. |
201 loader.set_scale(2.0f); | 201 loader.set_scale(2.0f); |
202 loader.LoadImageCursor(kCursorId, IDR_AURA_CURSOR_MOVE, gfx::Point()); | 202 loader.LoadImageCursor(kCursorId, IDR_AURA_CURSOR_MOVE, gfx::Point()); |
203 image = loader.GetXcursorImageForTest(kCursorId); | 203 image = loader.GetXcursorImageForTest(kCursorId); |
204 EXPECT_EQ(height * 2, static_cast<int>(image->height)); | 204 EXPECT_EQ(height * 2, static_cast<int>(image->height)); |
205 EXPECT_EQ(width * 2, static_cast<int>(image->width)); | 205 EXPECT_EQ(width * 2, static_cast<int>(image->width)); |
206 } | 206 } |
207 #endif | 207 #endif |
208 | 208 |
209 } // namespace test | 209 } // namespace test |
210 } // namespace ash | 210 } // namespace ash |
OLD | NEW |