OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_change_observer_chromeos.h" | 5 #include "ash/display/display_change_observer_chromeos.h" |
6 | 6 |
7 #include "ash/display/display_info.h" | 7 #include "ash/display/display_info.h" |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/display/chromeos/display_configurator.h" | 10 #include "ui/display/chromeos/display_configurator.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 EXPECT_EQ(display_modes[5].refresh_rate, 60); | 75 EXPECT_EQ(display_modes[5].refresh_rate, 60); |
76 | 76 |
77 // Outputs without any modes shouldn't cause a crash. | 77 // Outputs without any modes shouldn't cause a crash. |
78 modes.clear(); | 78 modes.clear(); |
79 display_snapshot.set_modes(modes.get()); | 79 display_snapshot.set_modes(modes.get()); |
80 | 80 |
81 display_modes = DisplayChangeObserver::GetDisplayModeList(output); | 81 display_modes = DisplayChangeObserver::GetDisplayModeList(output); |
82 EXPECT_EQ(0u, display_modes.size()); | 82 EXPECT_EQ(0u, display_modes.size()); |
83 } | 83 } |
84 | 84 |
| 85 TEST_F(DisplayChangeObserverTest, FindDeviceScaleFactor) { |
| 86 // 19.5" 1600x900 |
| 87 EXPECT_EQ(1.0f, DisplayChangeObserver::FindDeviceScaleFactor(94.14f)); |
| 88 |
| 89 // 21.5" 1920x1080 |
| 90 EXPECT_EQ(1.0f, DisplayChangeObserver::FindDeviceScaleFactor(102.46f)); |
| 91 |
| 92 // 12.1" 1280x800 |
| 93 EXPECT_EQ(1.0f, DisplayChangeObserver::FindDeviceScaleFactor(124.75f)); |
| 94 |
| 95 // 13.3" 1920x1080 |
| 96 EXPECT_EQ(1.25f, DisplayChangeObserver::FindDeviceScaleFactor(157.35f)); |
| 97 |
| 98 // 14" 1920x1080 |
| 99 EXPECT_EQ(1.25f, DisplayChangeObserver::FindDeviceScaleFactor(165.63f)); |
| 100 |
| 101 // 12.85" 2560x1700 |
| 102 EXPECT_EQ(2.0f, DisplayChangeObserver::FindDeviceScaleFactor(239.15f)); |
| 103 |
| 104 // Erroneous values should still work. |
| 105 EXPECT_EQ(1.0f, DisplayChangeObserver::FindDeviceScaleFactor(-100.0f)); |
| 106 EXPECT_EQ(1.0f, DisplayChangeObserver::FindDeviceScaleFactor(0.0f)); |
| 107 EXPECT_EQ(2.0f, DisplayChangeObserver::FindDeviceScaleFactor(10000.0f)); |
| 108 } |
| 109 |
85 } // namespace ash | 110 } // namespace ash |
OLD | NEW |