| 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/launcher/launcher_view.h" | 5 #include "ash/launcher/launcher_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 370 |
| 371 LauncherModel* model_; | 371 LauncherModel* model_; |
| 372 internal::LauncherView* launcher_view_; | 372 internal::LauncherView* launcher_view_; |
| 373 | 373 |
| 374 scoped_ptr<LauncherViewTestAPI> test_api_; | 374 scoped_ptr<LauncherViewTestAPI> test_api_; |
| 375 | 375 |
| 376 private: | 376 private: |
| 377 DISALLOW_COPY_AND_ASSIGN(LauncherViewTest); | 377 DISALLOW_COPY_AND_ASSIGN(LauncherViewTest); |
| 378 }; | 378 }; |
| 379 | 379 |
| 380 // Checks that the icon positions do not shift with a state change. | |
| 381 TEST_F(LauncherViewTest, NoStateChangeIconMovement) { | |
| 382 LauncherID last_added = AddAppShortcut(); | |
| 383 internal::LauncherButton* button = GetButtonByID(last_added); | |
| 384 EXPECT_EQ(button->state(), ash::internal::LauncherButton::STATE_NORMAL); | |
| 385 gfx::Rect old_bounds = button->GetIconBounds(); | |
| 386 | |
| 387 button->AddState(ash::internal::LauncherButton::STATE_HOVERED); | |
| 388 gfx::Rect hovered_bounds = button->GetIconBounds(); | |
| 389 EXPECT_EQ(old_bounds.ToString(), hovered_bounds.ToString()); | |
| 390 } | |
| 391 | |
| 392 // Adds browser button until overflow and verifies that the last added browser | 380 // Adds browser button until overflow and verifies that the last added browser |
| 393 // button is hidden. | 381 // button is hidden. |
| 394 TEST_F(LauncherViewTest, AddBrowserUntilOverflow) { | 382 TEST_F(LauncherViewTest, AddBrowserUntilOverflow) { |
| 395 // All buttons should be visible. | 383 // All buttons should be visible. |
| 396 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, | 384 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, |
| 397 test_api_->GetButtonCount()); | 385 test_api_->GetButtonCount()); |
| 398 | 386 |
| 399 // Add tabbed browser until overflow. | 387 // Add tabbed browser until overflow. |
| 400 int items_added = 0; | 388 int items_added = 0; |
| 401 LauncherID last_added = AddTabbedBrowser(); | 389 LauncherID last_added = AddTabbedBrowser(); |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 // All buttons should be visible. | 894 // All buttons should be visible. |
| 907 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, | 895 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, |
| 908 test_api_->GetButtonCount()); | 896 test_api_->GetButtonCount()); |
| 909 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0); | 897 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0); |
| 910 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1); | 898 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1); |
| 911 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width()); | 899 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width()); |
| 912 } | 900 } |
| 913 | 901 |
| 914 } // namespace test | 902 } // namespace test |
| 915 } // namespace ash | 903 } // namespace ash |
| OLD | NEW |