OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gfx/display.h" | 5 #include "ui/gfx/display.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/gfx/geometry/insets.h" | 9 #include "ui/gfx/geometry/insets.h" |
10 #include "ui/gfx/switches.h" | 10 #include "ui/gfx/switches.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 Display::ResetForceDeviceScaleFactorForTesting(); | 55 Display::ResetForceDeviceScaleFactorForTesting(); |
56 | 56 |
57 // Look ma, no value! | 57 // Look ma, no value! |
58 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 58 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
59 switches::kForceDeviceScaleFactor); | 59 switches::kForceDeviceScaleFactor); |
60 | 60 |
61 EXPECT_EQ(1, Display::GetForcedDeviceScaleFactor()); | 61 EXPECT_EQ(1, Display::GetForcedDeviceScaleFactor()); |
62 Display::ResetForceDeviceScaleFactorForTesting(); | 62 Display::ResetForceDeviceScaleFactorForTesting(); |
63 } | 63 } |
64 | 64 |
| 65 TEST(DisplayTest, PhysicalSize) { |
| 66 Display display; |
| 67 EXPECT_FALSE(display.IsPhysicalSizeAvailable()); |
| 68 display.SetPhysicalSizeMm(gfx::Size(420, 69)); |
| 69 EXPECT_TRUE(display.IsPhysicalSizeAvailable()); |
| 70 gfx::Size size = display.GetPhysicalSizeMm(); |
| 71 EXPECT_EQ(420, size.width()); |
| 72 EXPECT_EQ(69, size.height()); |
| 73 } |
| 74 |
65 } // namespace | 75 } // namespace |
66 | 76 |
67 } // namespace gfx | 77 } // namespace gfx |
OLD | NEW |