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/multi_display_manager.h" | 5 #include "ash/display/multi_display_manager.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 220 } |
221 | 221 |
222 TEST_F(MultiDisplayManagerTest, MAYBE_OverscanInsetsTest) { | 222 TEST_F(MultiDisplayManagerTest, MAYBE_OverscanInsetsTest) { |
223 UpdateDisplay("0+0-500x500,0+501-400x400"); | 223 UpdateDisplay("0+0-500x500,0+501-400x400"); |
224 reset(); | 224 reset(); |
225 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); | 225 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); |
226 gfx::Display display1(*display_manager()->GetDisplayAt(0)); | 226 gfx::Display display1(*display_manager()->GetDisplayAt(0)); |
227 gfx::Display display2(*display_manager()->GetDisplayAt(1)); | 227 gfx::Display display2(*display_manager()->GetDisplayAt(1)); |
228 | 228 |
229 display_manager()->SetOverscanInsets( | 229 display_manager()->SetOverscanInsets( |
230 display2.id(), gfx::Insets(10, 11, 12, 13)); | 230 display2.id(), gfx::Insets(13, 12, 11, 10)); |
231 std::vector<gfx::Display> changed_displays = changed(); | 231 std::vector<gfx::Display> changed_displays = changed(); |
232 EXPECT_EQ(1u, changed_displays.size()); | 232 EXPECT_EQ(1u, changed_displays.size()); |
233 EXPECT_EQ(display2.id(), changed_displays[0].id()); | 233 EXPECT_EQ(display2.id(), changed_displays[0].id()); |
234 EXPECT_EQ("0,0 500x500", | 234 EXPECT_EQ("0,0 500x500", |
235 display_manager()->GetDisplayAt(0)->bounds_in_pixel().ToString()); | 235 display_manager()->GetDisplayAt(0)->bounds_in_pixel().ToString()); |
| 236 EXPECT_EQ("12,514 378x376", |
| 237 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); |
| 238 |
| 239 display_manager()->SetOverscanInsets( |
| 240 display2.id(), gfx::Insets(10, 11, 12, 13)); |
| 241 EXPECT_EQ("0,0 500x500", |
| 242 display_manager()->GetDisplayAt(0)->bounds_in_pixel().ToString()); |
236 EXPECT_EQ("11,511 376x378", | 243 EXPECT_EQ("11,511 376x378", |
237 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); | 244 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); |
238 | 245 |
239 // Recreate a new 2nd display. It won't apply the overscan inset because the | 246 // Recreate a new 2nd display. It won't apply the overscan inset because the |
240 // new display has a different ID. | 247 // new display has a different ID. |
241 UpdateDisplay("0+0-500x500"); | 248 UpdateDisplay("0+0-500x500"); |
242 UpdateDisplay("0+0-500x500,0+501-400x400"); | 249 UpdateDisplay("0+0-500x500,0+501-400x400"); |
243 EXPECT_EQ("0,0 500x500", | 250 EXPECT_EQ("0,0 500x500", |
244 display_manager()->GetDisplayAt(0)->bounds_in_pixel().ToString()); | 251 display_manager()->GetDisplayAt(0)->bounds_in_pixel().ToString()); |
245 EXPECT_EQ("0,501 400x400", | 252 EXPECT_EQ("0,501 400x400", |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // External display has disconnected then resumed. | 359 // External display has disconnected then resumed. |
353 displays.push_back(native_display); | 360 displays.push_back(native_display); |
354 display_manager()->OnNativeDisplaysChanged(displays); | 361 display_manager()->OnNativeDisplaysChanged(displays); |
355 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 362 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
356 EXPECT_EQ("0,0 500x500", | 363 EXPECT_EQ("0,0 500x500", |
357 FindDisplayForId(internal_display_id).bounds().ToString()); | 364 FindDisplayForId(internal_display_id).bounds().ToString()); |
358 } | 365 } |
359 | 366 |
360 } // namespace internal | 367 } // namespace internal |
361 } // namespace ash | 368 } // namespace ash |
OLD | NEW |