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

Unified Diff: ui/display/display_util_unittest.cc

Issue 227593011: Modifies the threshold for hidpi displays. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix 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
« no previous file with comments | « ui/display/display_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/display_util_unittest.cc
diff --git a/ui/display/display_util_unittest.cc b/ui/display/display_util_unittest.cc
index 8a63ef292744feacf4305c46a7db2406907a3abf..8b426734c1ee5d4c38ecbda2f4d7daeb4c6e6936 100644
--- a/ui/display/display_util_unittest.cc
+++ b/ui/display/display_util_unittest.cc
@@ -20,4 +20,34 @@ TEST(DisplayUtilTest, TestBlackListedDisplay) {
EXPECT_FALSE(IsDisplaySizeBlackListed(gfx::Size(272, 181)));
}
+TEST(DisplayUtilTest, GetScaleFactor) {
+ // Normal chromebook spec. DPI ~= 130
+ EXPECT_EQ(1.0f, GetScaleFactor(
+ gfx::Size(256, 144), gfx::Size(1366, 768)));
+
+ // HiDPI like Pixel. DPI ~= 240
+ EXPECT_EQ(2.0f, GetScaleFactor(
+ gfx::Size(272, 181), gfx::Size(2560, 1700)));
+
+ // A large external display but normal pixel density. DPI ~= 100
+ EXPECT_EQ(1.0f, GetScaleFactor(
+ gfx::Size(641, 400), gfx::Size(2560, 1600)));
+
+ // A large external display with high pixel density. DPI ~= 157
+ EXPECT_EQ(2.0f, GetScaleFactor(
+ gfx::Size(621, 341), gfx::Size(3840, 2160)));
+
+ // 4K resolution but the display is physically even larger. DPI ~= 114
+ EXPECT_EQ(1.0f, GetScaleFactor(
+ gfx::Size(854, 481), gfx::Size(3840, 2160)));
+
+ // 21.5 inch, 1080p. DPI ~= 102
+ EXPECT_EQ(1.0f, GetScaleFactor(
+ gfx::Size(476, 267), gfx::Size(1920, 1080)));
+
+ // Corner case; slightly higher density but smaller screens. DPI ~= 165
+ EXPECT_EQ(1.0f, GetScaleFactor(
+ gfx::Size(293, 165), gfx::Size(1920, 1080)));
+}
+
} // namespace ui
« no previous file with comments | « ui/display/display_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698