diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-30 00:15:52 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-30 00:15:52 +0000 |
commit | 5f9a4b0893a4898bcb7c28751bc02b4f210f630c (patch) | |
tree | 9b65634a393483900c395a2ecdbb2e4ba08bc02d /ash/launcher | |
parent | 0d6dcd1f6ccb4a9f01b143744dd802ec81a482b6 (diff) | |
download | chromium_src-5f9a4b0893a4898bcb7c28751bc02b4f210f630c.zip chromium_src-5f9a4b0893a4898bcb7c28751bc02b4f210f630c.tar.gz chromium_src-5f9a4b0893a4898bcb7c28751bc02b4f210f630c.tar.bz2 |
ash: Fix app list icon off position.
BUG=135198
TEST=Starting with an overflown launcher bar and verify app list button is at the right position. Also covered by a new test.
Review URL: https://chromiumcodereview.appspot.com/10704043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145038 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/launcher')
-rw-r--r-- | ash/launcher/launcher_view.cc | 7 | ||||
-rw-r--r-- | ash/launcher/launcher_view_unittest.cc | 36 |
2 files changed, 41 insertions, 2 deletions
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc index d5112c2..ff1e992 100644 --- a/ash/launcher/launcher_view.cc +++ b/ash/launcher/launcher_view.cc @@ -379,7 +379,12 @@ View* LauncherView::GetFocusTraversableParentView() { void LauncherView::LayoutToIdealBounds() { IdealBounds ideal_bounds; CalculateIdealBounds(&ideal_bounds); - views::ViewModelUtils::SetViewBoundsToIdealBounds(*view_model_); + + if (bounds_animator_->IsAnimating()) + AnimateToIdealBounds(); + else + views::ViewModelUtils::SetViewBoundsToIdealBounds(*view_model_); + overflow_button_->SetBoundsRect(ideal_bounds.overflow_bounds); } diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc index 556c99d..fb34c33 100644 --- a/ash/launcher/launcher_view_unittest.cc +++ b/ash/launcher/launcher_view_unittest.cc @@ -583,10 +583,44 @@ TEST_F(LauncherViewTest, ShouldHideTooltipTest) { EXPECT_TRUE(launcher_view_->ShouldHideTooltip( gfx::Point(all_area.x() - 1, all_area.y()))); EXPECT_TRUE(launcher_view_->ShouldHideTooltip( - gfx::Point(all_area.x(), all_area.y() - 1 ))); + gfx::Point(all_area.x(), all_area.y() - 1))); EXPECT_TRUE(launcher_view_->ShouldHideTooltip( gfx::Point(all_area.x(), all_area.bottom()))); } +// Resizing launcher view while an add animation without fade-in is running, +// which happens when overflow happens. App list button should end up in its +// new ideal bounds. +TEST_F(LauncherViewTest, ResizeDuringOverflowAddAnimation) { + // All buttons should be visible. + ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, + test_api_->GetButtonCount()); + + // Add buttons until overflow. Let the non-overflow add animations finish but + // leave the last running. + AddTabbedBrowserNoWait(); + while (!test_api_->IsOverflowButtonVisible()) { + test_api_->RunMessageLoopUntilAnimationsDone(); + AddTabbedBrowserNoWait(); + } + + // Resize launcher view with that animation running and stay overflown. + gfx::Rect bounds = launcher_view_->bounds(); + bounds.set_width(bounds.width() - kLauncherPreferredSize); + launcher_view_->SetBoundsRect(bounds); + ASSERT_TRUE(test_api_->IsOverflowButtonVisible()); + + // Finish the animation. + test_api_->RunMessageLoopUntilAnimationsDone(); + + // App list button should ends up in its new ideal bounds. + const int app_list_button_index = test_api_->GetButtonCount() - 1; + const gfx::Rect& app_list_ideal_bounds = + test_api_->GetIdealBoundsByIndex(app_list_button_index); + const gfx::Rect& app_list_bounds = + test_api_->GetBoundsByIndex(app_list_button_index); + EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); +} + } // namespace test } // namespace ash |