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/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/launcher/launcher.h" | 9 #include "ash/launcher/launcher.h" |
10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); | 40 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); |
41 gfx::Rect work_area = display.work_area(); | 41 gfx::Rect work_area = display.work_area(); |
42 EXPECT_EQ("0,0 1000x852", work_area.ToString()); | 42 EXPECT_EQ("0,0 1000x852", work_area.ToString()); |
43 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString()); | 43 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString()); |
44 | 44 |
45 UpdateDisplay("2000x1800*2.0f"); | 45 UpdateDisplay("2000x1800*2.0f"); |
46 gfx::Screen* screen = Shell::GetScreen(); | 46 gfx::Screen* screen = Shell::GetScreen(); |
47 | 47 |
48 const gfx::Display display_2x = screen->GetDisplayNearestWindow(root); | 48 const gfx::Display display_2x = screen->GetDisplayNearestWindow(root); |
49 const internal::DisplayInfo display_info_2x = | 49 const internal::DisplayInfo display_info_2x = |
50 Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x); | 50 Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x.id()); |
51 | 51 |
52 // The |bounds_in_pixel()| should report bounds in pixel coordinate. | 52 // The |bounds_in_pixel()| should report bounds in pixel coordinate. |
53 EXPECT_EQ("1,1 2000x1800", | 53 EXPECT_EQ("1,1 2000x1800", |
54 display_info_2x.bounds_in_pixel().ToString()); | 54 display_info_2x.bounds_in_pixel().ToString()); |
55 | 55 |
56 // Aura and views coordinates are in DIP, so they their bounds do not change. | 56 // Aura and views coordinates are in DIP, so they their bounds do not change. |
57 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); | 57 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); |
58 work_area = display_2x.work_area(); | 58 work_area = display_2x.work_area(); |
59 EXPECT_EQ("0,0 1000x852", work_area.ToString()); | 59 EXPECT_EQ("0,0 1000x852", work_area.ToString()); |
60 EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString()); | 60 EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString()); |
61 | 61 |
62 // Sanity check if the workarea's inset hight is same as | 62 // Sanity check if the workarea's inset hight is same as |
63 // the launcher's height. | 63 // the launcher's height. |
64 Launcher* launcher = Launcher::ForPrimaryDisplay(); | 64 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
65 EXPECT_EQ( | 65 EXPECT_EQ( |
66 display_2x.bounds().InsetsFrom(work_area).height(), | 66 display_2x.bounds().InsetsFrom(work_area).height(), |
67 launcher->shelf_widget()->GetNativeView()->layer()->bounds().height()); | 67 launcher->shelf_widget()->GetNativeView()->layer()->bounds().height()); |
68 } | 68 } |
69 | 69 |
70 } // namespace ash | 70 } // namespace ash |
OLD | NEW |