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/display/display_manager.h" | 5 #include "ash/display/display_manager.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/display/display_layout_store.h" | 8 #include "ash/display/display_layout_store.h" |
9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).configured_ui_scale()); | 946 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).configured_ui_scale()); |
947 display_manager()->SetDisplayUIScale(display_id, 0.5f); | 947 display_manager()->SetDisplayUIScale(display_id, 0.5f); |
948 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale()); | 948 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale()); |
949 | 949 |
950 display_manager()->SetDisplayUIScale(display_id, 2.0f); | 950 display_manager()->SetDisplayUIScale(display_id, 2.0f); |
951 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale()); | 951 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale()); |
952 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); | 952 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
953 display = Shell::GetScreen()->GetPrimaryDisplay(); | 953 display = Shell::GetScreen()->GetPrimaryDisplay(); |
954 EXPECT_EQ(1.0f, display.device_scale_factor()); | 954 EXPECT_EQ(1.0f, display.device_scale_factor()); |
955 EXPECT_EQ("1280x850", display.bounds().size().ToString()); | 955 EXPECT_EQ("1280x850", display.bounds().size().ToString()); |
| 956 |
| 957 // 1.25 ui scaling on 1.25 DSF device should use 1.0 DSF |
| 958 // on screen. |
| 959 UpdateDisplay("1280x850*1.25"); |
| 960 display_manager()->SetDisplayUIScale(display_id, 1.25f); |
| 961 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale()); |
| 962 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 963 display = Shell::GetScreen()->GetPrimaryDisplay(); |
| 964 EXPECT_EQ(1.0f, display.device_scale_factor()); |
| 965 EXPECT_EQ("1280x850", display.bounds().size().ToString()); |
956 } | 966 } |
957 | 967 |
958 TEST_F(DisplayManagerTest, UIScaleUpgradeToHighDPI) { | 968 TEST_F(DisplayManagerTest, UIScaleUpgradeToHighDPI) { |
959 int64 display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); | 969 int64 display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); |
960 gfx::Display::SetInternalDisplayId(display_id); | 970 gfx::Display::SetInternalDisplayId(display_id); |
961 UpdateDisplay("1920x1080"); | 971 UpdateDisplay("1920x1080"); |
962 | 972 |
963 DisplayInfo::SetAllowUpgradeToHighDPI(false); | 973 DisplayInfo::SetAllowUpgradeToHighDPI(false); |
964 display_manager()->SetDisplayUIScale(display_id, 1.125f); | 974 display_manager()->SetDisplayUIScale(display_id, 1.125f); |
965 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); | 975 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest); | 1281 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest); |
1272 }; | 1282 }; |
1273 | 1283 |
1274 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) { | 1284 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) { |
1275 if (!SupportsMultipleDisplays()) | 1285 if (!SupportsMultipleDisplays()) |
1276 return; | 1286 return; |
1277 UpdateDisplay("500x300,800x400"); | 1287 UpdateDisplay("500x300,800x400"); |
1278 } | 1288 } |
1279 | 1289 |
1280 } // namespace ash | 1290 } // namespace ash |
OLD | NEW |