Chromium Code Reviews| 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 "ui/display/manager/display_manager.h" | 5 #include "ui/display/manager/display_manager.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_commands_aura.h" | 7 #include "ash/accelerators/accelerator_commands_aura.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/display/display_configuration_controller.h" | 9 #include "ash/display/display_configuration_controller.h" |
| 10 #include "ash/display/display_util.h" | 10 #include "ash/display/display_util.h" |
| (...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1666 display::Display::ROTATION_SOURCE_ACTIVE); | 1666 display::Display::ROTATION_SOURCE_ACTIVE); |
| 1667 const display::ManagedDisplayInfo& post_rotation_info = | 1667 const display::ManagedDisplayInfo& post_rotation_info = |
| 1668 display::test::DisplayManagerTestApi(display_manager()) | 1668 display::test::DisplayManagerTestApi(display_manager()) |
| 1669 .GetInternalManagedDisplayInfo(internal_display_id); | 1669 .GetInternalManagedDisplayInfo(internal_display_id); |
| 1670 EXPECT_NE(info.GetActiveRotation(), post_rotation_info.GetActiveRotation()); | 1670 EXPECT_NE(info.GetActiveRotation(), post_rotation_info.GetActiveRotation()); |
| 1671 EXPECT_EQ(display::Display::ROTATE_180, | 1671 EXPECT_EQ(display::Display::ROTATE_180, |
| 1672 post_rotation_info.GetActiveRotation()); | 1672 post_rotation_info.GetActiveRotation()); |
| 1673 } | 1673 } |
| 1674 | 1674 |
| 1675 TEST_F(DisplayManagerTest, UIScale) { | 1675 TEST_F(DisplayManagerTest, UIScale) { |
| 1676 display::test::ScopedDisable125DSFForUIScaling disable; | 1676 // display::test::ScopedDisable125DSFForUIScaling disable; |
|
afakhry
2017/06/20 19:01:09
Nit: Please remove this line.
oshima
2017/06/20 20:06:41
Done.
| |
| 1677 | 1677 |
| 1678 UpdateDisplay("1280x800"); | 1678 UpdateDisplay("1280x800"); |
| 1679 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); | 1679 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); |
| 1680 display::test::DisplayManagerTestApi(display_manager()) | 1680 display::test::DisplayManagerTestApi(display_manager()) |
| 1681 .SetDisplayUIScale(display_id, 1.125f); | 1681 .SetDisplayUIScale(display_id, 1.125f); |
| 1682 EXPECT_EQ(1.0, GetDisplayInfoAt(0).configured_ui_scale()); | 1682 EXPECT_EQ(1.0, GetDisplayInfoAt(0).configured_ui_scale()); |
| 1683 display::test::DisplayManagerTestApi(display_manager()) | 1683 display::test::DisplayManagerTestApi(display_manager()) |
| 1684 .SetDisplayUIScale(display_id, 0.8f); | 1684 .SetDisplayUIScale(display_id, 0.8f); |
| 1685 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); | 1685 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); |
| 1686 display::test::DisplayManagerTestApi(display_manager()) | 1686 display::test::DisplayManagerTestApi(display_manager()) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1778 .SetDisplayUIScale(display_id, 0.5f); | 1778 .SetDisplayUIScale(display_id, 0.5f); |
| 1779 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale()); | 1779 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale()); |
| 1780 | 1780 |
| 1781 display::test::DisplayManagerTestApi(display_manager()) | 1781 display::test::DisplayManagerTestApi(display_manager()) |
| 1782 .SetDisplayUIScale(display_id, 2.0f); | 1782 .SetDisplayUIScale(display_id, 2.0f); |
| 1783 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale()); | 1783 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale()); |
| 1784 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); | 1784 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); |
| 1785 display = display::Screen::GetScreen()->GetPrimaryDisplay(); | 1785 display = display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 1786 EXPECT_EQ(1.0f, display.device_scale_factor()); | 1786 EXPECT_EQ(1.0f, display.device_scale_factor()); |
| 1787 EXPECT_EQ("1280x850", display.bounds().size().ToString()); | 1787 EXPECT_EQ("1280x850", display.bounds().size().ToString()); |
| 1788 | |
| 1789 // 1.25 ui scaling on 1.25 DSF device should use 1.0 DSF | |
| 1790 // on screen. | |
| 1791 UpdateDisplay("1280x850*1.25"); | |
| 1792 display::test::DisplayManagerTestApi(display_manager()) | |
| 1793 .SetDisplayUIScale(display_id, 1.25f); | |
| 1794 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale()); | |
| 1795 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); | |
| 1796 display = display::Screen::GetScreen()->GetPrimaryDisplay(); | |
| 1797 EXPECT_EQ(1.0f, display.device_scale_factor()); | |
| 1798 EXPECT_EQ("1280x850", display.bounds().size().ToString()); | |
| 1799 } | 1788 } |
| 1800 | 1789 |
| 1801 TEST_F(DisplayManagerTest, UIScaleWithDisplayMode) { | 1790 TEST_F(DisplayManagerTest, UIScaleWithDisplayMode) { |
| 1802 int display_id = 1000; | 1791 int display_id = 1000; |
| 1803 | 1792 |
| 1804 // Setup the display modes with UI-scale. | 1793 // Setup the display modes with UI-scale. |
| 1805 display::ManagedDisplayInfo native_display_info = | 1794 display::ManagedDisplayInfo native_display_info = |
| 1806 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1280, 800)); | 1795 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1280, 800)); |
| 1807 const scoped_refptr<display::ManagedDisplayMode>& base_mode( | 1796 const scoped_refptr<display::ManagedDisplayMode>& base_mode( |
| 1808 new display::ManagedDisplayMode(gfx::Size(1280, 800), 60.0f, false, | 1797 new display::ManagedDisplayMode(gfx::Size(1280, 800), 60.0f, false, |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2789 | 2778 |
| 2790 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100Internal) { | 2779 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100Internal) { |
| 2791 FontTestHelper helper(1.0f, FontTestHelper::INTERNAL); | 2780 FontTestHelper helper(1.0f, FontTestHelper::INTERNAL); |
| 2792 ASSERT_DOUBLE_EQ( | 2781 ASSERT_DOUBLE_EQ( |
| 2793 1.0f, | 2782 1.0f, |
| 2794 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 2783 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
| 2795 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); | 2784 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); |
| 2796 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); | 2785 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); |
| 2797 } | 2786 } |
| 2798 | 2787 |
| 2799 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125Internal) { | |
| 2800 display::test::ScopedDisable125DSFForUIScaling disable; | |
| 2801 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); | |
| 2802 ASSERT_DOUBLE_EQ( | |
| 2803 1.25f, | |
| 2804 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | |
| 2805 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); | |
| 2806 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); | |
| 2807 } | |
| 2808 | |
| 2809 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) { | 2788 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) { |
| 2810 FontTestHelper helper(2.0f, FontTestHelper::INTERNAL); | 2789 FontTestHelper helper(2.0f, FontTestHelper::INTERNAL); |
| 2811 ASSERT_DOUBLE_EQ( | 2790 ASSERT_DOUBLE_EQ( |
| 2812 2.0f, | 2791 2.0f, |
| 2813 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 2792 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
| 2814 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); | 2793 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); |
| 2815 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); | 2794 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); |
| 2816 | 2795 |
| 2817 display::test::DisplayManagerTestApi(helper.display_manager()) | 2796 display::test::DisplayManagerTestApi(helper.display_manager()) |
| 2818 .SetDisplayUIScale(display::Screen::GetScreen()->GetPrimaryDisplay().id(), | 2797 .SetDisplayUIScale(display::Screen::GetScreen()->GetPrimaryDisplay().id(), |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3207 test_api.GetCurrentOrientation()); | 3186 test_api.GetCurrentOrientation()); |
| 3208 | 3187 |
| 3209 // The orientation has alraedy been locked to secondary once, so | 3188 // The orientation has alraedy been locked to secondary once, so |
| 3210 // it should swtich back to the portrait secondary. | 3189 // it should swtich back to the portrait secondary. |
| 3211 wm::ActivateWindow(window_ps); | 3190 wm::ActivateWindow(window_ps); |
| 3212 EXPECT_EQ(blink::kWebScreenOrientationLockPortraitSecondary, | 3191 EXPECT_EQ(blink::kWebScreenOrientationLockPortraitSecondary, |
| 3213 test_api.GetCurrentOrientation()); | 3192 test_api.GetCurrentOrientation()); |
| 3214 } | 3193 } |
| 3215 | 3194 |
| 3216 } // namespace ash | 3195 } // namespace ash |
| OLD | NEW |