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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/display_controller.h" | 8 #include "ash/display/display_controller.h" |
9 #include "ash/display/display_layout_store.h" | 9 #include "ash/display/display_layout_store.h" |
10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); | 1095 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
1096 EXPECT_EQ(1.125f, GetDisplayInfoAt(0).GetEffectiveUIScale()); | 1096 EXPECT_EQ(1.125f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
1097 EXPECT_EQ("1080x607", GetDisplayForId(display_id).size().ToString()); | 1097 EXPECT_EQ("1080x607", GetDisplayForId(display_id).size().ToString()); |
1098 | 1098 |
1099 display_manager()->SetDisplayUIScale(display_id, 0.5f); | 1099 display_manager()->SetDisplayUIScale(display_id, 0.5f); |
1100 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); | 1100 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
1101 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).GetEffectiveUIScale()); | 1101 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
1102 EXPECT_EQ("480x270", GetDisplayForId(display_id).size().ToString()); | 1102 EXPECT_EQ("480x270", GetDisplayForId(display_id).size().ToString()); |
1103 } | 1103 } |
1104 | 1104 |
| 1105 TEST_F(DisplayManagerTest, Use125DSFRorUIScaling) { |
| 1106 int64 display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); |
| 1107 gfx::Display::SetInternalDisplayId(display_id); |
| 1108 DisplayInfo::SetUse125DSFForUIScaling(true); |
| 1109 |
| 1110 UpdateDisplay("1920x1080*1.25"); |
| 1111 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
| 1112 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 1113 |
| 1114 display_manager()->SetDisplayUIScale(display_id, 0.8f); |
| 1115 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
| 1116 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 1117 EXPECT_EQ("1536x864", GetDisplayForId(display_id).size().ToString()); |
| 1118 |
| 1119 display_manager()->SetDisplayUIScale(display_id, 0.5f); |
| 1120 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
| 1121 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 1122 EXPECT_EQ("960x540", GetDisplayForId(display_id).size().ToString()); |
| 1123 |
| 1124 display_manager()->SetDisplayUIScale(display_id, 1.25f); |
| 1125 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); |
| 1126 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 1127 EXPECT_EQ("2400x1350", GetDisplayForId(display_id).size().ToString()); |
| 1128 |
| 1129 DisplayInfo::SetUse125DSFForUIScaling(false); |
| 1130 } |
| 1131 |
1105 #if defined(OS_WIN) | 1132 #if defined(OS_WIN) |
1106 // TODO(scottmg): RootWindow doesn't get resized on Windows | 1133 // TODO(scottmg): RootWindow doesn't get resized on Windows |
1107 // Ash. http://crbug.com/247916. | 1134 // Ash. http://crbug.com/247916. |
1108 #define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRo
tateZoom | 1135 #define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRo
tateZoom |
1109 #else | 1136 #else |
1110 #define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom | 1137 #define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom |
1111 #endif | 1138 #endif |
1112 | 1139 |
1113 TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) { | 1140 TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) { |
1114 // Make sure just rotating will not change native location. | 1141 // Make sure just rotating will not change native location. |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); | 1494 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); |
1468 } | 1495 } |
1469 | 1496 |
1470 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200External) { | 1497 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200External) { |
1471 FontTestHelper helper(2.0f, FontTestHelper::EXTERNAL); | 1498 FontTestHelper helper(2.0f, FontTestHelper::EXTERNAL); |
1472 ASSERT_DOUBLE_EQ( | 1499 ASSERT_DOUBLE_EQ( |
1473 2.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 1500 2.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
1474 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); | 1501 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); |
1475 } | 1502 } |
1476 | 1503 |
| 1504 TEST_F(DisplayManagerFontTest, |
| 1505 TextSubpixelPositioningWithDsf125InternalWithScaling) { |
| 1506 DisplayInfo::SetUse125DSFForUIScaling(true); |
| 1507 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); |
| 1508 ASSERT_DOUBLE_EQ( |
| 1509 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
| 1510 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); |
| 1511 DisplayInfo::SetUse125DSFForUIScaling(false); |
| 1512 } |
| 1513 |
1477 #endif // OS_CHROMEOS | 1514 #endif // OS_CHROMEOS |
1478 | 1515 |
1479 } // namespace ash | 1516 } // namespace ash |
OLD | NEW |