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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/display/display_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/display_util.h" 5 #include "ui/display/display_util.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace ui { 9 namespace ui {
10 10
11 TEST(DisplayUtilTest, TestBlackListedDisplay) { 11 TEST(DisplayUtilTest, TestBlackListedDisplay) {
12 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(10, 10))); 12 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(10, 10)));
13 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(40, 30))); 13 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(40, 30)));
14 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(50, 40))); 14 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(50, 40)));
15 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(160, 90))); 15 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(160, 90)));
16 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(160, 100))); 16 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(160, 100)));
17 17
18 EXPECT_FALSE(IsDisplaySizeBlackListed(gfx::Size(50, 60))); 18 EXPECT_FALSE(IsDisplaySizeBlackListed(gfx::Size(50, 60)));
19 EXPECT_FALSE(IsDisplaySizeBlackListed(gfx::Size(100, 70))); 19 EXPECT_FALSE(IsDisplaySizeBlackListed(gfx::Size(100, 70)));
20 EXPECT_FALSE(IsDisplaySizeBlackListed(gfx::Size(272, 181))); 20 EXPECT_FALSE(IsDisplaySizeBlackListed(gfx::Size(272, 181)));
21 } 21 }
22 22
23 TEST(DisplayUtilTest, GetScaleFactor) {
24 // Normal chromebook spec. DPI ~= 130
25 EXPECT_EQ(1.0f, GetScaleFactor(
26 gfx::Size(256, 144), gfx::Size(1366, 768)));
27
28 // HiDPI like Pixel. DPI ~= 240
29 EXPECT_EQ(2.0f, GetScaleFactor(
30 gfx::Size(272, 181), gfx::Size(2560, 1700)));
31
32 // A large external display but normal pixel density. DPI ~= 100
33 EXPECT_EQ(1.0f, GetScaleFactor(
34 gfx::Size(641, 400), gfx::Size(2560, 1600)));
35
36 // A large external display with high pixel density. DPI ~= 157
37 EXPECT_EQ(2.0f, GetScaleFactor(
38 gfx::Size(621, 341), gfx::Size(3840, 2160)));
39
40 // 4K resolution but the display is physically even larger. DPI ~= 114
41 EXPECT_EQ(1.0f, GetScaleFactor(
42 gfx::Size(854, 481), gfx::Size(3840, 2160)));
43
44 // 21.5 inch, 1080p. DPI ~= 102
45 EXPECT_EQ(1.0f, GetScaleFactor(
46 gfx::Size(476, 267), gfx::Size(1920, 1080)));
47
48 // Corner case; slightly higher density but smaller screens. DPI ~= 165
49 EXPECT_EQ(1.0f, GetScaleFactor(
50 gfx::Size(293, 165), gfx::Size(1920, 1080)));
51 }
52
23 } // namespace ui 53 } // namespace ui
OLDNEW
« 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