OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/wm/window_util.h" | 5 #include "ash/wm/window_util.h" |
6 | 6 |
7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/wm/window_positioning_utils.h" | 8 #include "ash/common/wm/window_positioning_utils.h" |
9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 GetAdjustedBounds(visible_bounds, gfx::Rect(0, 0, 90, 90))); | 55 GetAdjustedBounds(visible_bounds, gfx::Rect(0, 0, 90, 90))); |
56 EXPECT_EQ("0,0 100x100", | 56 EXPECT_EQ("0,0 100x100", |
57 GetAdjustedBounds(visible_bounds, gfx::Rect(0, 0, 150, 150))); | 57 GetAdjustedBounds(visible_bounds, gfx::Rect(0, 0, 150, 150))); |
58 EXPECT_EQ("-50,0 100x100", | 58 EXPECT_EQ("-50,0 100x100", |
59 GetAdjustedBounds(visible_bounds, gfx::Rect(-50, -50, 150, 150))); | 59 GetAdjustedBounds(visible_bounds, gfx::Rect(-50, -50, 150, 150))); |
60 EXPECT_EQ("-75,10 100x100", | 60 EXPECT_EQ("-75,10 100x100", |
61 GetAdjustedBounds(visible_bounds, gfx::Rect(-100, 10, 150, 150))); | 61 GetAdjustedBounds(visible_bounds, gfx::Rect(-100, 10, 150, 150))); |
62 EXPECT_EQ("75,75 100x100", | 62 EXPECT_EQ("75,75 100x100", |
63 GetAdjustedBounds(visible_bounds, gfx::Rect(100, 100, 150, 150))); | 63 GetAdjustedBounds(visible_bounds, gfx::Rect(100, 100, 150, 150))); |
64 | 64 |
| 65 // For windows that have smaller dimensions than wm::kMinimumOnScreenArea, |
| 66 // we should adjust bounds accordingly, leaving no white space. |
| 67 EXPECT_EQ("50,80 20x20", |
| 68 GetAdjustedBounds(visible_bounds, gfx::Rect(50, 80, 20, 20))); |
| 69 EXPECT_EQ("80,50 20x20", |
| 70 GetAdjustedBounds(visible_bounds, gfx::Rect(80, 50, 20, 20))); |
| 71 EXPECT_EQ("0,50 20x20", |
| 72 GetAdjustedBounds(visible_bounds, gfx::Rect(0, 50, 20, 20))); |
| 73 EXPECT_EQ("50,0 20x20", |
| 74 GetAdjustedBounds(visible_bounds, gfx::Rect(50, 0, 20, 20))); |
| 75 EXPECT_EQ("50,80 20x20", |
| 76 GetAdjustedBounds(visible_bounds, gfx::Rect(50, 100, 20, 20))); |
| 77 EXPECT_EQ("80,50 20x20", |
| 78 GetAdjustedBounds(visible_bounds, gfx::Rect(100, 50, 20, 20))); |
| 79 EXPECT_EQ("0,50 20x20", |
| 80 GetAdjustedBounds(visible_bounds, gfx::Rect(-10, 50, 20, 20))); |
| 81 EXPECT_EQ("50,0 20x20", |
| 82 GetAdjustedBounds(visible_bounds, gfx::Rect(50, -10, 20, 20))); |
| 83 |
65 const gfx::Rect visible_bounds_right(200, 50, 100, 100); | 84 const gfx::Rect visible_bounds_right(200, 50, 100, 100); |
66 | 85 |
67 EXPECT_EQ("210,60 90x90", GetAdjustedBounds(visible_bounds_right, | 86 EXPECT_EQ("210,60 90x90", GetAdjustedBounds(visible_bounds_right, |
68 gfx::Rect(210, 60, 90, 90))); | 87 gfx::Rect(210, 60, 90, 90))); |
69 EXPECT_EQ("210,60 100x100", GetAdjustedBounds(visible_bounds_right, | 88 EXPECT_EQ("210,60 100x100", GetAdjustedBounds(visible_bounds_right, |
70 gfx::Rect(210, 60, 150, 150))); | 89 gfx::Rect(210, 60, 150, 150))); |
71 EXPECT_EQ("125,50 100x100", | 90 EXPECT_EQ("125,50 100x100", |
72 GetAdjustedBounds(visible_bounds_right, gfx::Rect(0, 0, 150, 150))); | 91 GetAdjustedBounds(visible_bounds_right, gfx::Rect(0, 0, 150, 150))); |
73 EXPECT_EQ("275,50 100x100", GetAdjustedBounds(visible_bounds_right, | 92 EXPECT_EQ("275,50 100x100", GetAdjustedBounds(visible_bounds_right, |
74 gfx::Rect(300, 20, 150, 150))); | 93 gfx::Rect(300, 20, 150, 150))); |
(...skipping 11 matching lines...) Expand all Loading... |
86 "-250,-40 100x100", | 105 "-250,-40 100x100", |
87 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-250, -40, 150, 150))); | 106 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-250, -40, 150, 150))); |
88 EXPECT_EQ( | 107 EXPECT_EQ( |
89 "-275,-50 100x100", | 108 "-275,-50 100x100", |
90 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-400, -60, 150, 150))); | 109 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-400, -60, 150, 150))); |
91 EXPECT_EQ("-125,0 100x100", | 110 EXPECT_EQ("-125,0 100x100", |
92 GetAdjustedBounds(visible_bounds_left, gfx::Rect(0, 0, 150, 150))); | 111 GetAdjustedBounds(visible_bounds_left, gfx::Rect(0, 0, 150, 150))); |
93 } | 112 } |
94 | 113 |
95 } // namespace ash | 114 } // namespace ash |
OLD | NEW |