Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: ash/launcher/launcher_view_unittest.cc

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/display/multi_display_manager.cc ('k') | ash/system/drive/tray_drive.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ash/display/multi_display_manager.cc ('k') | ash/system/drive/tray_drive.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698