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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/display_controller.h" | 8 #include "ash/display/display_controller.h" |
9 #include "ash/display/display_info.h" | 9 #include "ash/display/display_info.h" |
10 #include "ash/display/display_layout_store.h" | 10 #include "ash/display/display_layout_store.h" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 261 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
262 EXPECT_EQ("0 0 1", GetCountSummary()); | 262 EXPECT_EQ("0 0 1", GetCountSummary()); |
263 reset(); | 263 reset(); |
264 | 264 |
265 display_manager()->AddRemoveDisplay(); | 265 display_manager()->AddRemoveDisplay(); |
266 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 266 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
267 EXPECT_EQ("0 1 0", GetCountSummary()); | 267 EXPECT_EQ("0 1 0", GetCountSummary()); |
268 reset(); | 268 reset(); |
269 } | 269 } |
270 | 270 |
| 271 // Tests support for 3 displays. |
| 272 TEST_F(DisplayManagerTest, UpdateThreeDisplaysTest) { |
| 273 if (!SupportsMultipleDisplays()) |
| 274 return; |
| 275 |
| 276 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
| 277 |
| 278 // Test with three displays. |
| 279 UpdateDisplay("0+0-640x480,640+0-320x200,960+0-400x300"); |
| 280 EXPECT_EQ(3U, display_manager()->GetNumDisplays()); |
| 281 EXPECT_EQ("0,0 640x480", |
| 282 display_manager()->GetDisplayAt(0).bounds().ToString()); |
| 283 EXPECT_EQ("640,0 320x200", |
| 284 display_manager()->GetDisplayAt(1).bounds().ToString()); |
| 285 EXPECT_EQ("960,0 400x300", |
| 286 display_manager()->GetDisplayAt(2).bounds().ToString()); |
| 287 |
| 288 EXPECT_EQ("1 2 0", GetCountSummary()); |
| 289 EXPECT_EQ(display_manager()->GetDisplayAt(0).id(), changed()[0].id()); |
| 290 EXPECT_EQ(display_manager()->GetDisplayAt(1).id(), added()[0].id()); |
| 291 EXPECT_EQ(display_manager()->GetDisplayAt(2).id(), added()[1].id()); |
| 292 EXPECT_EQ("0,0 640x480", changed()[0].bounds().ToString()); |
| 293 // Secondary and terniary displays are on right. |
| 294 EXPECT_EQ("640,0 320x200", added()[0].bounds().ToString()); |
| 295 EXPECT_EQ("640,0 320x200", |
| 296 GetDisplayInfo(added()[0]).bounds_in_native().ToString()); |
| 297 EXPECT_EQ("960,0 400x300", added()[1].bounds().ToString()); |
| 298 EXPECT_EQ("960,0 400x300", |
| 299 GetDisplayInfo(added()[1]).bounds_in_native().ToString()); |
| 300 reset(); |
| 301 } |
| 302 |
271 TEST_F(DisplayManagerTest, OverscanInsetsTest) { | 303 TEST_F(DisplayManagerTest, OverscanInsetsTest) { |
272 if (!SupportsMultipleDisplays()) | 304 if (!SupportsMultipleDisplays()) |
273 return; | 305 return; |
274 | 306 |
275 UpdateDisplay("0+0-500x500,0+501-400x400"); | 307 UpdateDisplay("0+0-500x500,0+501-400x400"); |
276 reset(); | 308 reset(); |
277 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); | 309 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); |
278 const DisplayInfo& display_info1 = GetDisplayInfoAt(0); | 310 const DisplayInfo& display_info1 = GetDisplayInfoAt(0); |
279 const DisplayInfo& display_info2 = GetDisplayInfoAt(1); | 311 const DisplayInfo& display_info2 = GetDisplayInfoAt(1); |
280 display_manager()->SetOverscanInsets( | 312 display_manager()->SetOverscanInsets( |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); | 1628 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); |
1597 ASSERT_DOUBLE_EQ( | 1629 ASSERT_DOUBLE_EQ( |
1598 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 1630 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
1599 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); | 1631 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); |
1600 DisplayInfo::SetUse125DSFForUIScaling(false); | 1632 DisplayInfo::SetUse125DSFForUIScaling(false); |
1601 } | 1633 } |
1602 | 1634 |
1603 #endif // OS_CHROMEOS | 1635 #endif // OS_CHROMEOS |
1604 | 1636 |
1605 } // namespace ash | 1637 } // namespace ash |
OLD | NEW |