OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_info.h" | 5 #include "ash/display/display_info.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace ash { | 9 namespace ash { |
10 namespace { | 10 namespace { |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 typedef testing::Test DisplayInfoTest; | 25 typedef testing::Test DisplayInfoTest; |
26 | 26 |
27 TEST_F(DisplayInfoTest, CreateFromSpec) { | 27 TEST_F(DisplayInfoTest, CreateFromSpec) { |
28 DisplayInfo info = DisplayInfo::CreateFromSpecWithID("200x100", 10); | 28 DisplayInfo info = DisplayInfo::CreateFromSpecWithID("200x100", 10); |
29 EXPECT_EQ(10, info.id()); | 29 EXPECT_EQ(10, info.id()); |
30 EXPECT_EQ("0,0 200x100", info.bounds_in_native().ToString()); | 30 EXPECT_EQ("0,0 200x100", info.bounds_in_native().ToString()); |
31 EXPECT_EQ("200x100", info.size_in_pixel().ToString()); | 31 EXPECT_EQ("200x100", info.size_in_pixel().ToString()); |
32 EXPECT_EQ(gfx::Display::ROTATE_0, info.GetActiveRotation()); | 32 EXPECT_EQ(gfx::Display::ROTATE_0, info.rotation()); |
33 EXPECT_EQ("0,0,0,0", info.overscan_insets_in_dip().ToString()); | 33 EXPECT_EQ("0,0,0,0", info.overscan_insets_in_dip().ToString()); |
34 EXPECT_EQ(1.0f, info.configured_ui_scale()); | 34 EXPECT_EQ(1.0f, info.configured_ui_scale()); |
35 | 35 |
36 info = DisplayInfo::CreateFromSpecWithID("10+20-300x400*2/o", 10); | 36 info = DisplayInfo::CreateFromSpecWithID("10+20-300x400*2/o", 10); |
37 EXPECT_EQ("10,20 300x400", info.bounds_in_native().ToString()); | 37 EXPECT_EQ("10,20 300x400", info.bounds_in_native().ToString()); |
38 EXPECT_EQ("288x380", info.size_in_pixel().ToString()); | 38 EXPECT_EQ("288x380", info.size_in_pixel().ToString()); |
39 EXPECT_EQ(gfx::Display::ROTATE_0, info.GetActiveRotation()); | 39 EXPECT_EQ(gfx::Display::ROTATE_0, info.rotation()); |
40 EXPECT_EQ("5,3,5,3", info.overscan_insets_in_dip().ToString()); | 40 EXPECT_EQ("5,3,5,3", info.overscan_insets_in_dip().ToString()); |
41 | 41 |
42 info = DisplayInfo::CreateFromSpecWithID("10+20-300x400*2/ob", 10); | 42 info = DisplayInfo::CreateFromSpecWithID("10+20-300x400*2/ob", 10); |
43 EXPECT_EQ("10,20 300x400", info.bounds_in_native().ToString()); | 43 EXPECT_EQ("10,20 300x400", info.bounds_in_native().ToString()); |
44 EXPECT_EQ("288x380", info.size_in_pixel().ToString()); | 44 EXPECT_EQ("288x380", info.size_in_pixel().ToString()); |
45 EXPECT_EQ(gfx::Display::ROTATE_0, info.GetActiveRotation()); | 45 EXPECT_EQ(gfx::Display::ROTATE_0, info.rotation()); |
46 EXPECT_EQ("5,3,5,3", info.overscan_insets_in_dip().ToString()); | 46 EXPECT_EQ("5,3,5,3", info.overscan_insets_in_dip().ToString()); |
47 | 47 |
48 info = DisplayInfo::CreateFromSpecWithID("10+20-300x400*2/or", 10); | 48 info = DisplayInfo::CreateFromSpecWithID("10+20-300x400*2/or", 10); |
49 EXPECT_EQ("10,20 300x400", info.bounds_in_native().ToString()); | 49 EXPECT_EQ("10,20 300x400", info.bounds_in_native().ToString()); |
50 EXPECT_EQ("380x288", info.size_in_pixel().ToString()); | 50 EXPECT_EQ("380x288", info.size_in_pixel().ToString()); |
51 EXPECT_EQ(gfx::Display::ROTATE_90, info.GetActiveRotation()); | 51 EXPECT_EQ(gfx::Display::ROTATE_90, info.rotation()); |
52 // TODO(oshima): This should be rotated too. Fix this. | 52 // TODO(oshima): This should be rotated too. Fix this. |
53 EXPECT_EQ("5,3,5,3", info.overscan_insets_in_dip().ToString()); | 53 EXPECT_EQ("5,3,5,3", info.overscan_insets_in_dip().ToString()); |
54 | 54 |
55 info = DisplayInfo::CreateFromSpecWithID("10+20-300x400*2/l@1.5", 10); | 55 info = DisplayInfo::CreateFromSpecWithID("10+20-300x400*2/l@1.5", 10); |
56 EXPECT_EQ("10,20 300x400", info.bounds_in_native().ToString()); | 56 EXPECT_EQ("10,20 300x400", info.bounds_in_native().ToString()); |
57 EXPECT_EQ(gfx::Display::ROTATE_270, info.GetActiveRotation()); | 57 EXPECT_EQ(gfx::Display::ROTATE_270, info.rotation()); |
58 EXPECT_EQ(1.5f, info.configured_ui_scale()); | 58 EXPECT_EQ(1.5f, info.configured_ui_scale()); |
59 | 59 |
60 info = DisplayInfo::CreateFromSpecWithID( | 60 info = DisplayInfo::CreateFromSpecWithID( |
61 "200x200#300x200|200x200%59.9|100x100%60|150x100*2|150x150*1.25%30", 10); | 61 "200x200#300x200|200x200%59.9|100x100%60|150x100*2|150x150*1.25%30", 10); |
62 | 62 |
63 EXPECT_EQ("0,0 200x200", info.bounds_in_native().ToString()); | 63 EXPECT_EQ("0,0 200x200", info.bounds_in_native().ToString()); |
64 EXPECT_EQ(5u, info.display_modes().size()); | 64 EXPECT_EQ(5u, info.display_modes().size()); |
65 // Modes are sorted in DIP for external display. | 65 // Modes are sorted in DIP for external display. |
66 EXPECT_EQ("150x100", info.display_modes()[0].size.ToString()); | 66 EXPECT_EQ("150x100", info.display_modes()[0].size.ToString()); |
67 EXPECT_EQ("100x100", info.display_modes()[1].size.ToString()); | 67 EXPECT_EQ("100x100", info.display_modes()[1].size.ToString()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 TEST_F(DisplayInfoTest, DisplayModeGetSizeForExternal4K) { | 123 TEST_F(DisplayInfoTest, DisplayModeGetSizeForExternal4K) { |
124 DisplayInfo::SetUse125DSFForUIScaling(true); | 124 DisplayInfo::SetUse125DSFForUIScaling(true); |
125 gfx::Size size(3840, 2160); | 125 gfx::Size size(3840, 2160); |
126 EXPECT_EQ("1920x1080", GetModeSizeInDIP(size, 2.0f, 1.0f, false)); | 126 EXPECT_EQ("1920x1080", GetModeSizeInDIP(size, 2.0f, 1.0f, false)); |
127 EXPECT_EQ("3072x1728", GetModeSizeInDIP(size, 1.25f, 1.0f, false)); | 127 EXPECT_EQ("3072x1728", GetModeSizeInDIP(size, 1.25f, 1.0f, false)); |
128 EXPECT_EQ("3840x2160", GetModeSizeInDIP(size, 1.0f, 1.0f, false)); | 128 EXPECT_EQ("3840x2160", GetModeSizeInDIP(size, 1.0f, 1.0f, false)); |
129 DisplayInfo::SetUse125DSFForUIScaling(false); | 129 DisplayInfo::SetUse125DSFForUIScaling(false); |
130 } | 130 } |
131 | 131 |
132 } // namespace ash | 132 } // namespace ash |
OLD | NEW |