| 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/display/display.h" | 5 #include "ui/display/display.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/test/scoped_command_line.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/display/display_switches.h" | 10 #include "ui/display/display_switches.h" |
| 10 #include "ui/gfx/geometry/insets.h" | 11 #include "ui/gfx/geometry/insets.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 13 | 14 |
| 14 namespace display { | 15 namespace display { |
| 15 | 16 |
| 16 TEST(DisplayTest, WorkArea) { | 17 TEST(DisplayTest, WorkArea) { |
| 17 Display display(0, gfx::Rect(0, 0, 100, 100)); | 18 Display display(0, gfx::Rect(0, 0, 100, 100)); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 45 EXPECT_EQ("10,10 50x50", display.work_area().ToString()); | 46 EXPECT_EQ("10,10 50x50", display.work_area().ToString()); |
| 46 | 47 |
| 47 // Scale it back to 1x | 48 // Scale it back to 1x |
| 48 display.SetScaleAndBounds(1.0f, gfx::Rect(0, 0, 100, 100)); | 49 display.SetScaleAndBounds(1.0f, gfx::Rect(0, 0, 100, 100)); |
| 49 EXPECT_EQ("0,0 100x100", display.bounds().ToString()); | 50 EXPECT_EQ("0,0 100x100", display.bounds().ToString()); |
| 50 EXPECT_EQ("10,10 80x80", display.work_area().ToString()); | 51 EXPECT_EQ("10,10 80x80", display.work_area().ToString()); |
| 51 } | 52 } |
| 52 | 53 |
| 53 // https://crbug.com/517944 | 54 // https://crbug.com/517944 |
| 54 TEST(DisplayTest, ForcedDeviceScaleFactorByCommandLine) { | 55 TEST(DisplayTest, ForcedDeviceScaleFactorByCommandLine) { |
| 56 base::test::ScopedCommandLine scoped_command_line; |
| 57 base::CommandLine* command_line = scoped_command_line.GetProcessCommandLine(); |
| 58 |
| 55 Display::ResetForceDeviceScaleFactorForTesting(); | 59 Display::ResetForceDeviceScaleFactorForTesting(); |
| 56 | 60 |
| 57 // Look ma, no value! | 61 command_line->AppendSwitch(switches::kForceDeviceScaleFactor); |
| 58 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 59 switches::kForceDeviceScaleFactor); | |
| 60 | 62 |
| 61 EXPECT_EQ(1, Display::GetForcedDeviceScaleFactor()); | 63 EXPECT_EQ(1, Display::GetForcedDeviceScaleFactor()); |
| 62 Display::ResetForceDeviceScaleFactorForTesting(); | 64 Display::ResetForceDeviceScaleFactorForTesting(); |
| 63 } | 65 } |
| 64 | 66 |
| 67 TEST(DisplayTest, DisplayHDRValues) { |
| 68 base::test::ScopedCommandLine scoped_command_line; |
| 69 base::CommandLine* command_line = scoped_command_line.GetProcessCommandLine(); |
| 70 { |
| 71 Display display; |
| 72 EXPECT_EQ(24, display.color_depth()); |
| 73 EXPECT_EQ(8, display.depth_per_component()); |
| 74 } |
| 75 |
| 76 command_line->AppendSwitch(switches::kEnableHDR); |
| 77 { |
| 78 Display display; |
| 79 EXPECT_EQ(48, display.color_depth()); |
| 80 EXPECT_EQ(16, display.depth_per_component()); |
| 81 } |
| 82 } |
| 83 |
| 65 } // namespace display | 84 } // namespace display |
| OLD | NEW |