Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: ash/display/display_manager_unittest.cc

Issue 2945913003: Add 1.6x mode. (Closed)
Patch Set: Add 1.6x support Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/display/manager/chromeos/display_change_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
1677
1678 UpdateDisplay("1280x800"); 1676 UpdateDisplay("1280x800");
1679 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); 1677 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
1680 display::test::DisplayManagerTestApi(display_manager()) 1678 display::test::DisplayManagerTestApi(display_manager())
1681 .SetDisplayUIScale(display_id, 1.125f); 1679 .SetDisplayUIScale(display_id, 1.125f);
1682 EXPECT_EQ(1.0, GetDisplayInfoAt(0).configured_ui_scale()); 1680 EXPECT_EQ(1.0, GetDisplayInfoAt(0).configured_ui_scale());
1683 display::test::DisplayManagerTestApi(display_manager()) 1681 display::test::DisplayManagerTestApi(display_manager())
1684 .SetDisplayUIScale(display_id, 0.8f); 1682 .SetDisplayUIScale(display_id, 0.8f);
1685 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); 1683 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
1686 display::test::DisplayManagerTestApi(display_manager()) 1684 display::test::DisplayManagerTestApi(display_manager())
1687 .SetDisplayUIScale(display_id, 0.75f); 1685 .SetDisplayUIScale(display_id, 0.75f);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 .SetDisplayUIScale(display_id, 0.5f); 1776 .SetDisplayUIScale(display_id, 0.5f);
1779 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale()); 1777 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale());
1780 1778
1781 display::test::DisplayManagerTestApi(display_manager()) 1779 display::test::DisplayManagerTestApi(display_manager())
1782 .SetDisplayUIScale(display_id, 2.0f); 1780 .SetDisplayUIScale(display_id, 2.0f);
1783 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale()); 1781 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale());
1784 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); 1782 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
1785 display = display::Screen::GetScreen()->GetPrimaryDisplay(); 1783 display = display::Screen::GetScreen()->GetPrimaryDisplay();
1786 EXPECT_EQ(1.0f, display.device_scale_factor()); 1784 EXPECT_EQ(1.0f, display.device_scale_factor());
1787 EXPECT_EQ("1280x850", display.bounds().size().ToString()); 1785 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 } 1786 }
1800 1787
1801 TEST_F(DisplayManagerTest, UIScaleWithDisplayMode) { 1788 TEST_F(DisplayManagerTest, UIScaleWithDisplayMode) {
1802 int display_id = 1000; 1789 int display_id = 1000;
1803 1790
1804 // Setup the display modes with UI-scale. 1791 // Setup the display modes with UI-scale.
1805 display::ManagedDisplayInfo native_display_info = 1792 display::ManagedDisplayInfo native_display_info =
1806 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1280, 800)); 1793 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1280, 800));
1807 const scoped_refptr<display::ManagedDisplayMode>& base_mode( 1794 const scoped_refptr<display::ManagedDisplayMode>& base_mode(
1808 new display::ManagedDisplayMode(gfx::Size(1280, 800), 60.0f, false, 1795 new display::ManagedDisplayMode(gfx::Size(1280, 800), 60.0f, false,
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
2789 2776
2790 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100Internal) { 2777 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100Internal) {
2791 FontTestHelper helper(1.0f, FontTestHelper::INTERNAL); 2778 FontTestHelper helper(1.0f, FontTestHelper::INTERNAL);
2792 ASSERT_DOUBLE_EQ( 2779 ASSERT_DOUBLE_EQ(
2793 1.0f, 2780 1.0f,
2794 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2781 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
2795 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); 2782 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
2796 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2783 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
2797 } 2784 }
2798 2785
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) { 2786 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) {
2810 FontTestHelper helper(2.0f, FontTestHelper::INTERNAL); 2787 FontTestHelper helper(2.0f, FontTestHelper::INTERNAL);
2811 ASSERT_DOUBLE_EQ( 2788 ASSERT_DOUBLE_EQ(
2812 2.0f, 2789 2.0f,
2813 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2790 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
2814 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 2791 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
2815 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2792 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
2816 2793
2817 display::test::DisplayManagerTestApi(helper.display_manager()) 2794 display::test::DisplayManagerTestApi(helper.display_manager())
2818 .SetDisplayUIScale(display::Screen::GetScreen()->GetPrimaryDisplay().id(), 2795 .SetDisplayUIScale(display::Screen::GetScreen()->GetPrimaryDisplay().id(),
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
3207 test_api.GetCurrentOrientation()); 3184 test_api.GetCurrentOrientation());
3208 3185
3209 // The orientation has alraedy been locked to secondary once, so 3186 // The orientation has alraedy been locked to secondary once, so
3210 // it should swtich back to the portrait secondary. 3187 // it should swtich back to the portrait secondary.
3211 wm::ActivateWindow(window_ps); 3188 wm::ActivateWindow(window_ps);
3212 EXPECT_EQ(blink::kWebScreenOrientationLockPortraitSecondary, 3189 EXPECT_EQ(blink::kWebScreenOrientationLockPortraitSecondary,
3213 test_api.GetCurrentOrientation()); 3190 test_api.GetCurrentOrientation());
3214 } 3191 }
3215 3192
3216 } // namespace ash 3193 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/display/manager/chromeos/display_change_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698