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

Unified Diff: ash/display/display_manager_unittest.cc

Issue 230683003: Allow upgrading to 2x DSF for lower UI scale when 2x resoruces are available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« ash/display/display_info.cc ('K') | « ash/display/display_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_manager_unittest.cc
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index 33c253652ca49f7f2fa07effe75464f750ef9108..3c811d7cf9d116830449d30388135e39a7d47c71 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -945,6 +945,45 @@ TEST_F(DisplayManagerTest, UIScale) {
EXPECT_EQ("1280x850", display.bounds().size().ToString());
}
+TEST_F(DisplayManagerTest, UIScaleUpgradeToHighDPI) {
+ int64 display_id = Shell::GetScreen()->GetPrimaryDisplay().id();
+ gfx::Display::SetInternalDisplayId(display_id);
+ UpdateDisplay("1920x1080");
+
+ DisplayInfo::SetAllowUpgradeToHighDPI(false);
+ display_manager()->SetDisplayUIScale(display_id, 1.125f);
+ EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor());
+ EXPECT_EQ(1.125f, GetDisplayInfoAt(0).GetEffectiveUIScale());
+ EXPECT_EQ("2160x1215", GetDisplayForId(display_id).size().ToString());
+
+ display_manager()->SetDisplayUIScale(display_id, 0.5f);
+ EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor());
+ EXPECT_EQ(0.5f, GetDisplayInfoAt(0).GetEffectiveUIScale());
+ EXPECT_EQ("960x540", GetDisplayForId(display_id).size().ToString());
+
+ DisplayInfo::SetAllowUpgradeToHighDPI(true);
+ display_manager()->SetDisplayUIScale(display_id, 1.125f);
+ EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor());
+ EXPECT_EQ(1.125f, GetDisplayInfoAt(0).GetEffectiveUIScale());
+ EXPECT_EQ("2160x1215", GetDisplayForId(display_id).size().ToString());
+
+ display_manager()->SetDisplayUIScale(display_id, 0.5f);
+ EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor());
+ EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
+ EXPECT_EQ("960x540", GetDisplayForId(display_id).size().ToString());
+
+ // Upgrade only works on 1.0f DSF.
+ UpdateDisplay("1920x1080*2");
+ display_manager()->SetDisplayUIScale(display_id, 1.125f);
+ EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor());
+ EXPECT_EQ(1.125f, GetDisplayInfoAt(0).GetEffectiveUIScale());
+ EXPECT_EQ("1080x607", GetDisplayForId(display_id).size().ToString());
+
+ display_manager()->SetDisplayUIScale(display_id, 0.5f);
+ EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor());
+ EXPECT_EQ(0.5f, GetDisplayInfoAt(0).GetEffectiveUIScale());
+ EXPECT_EQ("480x270", GetDisplayForId(display_id).size().ToString());
+}
#if defined(OS_WIN)
// TODO(scottmg): RootWindow doesn't get resized on Windows
« ash/display/display_info.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