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

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

Issue 578553002: Use DSF instead of UI scale if the native DSF is 1.25 and UI Scale is 0.8x (dsf=1.25 equivalent) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 "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
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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
1477 #endif // OS_CHROMEOS 1504 #endif // OS_CHROMEOS
1478 1505
1479 } // namespace ash 1506 } // namespace ash
OLDNEW
« ash/display/display_manager.cc ('K') | « ash/display/display_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698