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 "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/gfx/insets.h" | 8 #include "ui/gfx/insets.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 28 matching lines...) Expand all Loading... |
39 display.SetScaleAndBounds(2.0f, gfx::Rect(0, 0, 140, 140)); | 39 display.SetScaleAndBounds(2.0f, gfx::Rect(0, 0, 140, 140)); |
40 EXPECT_EQ("0,0 70x70", display.bounds().ToString()); | 40 EXPECT_EQ("0,0 70x70", display.bounds().ToString()); |
41 EXPECT_EQ("10,10 50x50", display.work_area().ToString()); | 41 EXPECT_EQ("10,10 50x50", display.work_area().ToString()); |
42 | 42 |
43 // Scale it back to 1x | 43 // Scale it back to 1x |
44 display.SetScaleAndBounds(1.0f, gfx::Rect(0, 0, 100, 100)); | 44 display.SetScaleAndBounds(1.0f, gfx::Rect(0, 0, 100, 100)); |
45 EXPECT_EQ("0,0 100x100", display.bounds().ToString()); | 45 EXPECT_EQ("0,0 100x100", display.bounds().ToString()); |
46 EXPECT_EQ("10,10 80x80", display.work_area().ToString()); | 46 EXPECT_EQ("10,10 80x80", display.work_area().ToString()); |
47 } | 47 } |
48 | 48 |
| 49 TEST(DisplayTest, OverscanInsets) { |
| 50 gfx::Display display(0, gfx::Rect(0, 0, 100, 100)); |
| 51 display.SetOverscanInsets(gfx::Insets(3, 4, 5, 6)); |
| 52 EXPECT_EQ("4,3 90x92", display.bounds_in_pixel().ToString()); |
| 53 display.SetOverscanInsets(gfx::Insets(6, 5, 4, 3)); |
| 54 EXPECT_EQ("5,6 92x90", display.bounds_in_pixel().ToString()); |
| 55 |
| 56 gfx::Display hidpi_display(0, gfx::Rect(0, 0, 100, 100)); |
| 57 hidpi_display.set_device_scale_factor(2.0f); |
| 58 hidpi_display.SetOverscanInsets(gfx::Insets(3, 4, 5, 6)); |
| 59 EXPECT_EQ("8,6 80x84", hidpi_display.bounds_in_pixel().ToString()); |
| 60 hidpi_display.SetOverscanInsets(gfx::Insets(6, 5, 4, 3)); |
| 61 EXPECT_EQ("10,12 84x80", hidpi_display.bounds_in_pixel().ToString()); |
49 } | 62 } |
| 63 |
| 64 } |
OLD | NEW |