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 gfx::Rect union_rect = app_button_rect; | 648 EXPECT_FALSE(launcher_view_->ShouldHideTooltip( |
649 union_rect.Union(tab_button_rect); | 649 gfx::UnionRects(app_button_rect, tab_button_rect).CenterPoint())); |
650 EXPECT_FALSE(launcher_view_->ShouldHideTooltip(union_rect.CenterPoint())); | |
651 | 650 |
652 // The tooltip should hide if it's outside of all buttons. | 651 // The tooltip should hide if it's outside of all buttons. |
653 gfx::Rect all_area; | 652 gfx::Rect all_area; |
654 for (int i = 0; i < test_api_->GetButtonCount(); i++) { | 653 for (int i = 0; i < test_api_->GetButtonCount(); i++) { |
655 internal::LauncherButton* button = test_api_->GetButton(i); | 654 internal::LauncherButton* button = test_api_->GetButton(i); |
656 if (!button) | 655 if (!button) |
657 continue; | 656 continue; |
658 | 657 |
659 all_area.Union(button->GetMirroredBounds()); | 658 all_area.Union(button->GetMirroredBounds()); |
660 } | 659 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 const int app_list_button_index = test_api_->GetButtonCount() - 1; | 721 const int app_list_button_index = test_api_->GetButtonCount() - 1; |
723 const gfx::Rect& app_list_ideal_bounds = | 722 const gfx::Rect& app_list_ideal_bounds = |
724 test_api_->GetIdealBoundsByIndex(app_list_button_index); | 723 test_api_->GetIdealBoundsByIndex(app_list_button_index); |
725 const gfx::Rect& app_list_bounds = | 724 const gfx::Rect& app_list_bounds = |
726 test_api_->GetBoundsByIndex(app_list_button_index); | 725 test_api_->GetBoundsByIndex(app_list_button_index); |
727 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); | 726 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); |
728 } | 727 } |
729 | 728 |
730 } // namespace test | 729 } // namespace test |
731 } // namespace ash | 730 } // namespace ash |
OLD | NEW |