diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 05:23:42 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 05:23:42 +0000 |
commit | b13b644549b2839c1716124de5b678dae8fb689a (patch) | |
tree | 7b3bcde030cfa9c27c92095e3f2a8167a8173769 /ash/wm | |
parent | bc40f1a18f0ecbb4608f169392fc2a3979a85b38 (diff) | |
download | chromium_src-b13b644549b2839c1716124de5b678dae8fb689a.zip chromium_src-b13b644549b2839c1716124de5b678dae8fb689a.tar.gz chromium_src-b13b644549b2839c1716124de5b678dae8fb689a.tar.bz2 |
ash: Window restore-bounds should not be reset when showing window from minimized state.
BUG=138873
TEST=ash_unittests:BaseLayoutManagerTest.BoundsAfterRestoringToMaximizeFromMinimize
Review URL: https://chromiumcodereview.appspot.com/10821008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148294 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm')
-rw-r--r-- | ash/wm/base_layout_manager.cc | 2 | ||||
-rw-r--r-- | ash/wm/base_layout_manager_unittest.cc | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/ash/wm/base_layout_manager.cc b/ash/wm/base_layout_manager.cc index 76e133e..cd582ad 100644 --- a/ash/wm/base_layout_manager.cc +++ b/ash/wm/base_layout_manager.cc @@ -135,7 +135,7 @@ void BaseLayoutManager::OnWindowPropertyChanged(aura::Window* window, ui::WindowShowState old_state = static_cast<ui::WindowShowState>(old); ui::WindowShowState new_state = window->GetProperty(aura::client::kShowStateKey); - if (old_state != new_state && + if (old_state != new_state && old_state != ui::SHOW_STATE_MINIMIZED && ((new_state == ui::SHOW_STATE_MAXIMIZED && old_state != ui::SHOW_STATE_FULLSCREEN) || (new_state == ui::SHOW_STATE_FULLSCREEN && diff --git a/ash/wm/base_layout_manager_unittest.cc b/ash/wm/base_layout_manager_unittest.cc index e02b32a..e2525cc 100644 --- a/ash/wm/base_layout_manager_unittest.cc +++ b/ash/wm/base_layout_manager_unittest.cc @@ -9,6 +9,7 @@ #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" #include "ash/wm/property_util.h" +#include "ash/wm/window_util.h" #include "base/basictypes.h" #include "base/compiler_specific.h" #include "ui/aura/client/aura_constants.h" @@ -192,6 +193,34 @@ TEST_F(BaseLayoutManagerTest, MaximizeResetsRestoreBounds) { EXPECT_TRUE(GetRestoreBoundsInScreen(window.get()) == NULL); } +// Verifies that the restore bounds do not get reset when restoring to a +// maximzied state from a minimized state. +TEST_F(BaseLayoutManagerTest, BoundsAfterRestoringToMaximizeFromMinimize) { + scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(1, 2, 3, 4))); + gfx::Rect bounds(10, 15, 25, 35); + window->SetBounds(bounds); + + // Maximize it, which should reset restore bounds. + wm::MaximizeWindow(window.get()); + EXPECT_EQ(bounds.ToString(), + GetRestoreBoundsInParent(window.get()).ToString()); + + // Minimize the window. The restore bounds should not change. + wm::MinimizeWindow(window.get()); + EXPECT_EQ(bounds.ToString(), + GetRestoreBoundsInParent(window.get()).ToString()); + + // Show the window again. The window should be maximized, and the restore + // bounds should not change. + window->Show(); + EXPECT_EQ(bounds.ToString(), + GetRestoreBoundsInParent(window.get()).ToString()); + EXPECT_TRUE(wm::IsWindowMaximized(window.get())); + + wm::RestoreWindow(window.get()); + EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); +} + } // namespace } // namespace ash |