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

Side by Side Diff: ash/shelf/shelf_view_unittest.cc

Issue 1849623002: Remove unused ash::SHELF_ALIGNMENT_TOP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months 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
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/shelf/shelf_widget.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/shelf/shelf_view.h" 5 #include "ash/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 button_ids.push_back(id); 952 button_ids.push_back(id);
953 } 953 }
954 ASSERT_LT(button_ids.size(), 10000U); 954 ASSERT_LT(button_ids.size(), 10000U);
955 EXPECT_TRUE(test_api_->IsOverflowButtonVisible()); 955 EXPECT_TRUE(test_api_->IsOverflowButtonVisible());
956 956
957 // Test that any two successive visible icons never overlap in all shelf 957 // Test that any two successive visible icons never overlap in all shelf
958 // alignment types. 958 // alignment types.
959 const ShelfAlignment kAlignments[] = { 959 const ShelfAlignment kAlignments[] = {
960 SHELF_ALIGNMENT_LEFT, 960 SHELF_ALIGNMENT_LEFT,
961 SHELF_ALIGNMENT_RIGHT, 961 SHELF_ALIGNMENT_RIGHT,
962 SHELF_ALIGNMENT_TOP,
963 SHELF_ALIGNMENT_BOTTOM 962 SHELF_ALIGNMENT_BOTTOM
964 }; 963 };
965 964
966 for (ShelfAlignment alignment : kAlignments) { 965 for (ShelfAlignment alignment : kAlignments) {
967 shelf_view_->shelf()->SetAlignment(alignment); 966 shelf_view_->shelf()->SetAlignment(alignment);
968 // For every 2 successive visible icons, expect that their bounds don't 967 // For every 2 successive visible icons, expect that their bounds don't
969 // intersect. 968 // intersect.
970 for (int i = 1; i < test_api_->GetButtonCount() - 1; ++i) { 969 for (int i = 1; i < test_api_->GetButtonCount() - 1; ++i) {
971 if (!(test_api_->GetButton(i)->visible() && 970 if (!(test_api_->GetButton(i)->visible() &&
972 test_api_->GetButton(i + 1)->visible())) { 971 test_api_->GetButton(i + 1)->visible())) {
973 continue; 972 continue;
974 } 973 }
975 974
976 const gfx::Rect& bounds1 = test_api_->GetBoundsByIndex(i); 975 const gfx::Rect& bounds1 = test_api_->GetBoundsByIndex(i);
977 const gfx::Rect& bounds2 = test_api_->GetBoundsByIndex(i + 1); 976 const gfx::Rect& bounds2 = test_api_->GetBoundsByIndex(i + 1);
978 EXPECT_FALSE(bounds1.Intersects(bounds2)); 977 EXPECT_FALSE(bounds1.Intersects(bounds2));
979 } 978 }
980 } 979 }
981 } 980 }
982 981
983 // Making sure the overflow bubble arrow correctly tracks with shelf position. 982 // Making sure the overflow bubble arrow correctly tracks with shelf position.
984 TEST_F(ShelfViewTest, OverflowArrowForShelfPosition) { 983 TEST_F(ShelfViewTest, OverflowArrowForShelfPosition) {
985 const ShelfAlignment kAlignments[] = { 984 const ShelfAlignment kAlignments[] = {
986 SHELF_ALIGNMENT_BOTTOM, SHELF_ALIGNMENT_LEFT, SHELF_ALIGNMENT_RIGHT, 985 SHELF_ALIGNMENT_BOTTOM, SHELF_ALIGNMENT_LEFT, SHELF_ALIGNMENT_RIGHT};
987 SHELF_ALIGNMENT_TOP};
988 986
989 // These must match what is expected for each alignment above. 987 // These must match what is expected for each alignment above.
990 const views::BubbleBorder::Arrow kArrows[] = { 988 const views::BubbleBorder::Arrow kArrows[] = {
991 views::BubbleBorder::BOTTOM_LEFT, views::BubbleBorder::LEFT_TOP, 989 views::BubbleBorder::BOTTOM_LEFT, views::BubbleBorder::LEFT_TOP,
992 views::BubbleBorder::RIGHT_TOP, views::BubbleBorder::TOP_LEFT}; 990 views::BubbleBorder::RIGHT_TOP};
993 991
994 for (int i = 0; i < 4; i++) { 992 for (size_t i = 0; i < arraysize(kAlignments); i++) {
995 shelf_view_->shelf()->SetAlignment(kAlignments[i]); 993 shelf_view_->shelf()->SetAlignment(kAlignments[i]);
996 994
997 // Make sure there are enough icons to trigger the overflow in new 995 // Make sure there are enough icons to trigger the overflow in new
998 // orientation. 996 // orientation.
999 AddButtonsUntilOverflow(); 997 AddButtonsUntilOverflow();
1000 test_api_->ShowOverflowBubble(); 998 test_api_->ShowOverflowBubble();
1001 ASSERT_TRUE(test_api_->overflow_bubble() && 999 ASSERT_TRUE(test_api_->overflow_bubble() &&
1002 test_api_->overflow_bubble()->IsShowing()); 1000 test_api_->overflow_bubble()->IsShowing());
1003 1001
1004 EXPECT_EQ(test_api_->overflow_bubble()->bubble_view()->arrow(), kArrows[i]); 1002 EXPECT_EQ(test_api_->overflow_bubble()->bubble_view()->arrow(), kArrows[i]);
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 test_api_->RunMessageLoopUntilAnimationsDone(); 1944 test_api_->RunMessageLoopUntilAnimationsDone();
1947 CheckAllItemsAreInBounds(); 1945 CheckAllItemsAreInBounds();
1948 } 1946 }
1949 1947
1950 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); 1948 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool());
1951 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, 1949 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest,
1952 testing::Bool()); 1950 testing::Bool());
1953 1951
1954 } // namespace test 1952 } // namespace test
1955 } // namespace ash 1953 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/shelf/shelf_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698