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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale()); | 938 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale()); |
939 | 939 |
940 display_manager()->SetDisplayUIScale(display_id, 2.0f); | 940 display_manager()->SetDisplayUIScale(display_id, 2.0f); |
941 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale()); | 941 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale()); |
942 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); | 942 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
943 display = Shell::GetScreen()->GetPrimaryDisplay(); | 943 display = Shell::GetScreen()->GetPrimaryDisplay(); |
944 EXPECT_EQ(1.0f, display.device_scale_factor()); | 944 EXPECT_EQ(1.0f, display.device_scale_factor()); |
945 EXPECT_EQ("1280x850", display.bounds().size().ToString()); | 945 EXPECT_EQ("1280x850", display.bounds().size().ToString()); |
946 } | 946 } |
947 | 947 |
| 948 TEST_F(DisplayManagerTest, UIScaleUpgradeToHighDPI) { |
| 949 int64 display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); |
| 950 gfx::Display::SetInternalDisplayId(display_id); |
| 951 UpdateDisplay("1920x1080"); |
| 952 |
| 953 DisplayInfo::SetAllowUpgradeToHighDPI(false); |
| 954 display_manager()->SetDisplayUIScale(display_id, 1.125f); |
| 955 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
| 956 EXPECT_EQ(1.125f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 957 EXPECT_EQ("2160x1215", GetDisplayForId(display_id).size().ToString()); |
| 958 |
| 959 display_manager()->SetDisplayUIScale(display_id, 0.5f); |
| 960 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
| 961 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 962 EXPECT_EQ("960x540", GetDisplayForId(display_id).size().ToString()); |
| 963 |
| 964 DisplayInfo::SetAllowUpgradeToHighDPI(true); |
| 965 display_manager()->SetDisplayUIScale(display_id, 1.125f); |
| 966 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
| 967 EXPECT_EQ(1.125f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 968 EXPECT_EQ("2160x1215", GetDisplayForId(display_id).size().ToString()); |
| 969 |
| 970 display_manager()->SetDisplayUIScale(display_id, 0.5f); |
| 971 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
| 972 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 973 EXPECT_EQ("960x540", GetDisplayForId(display_id).size().ToString()); |
| 974 |
| 975 // Upgrade only works on 1.0f DSF. |
| 976 UpdateDisplay("1920x1080*2"); |
| 977 display_manager()->SetDisplayUIScale(display_id, 1.125f); |
| 978 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
| 979 EXPECT_EQ(1.125f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 980 EXPECT_EQ("1080x607", GetDisplayForId(display_id).size().ToString()); |
| 981 |
| 982 display_manager()->SetDisplayUIScale(display_id, 0.5f); |
| 983 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
| 984 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 985 EXPECT_EQ("480x270", GetDisplayForId(display_id).size().ToString()); |
| 986 } |
948 | 987 |
949 #if defined(OS_WIN) | 988 #if defined(OS_WIN) |
950 // TODO(scottmg): RootWindow doesn't get resized on Windows | 989 // TODO(scottmg): RootWindow doesn't get resized on Windows |
951 // Ash. http://crbug.com/247916. | 990 // Ash. http://crbug.com/247916. |
952 #define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRo
tateZoom | 991 #define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRo
tateZoom |
953 #else | 992 #else |
954 #define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom | 993 #define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom |
955 #endif | 994 #endif |
956 | 995 |
957 TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) { | 996 TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) { |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest); | 1262 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest); |
1224 }; | 1263 }; |
1225 | 1264 |
1226 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) { | 1265 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) { |
1227 if (!SupportsMultipleDisplays()) | 1266 if (!SupportsMultipleDisplays()) |
1228 return; | 1267 return; |
1229 UpdateDisplay("500x300,800x400"); | 1268 UpdateDisplay("500x300,800x400"); |
1230 } | 1269 } |
1231 | 1270 |
1232 } // namespace ash | 1271 } // namespace ash |
OLD | NEW |