| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "ash/common/ash_switches.h" | 8 #include "ash/common/ash_switches.h" |
| 9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 display.bounds().InsetsFrom(work_area).ToString()); | 57 display.bounds().InsetsFrom(work_area).ToString()); |
| 58 | 58 |
| 59 UpdateDisplay("2000x1800*2.0f"); | 59 UpdateDisplay("2000x1800*2.0f"); |
| 60 display::Screen* screen = display::Screen::GetScreen(); | 60 display::Screen* screen = display::Screen::GetScreen(); |
| 61 | 61 |
| 62 const display::Display display_2x = screen->GetDisplayNearestWindow(root); | 62 const display::Display display_2x = screen->GetDisplayNearestWindow(root); |
| 63 const DisplayInfo display_info_2x = | 63 const DisplayInfo display_info_2x = |
| 64 Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x.id()); | 64 Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x.id()); |
| 65 | 65 |
| 66 // The |bounds_in_pixel()| should report bounds in pixel coordinate. | 66 // The |bounds_in_pixel()| should report bounds in pixel coordinate. |
| 67 EXPECT_EQ("1,1 2000x1800", | 67 EXPECT_EQ("1,1 2000x1800", display_info_2x.bounds_in_native().ToString()); |
| 68 display_info_2x.bounds_in_native().ToString()); | |
| 69 | 68 |
| 70 // Aura and views coordinates are in DIP, so they their bounds do not change. | 69 // Aura and views coordinates are in DIP, so they their bounds do not change. |
| 71 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); | 70 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); |
| 72 work_area = display_2x.work_area(); | 71 work_area = display_2x.work_area(); |
| 73 EXPECT_EQ(gfx::Rect(0, 0, 1000, 853 + height_offset).ToString(), | 72 EXPECT_EQ(gfx::Rect(0, 0, 1000, 853 + height_offset).ToString(), |
| 74 work_area.ToString()); | 73 work_area.ToString()); |
| 75 EXPECT_EQ(gfx::Insets(0, 0, 47 - height_offset, 0).ToString(), | 74 EXPECT_EQ(gfx::Insets(0, 0, 47 - height_offset, 0).ToString(), |
| 76 display_2x.bounds().InsetsFrom(work_area).ToString()); | 75 display_2x.bounds().InsetsFrom(work_area).ToString()); |
| 77 | 76 |
| 78 // Sanity check if the workarea's inset hight is same as | 77 // Sanity check if the workarea's inset hight is same as |
| 79 // the shelf's height. | 78 // the shelf's height. |
| 80 Shelf* shelf = Shelf::ForPrimaryDisplay(); | 79 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
| 81 EXPECT_EQ( | 80 EXPECT_EQ(display_2x.bounds().InsetsFrom(work_area).height(), |
| 82 display_2x.bounds().InsetsFrom(work_area).height(), | 81 shelf->shelf_widget()->GetNativeView()->layer()->bounds().height()); |
| 83 shelf->shelf_widget()->GetNativeView()->layer()->bounds().height()); | |
| 84 } | 82 } |
| 85 #endif // defined(OS_CHROMEOS) | 83 #endif // defined(OS_CHROMEOS) |
| 86 | 84 |
| 87 } // namespace ash | 85 } // namespace ash |
| OLD | NEW |