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 "ash/display/display_manager.h" | 5 #include "ash/display/display_manager.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); | 507 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); |
508 | 508 |
509 // OnNativeDisplaysChanged may change the display bounds. Here makes sure | 509 // OnNativeDisplaysChanged may change the display bounds. Here makes sure |
510 // nothing changed if the exactly same displays are specified. | 510 // nothing changed if the exactly same displays are specified. |
511 display_manager()->OnNativeDisplaysChanged(displays); | 511 display_manager()->OnNativeDisplaysChanged(displays); |
512 EXPECT_EQ("-500,0 500x500", | 512 EXPECT_EQ("-500,0 500x500", |
513 FindDisplayForId(internal_display_id).bounds().ToString()); | 513 FindDisplayForId(internal_display_id).bounds().ToString()); |
514 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); | 514 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); |
515 } | 515 } |
516 | 516 |
| 517 TEST_F(DisplayManagerTest, AutomaticOverscanInsets) { |
| 518 UpdateDisplay("200x200,400x400"); |
| 519 |
| 520 std::vector<gfx::Display> displays; |
| 521 displays.push_back(*display_manager()->GetDisplayAt(0)); |
| 522 displays.push_back(*display_manager()->GetDisplayAt(1)); |
| 523 int64 id = displays[1].id(); |
| 524 display_manager()->SetHasOverscanFlagForTest(id, true); |
| 525 |
| 526 display_manager()->OnNativeDisplaysChanged(displays); |
| 527 // It has overscan insets, although SetOverscanInsets() isn't called. |
| 528 EXPECT_EQ("11,211 380x380", |
| 529 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); |
| 530 |
| 531 // If custom overscan insets is specified, the specified value is used. |
| 532 display_manager()->SetOverscanInsets(id, gfx::Insets(5, 6, 7, 8)); |
| 533 display_manager()->OnNativeDisplaysChanged(displays); |
| 534 EXPECT_EQ("7,206 386x388", |
| 535 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); |
| 536 |
| 537 // Do not overscan even though it has 'has_overscan' flag, if the custom |
| 538 // insets is empty. |
| 539 display_manager()->SetOverscanInsets(id, gfx::Insets()); |
| 540 display_manager()->OnNativeDisplaysChanged(displays); |
| 541 EXPECT_EQ("1,201 400x400", |
| 542 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); |
| 543 } |
| 544 |
517 } // namespace internal | 545 } // namespace internal |
518 } // namespace ash | 546 } // namespace ash |
OLD | NEW |