| 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 "ui/display/manager/managed_display_info.h" | 5 #include "ui/display/manager/managed_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 display { | 9 namespace display { |
| 10 namespace { | 10 namespace { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 typedef testing::Test DisplayInfoTest; | 24 typedef testing::Test DisplayInfoTest; |
| 25 | 25 |
| 26 TEST_F(DisplayInfoTest, CreateFromSpec) { | 26 TEST_F(DisplayInfoTest, CreateFromSpec) { |
| 27 ManagedDisplayInfo info = | 27 ManagedDisplayInfo info = |
| 28 ManagedDisplayInfo::CreateFromSpecWithID("200x100", 10); | 28 ManagedDisplayInfo::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(display::Display::ROTATE_0, info.GetActiveRotation()); | 32 EXPECT_EQ(Display::ROTATE_0, info.GetActiveRotation()); |
| 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 = ManagedDisplayInfo::CreateFromSpecWithID("10+20-300x400*2/o", 10); | 36 info = ManagedDisplayInfo::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(display::Display::ROTATE_0, info.GetActiveRotation()); | 39 EXPECT_EQ(Display::ROTATE_0, info.GetActiveRotation()); |
| 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 = ManagedDisplayInfo::CreateFromSpecWithID("10+20-300x400*2/ob", 10); | 42 info = ManagedDisplayInfo::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(display::Display::ROTATE_0, info.GetActiveRotation()); | 45 EXPECT_EQ(Display::ROTATE_0, info.GetActiveRotation()); |
| 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 = ManagedDisplayInfo::CreateFromSpecWithID("10+20-300x400*2/or", 10); | 48 info = ManagedDisplayInfo::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(display::Display::ROTATE_90, info.GetActiveRotation()); | 51 EXPECT_EQ(Display::ROTATE_90, info.GetActiveRotation()); |
| 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 = ManagedDisplayInfo::CreateFromSpecWithID("10+20-300x400*2/l@1.5", 10); | 55 info = ManagedDisplayInfo::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(display::Display::ROTATE_270, info.GetActiveRotation()); | 57 EXPECT_EQ(Display::ROTATE_270, info.GetActiveRotation()); |
| 58 EXPECT_EQ(1.5f, info.configured_ui_scale()); | 58 EXPECT_EQ(1.5f, info.configured_ui_scale()); |
| 59 | 59 |
| 60 info = ManagedDisplayInfo::CreateFromSpecWithID( | 60 info = ManagedDisplayInfo::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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 ManagedDisplayInfo copy_info = | 142 ManagedDisplayInfo copy_info = |
| 143 ManagedDisplayInfo::CreateFromSpecWithID("200x100", 10); | 143 ManagedDisplayInfo::CreateFromSpecWithID("200x100", 10); |
| 144 copy_info.Copy(info); | 144 copy_info.Copy(info); |
| 145 EXPECT_EQ(2u, copy_info.input_devices().size()); | 145 EXPECT_EQ(2u, copy_info.input_devices().size()); |
| 146 copy_info.ClearInputDevices(); | 146 copy_info.ClearInputDevices(); |
| 147 EXPECT_EQ(0u, copy_info.input_devices().size()); | 147 EXPECT_EQ(0u, copy_info.input_devices().size()); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace display | 150 } // namespace display |
| OLD | NEW |