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/wm/base_layout_manager.h" | 5 #include "ash/wm/base_layout_manager.h" |
6 | 6 |
7 #include "ash/screen_ash.h" | 7 #include "ash/screen_ash.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
11 #include "ash/wm/property_util.h" | 11 #include "ash/wm/property_util.h" |
| 12 #include "ash/wm/window_util.h" |
12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
15 #include "ui/aura/root_window.h" | 16 #include "ui/aura/root_window.h" |
16 #include "ui/aura/test/test_windows.h" | 17 #include "ui/aura/test/test_windows.h" |
17 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
18 #include "ui/base/ui_base_types.h" | 19 #include "ui/base/ui_base_types.h" |
19 #include "ui/gfx/insets.h" | 20 #include "ui/gfx/insets.h" |
20 #include "ui/gfx/screen.h" | 21 #include "ui/gfx/screen.h" |
21 | 22 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Maximize it, which should reset restore bounds. | 186 // Maximize it, which should reset restore bounds. |
186 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 187 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
187 EXPECT_EQ("1,2 3x4", GetRestoreBoundsInParent(window.get()).ToString()); | 188 EXPECT_EQ("1,2 3x4", GetRestoreBoundsInParent(window.get()).ToString()); |
188 | 189 |
189 // Restore it, which should restore bounds and reset restore bounds. | 190 // Restore it, which should restore bounds and reset restore bounds. |
190 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 191 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
191 EXPECT_EQ("1,2 3x4", window->bounds().ToString()); | 192 EXPECT_EQ("1,2 3x4", window->bounds().ToString()); |
192 EXPECT_TRUE(GetRestoreBoundsInScreen(window.get()) == NULL); | 193 EXPECT_TRUE(GetRestoreBoundsInScreen(window.get()) == NULL); |
193 } | 194 } |
194 | 195 |
| 196 // Verifies that the restore bounds do not get reset when restoring to a |
| 197 // maximzied state from a minimized state. |
| 198 TEST_F(BaseLayoutManagerTest, BoundsAfterRestoringToMaximizeFromMinimize) { |
| 199 scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(1, 2, 3, 4))); |
| 200 gfx::Rect bounds(10, 15, 25, 35); |
| 201 window->SetBounds(bounds); |
| 202 |
| 203 // Maximize it, which should reset restore bounds. |
| 204 wm::MaximizeWindow(window.get()); |
| 205 EXPECT_EQ(bounds.ToString(), |
| 206 GetRestoreBoundsInParent(window.get()).ToString()); |
| 207 |
| 208 // Minimize the window. The restore bounds should not change. |
| 209 wm::MinimizeWindow(window.get()); |
| 210 EXPECT_EQ(bounds.ToString(), |
| 211 GetRestoreBoundsInParent(window.get()).ToString()); |
| 212 |
| 213 // Show the window again. The window should be maximized, and the restore |
| 214 // bounds should not change. |
| 215 window->Show(); |
| 216 EXPECT_EQ(bounds.ToString(), |
| 217 GetRestoreBoundsInParent(window.get()).ToString()); |
| 218 EXPECT_TRUE(wm::IsWindowMaximized(window.get())); |
| 219 |
| 220 wm::RestoreWindow(window.get()); |
| 221 EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); |
| 222 } |
| 223 |
195 } // namespace | 224 } // namespace |
196 | 225 |
197 } // namespace ash | 226 } // namespace ash |
OLD | NEW |