| 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 | 638 |
| 639 // The tooltip should not hide on the app-list button. | 639 // The tooltip should not hide on the app-list button. |
| 640 views::View* app_list_button = launcher_view_->GetAppListButtonView(); | 640 views::View* app_list_button = launcher_view_->GetAppListButtonView(); |
| 641 EXPECT_FALSE(launcher_view_->ShouldHideTooltip( | 641 EXPECT_FALSE(launcher_view_->ShouldHideTooltip( |
| 642 app_list_button->GetMirroredBounds().CenterPoint())); | 642 app_list_button->GetMirroredBounds().CenterPoint())); |
| 643 | 643 |
| 644 // The tooltip shouldn't hide if the mouse is in the gap between two buttons. | 644 // The tooltip shouldn't hide if the mouse is in the gap between two buttons. |
| 645 gfx::Rect app_button_rect = GetButtonByID(app_button_id)->GetMirroredBounds(); | 645 gfx::Rect app_button_rect = GetButtonByID(app_button_id)->GetMirroredBounds(); |
| 646 gfx::Rect tab_button_rect = GetButtonByID(tab_button_id)->GetMirroredBounds(); | 646 gfx::Rect tab_button_rect = GetButtonByID(tab_button_id)->GetMirroredBounds(); |
| 647 ASSERT_FALSE(app_button_rect.Intersects(tab_button_rect)); | 647 ASSERT_FALSE(app_button_rect.Intersects(tab_button_rect)); |
| 648 EXPECT_FALSE(launcher_view_->ShouldHideTooltip( | 648 gfx::Rect union_rect = app_button_rect; |
| 649 app_button_rect.Union(tab_button_rect).CenterPoint())); | 649 union_rect.Union(tab_button_rect); |
| 650 EXPECT_FALSE(launcher_view_->ShouldHideTooltip(union_rect.CenterPoint())); |
| 650 | 651 |
| 651 // The tooltip should hide if it's outside of all buttons. | 652 // The tooltip should hide if it's outside of all buttons. |
| 652 gfx::Rect all_area; | 653 gfx::Rect all_area; |
| 653 for (int i = 0; i < test_api_->GetButtonCount(); i++) { | 654 for (int i = 0; i < test_api_->GetButtonCount(); i++) { |
| 654 internal::LauncherButton* button = test_api_->GetButton(i); | 655 internal::LauncherButton* button = test_api_->GetButton(i); |
| 655 if (!button) | 656 if (!button) |
| 656 continue; | 657 continue; |
| 657 | 658 |
| 658 all_area = all_area.Union(button->GetMirroredBounds()); | 659 all_area.Union(button->GetMirroredBounds()); |
| 659 } | 660 } |
| 660 all_area = all_area.Union( | 661 all_area.Union(launcher_view_->GetAppListButtonView()->GetMirroredBounds()); |
| 661 launcher_view_->GetAppListButtonView()->GetMirroredBounds()); | |
| 662 EXPECT_FALSE(launcher_view_->ShouldHideTooltip(all_area.origin())); | 662 EXPECT_FALSE(launcher_view_->ShouldHideTooltip(all_area.origin())); |
| 663 EXPECT_FALSE(launcher_view_->ShouldHideTooltip( | 663 EXPECT_FALSE(launcher_view_->ShouldHideTooltip( |
| 664 gfx::Point(all_area.right() - 1, all_area.bottom() - 1))); | 664 gfx::Point(all_area.right() - 1, all_area.bottom() - 1))); |
| 665 EXPECT_TRUE(launcher_view_->ShouldHideTooltip( | 665 EXPECT_TRUE(launcher_view_->ShouldHideTooltip( |
| 666 gfx::Point(all_area.right(), all_area.y()))); | 666 gfx::Point(all_area.right(), all_area.y()))); |
| 667 EXPECT_TRUE(launcher_view_->ShouldHideTooltip( | 667 EXPECT_TRUE(launcher_view_->ShouldHideTooltip( |
| 668 gfx::Point(all_area.x() - 1, all_area.y()))); | 668 gfx::Point(all_area.x() - 1, all_area.y()))); |
| 669 EXPECT_TRUE(launcher_view_->ShouldHideTooltip( | 669 EXPECT_TRUE(launcher_view_->ShouldHideTooltip( |
| 670 gfx::Point(all_area.x(), all_area.y() - 1))); | 670 gfx::Point(all_area.x(), all_area.y() - 1))); |
| 671 EXPECT_TRUE(launcher_view_->ShouldHideTooltip( | 671 EXPECT_TRUE(launcher_view_->ShouldHideTooltip( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 const int app_list_button_index = test_api_->GetButtonCount() - 1; | 722 const int app_list_button_index = test_api_->GetButtonCount() - 1; |
| 723 const gfx::Rect& app_list_ideal_bounds = | 723 const gfx::Rect& app_list_ideal_bounds = |
| 724 test_api_->GetIdealBoundsByIndex(app_list_button_index); | 724 test_api_->GetIdealBoundsByIndex(app_list_button_index); |
| 725 const gfx::Rect& app_list_bounds = | 725 const gfx::Rect& app_list_bounds = |
| 726 test_api_->GetBoundsByIndex(app_list_button_index); | 726 test_api_->GetBoundsByIndex(app_list_button_index); |
| 727 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); | 727 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); |
| 728 } | 728 } |
| 729 | 729 |
| 730 } // namespace test | 730 } // namespace test |
| 731 } // namespace ash | 731 } // namespace ash |
| OLD | NEW |