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

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

Issue 1866403005: Fix rtl shelf overflow bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small review fixes (and merge) Created 4 years, 7 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/overflow_bubble_view.cc ('k') | ash/test/overflow_bubble_view_test_api.h » ('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 <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 #include "base/time/time.h" 39 #include "base/time/time.h"
40 #include "ui/aura/test/aura_test_base.h" 40 #include "ui/aura/test/aura_test_base.h"
41 #include "ui/aura/window.h" 41 #include "ui/aura/window.h"
42 #include "ui/aura/window_event_dispatcher.h" 42 #include "ui/aura/window_event_dispatcher.h"
43 #include "ui/compositor/layer.h" 43 #include "ui/compositor/layer.h"
44 #include "ui/events/event.h" 44 #include "ui/events/event.h"
45 #include "ui/events/event_constants.h" 45 #include "ui/events/event_constants.h"
46 #include "ui/events/event_utils.h" 46 #include "ui/events/event_utils.h"
47 #include "ui/events/test/event_generator.h" 47 #include "ui/events/test/event_generator.h"
48 #include "ui/gfx/geometry/point.h" 48 #include "ui/gfx/geometry/point.h"
49 #include "ui/views/bubble/bubble_frame_view.h"
49 #include "ui/views/view_model.h" 50 #include "ui/views/view_model.h"
50 #include "ui/views/widget/widget.h" 51 #include "ui/views/widget/widget.h"
51 #include "ui/views/widget/widget_delegate.h" 52 #include "ui/views/widget/widget_delegate.h"
52 #include "ui/wm/core/coordinate_conversion.h" 53 #include "ui/wm/core/coordinate_conversion.h"
53 54
54 namespace ash { 55 namespace ash {
55 namespace test { 56 namespace test {
56 57
57 //////////////////////////////////////////////////////////////////////////////// 58 ////////////////////////////////////////////////////////////////////////////////
58 // ShelfIconObserver tests. 59 // ShelfIconObserver tests.
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 } 977 }
977 978
978 const gfx::Rect& bounds1 = test_api_->GetBoundsByIndex(i); 979 const gfx::Rect& bounds1 = test_api_->GetBoundsByIndex(i);
979 const gfx::Rect& bounds2 = test_api_->GetBoundsByIndex(i + 1); 980 const gfx::Rect& bounds2 = test_api_->GetBoundsByIndex(i + 1);
980 EXPECT_FALSE(bounds1.Intersects(bounds2)); 981 EXPECT_FALSE(bounds1.Intersects(bounds2));
981 } 982 }
982 } 983 }
983 } 984 }
984 985
985 // Making sure the overflow bubble arrow correctly tracks with shelf position. 986 // Making sure the overflow bubble arrow correctly tracks with shelf position.
986 TEST_F(ShelfViewTest, OverflowArrowForShelfPosition) { 987 TEST_P(ShelfViewTextDirectionTest, OverflowArrowForShelfPosition) {
987 const wm::ShelfAlignment kAlignments[] = { 988 const wm::ShelfAlignment kAlignments[] = {
988 wm::SHELF_ALIGNMENT_BOTTOM, wm::SHELF_ALIGNMENT_LEFT, 989 wm::SHELF_ALIGNMENT_BOTTOM, wm::SHELF_ALIGNMENT_LEFT,
989 wm::SHELF_ALIGNMENT_RIGHT, wm::SHELF_ALIGNMENT_BOTTOM_LOCKED, 990 wm::SHELF_ALIGNMENT_RIGHT, wm::SHELF_ALIGNMENT_BOTTOM_LOCKED,
990 }; 991 };
991 992
992 // These must match what is expected for each alignment above. 993 // These must match what is expected for each alignment above.
993 const views::BubbleBorder::Arrow kArrows[] = { 994 const views::BubbleBorder::Arrow kArrows[] = {
994 views::BubbleBorder::BOTTOM_LEFT, views::BubbleBorder::LEFT_TOP, 995 views::BubbleBorder::BOTTOM_LEFT, views::BubbleBorder::LEFT_TOP,
995 views::BubbleBorder::RIGHT_TOP, views::BubbleBorder::BOTTOM_LEFT, 996 views::BubbleBorder::RIGHT_TOP, views::BubbleBorder::BOTTOM_LEFT,
996 }; 997 };
997 998
998 for (size_t i = 0; i < arraysize(kAlignments); i++) { 999 for (size_t i = 0; i < arraysize(kAlignments); i++) {
999 shelf_view_->shelf()->SetAlignment(kAlignments[i]); 1000 shelf_view_->shelf()->SetAlignment(kAlignments[i]);
1000 1001
1001 // Make sure there are enough icons to trigger the overflow in new 1002 // Make sure there are enough icons to trigger the overflow in new
1002 // orientation. 1003 // orientation.
1003 AddButtonsUntilOverflow(); 1004 AddButtonsUntilOverflow();
1004 test_api_->ShowOverflowBubble(); 1005 test_api_->ShowOverflowBubble();
1005 ASSERT_TRUE(test_api_->overflow_bubble() && 1006 ASSERT_TRUE(test_api_->overflow_bubble() &&
1006 test_api_->overflow_bubble()->IsShowing()); 1007 test_api_->overflow_bubble()->IsShowing());
1007 1008
1008 EXPECT_EQ(test_api_->overflow_bubble()->bubble_view()->arrow(), kArrows[i]); 1009 EXPECT_EQ(kArrows[i], test_api_->overflow_bubble()->bubble_view()->arrow());
1010 OverflowBubbleViewTestAPI bubble_view_api(
1011 test_api_->overflow_bubble()->bubble_view());
1012 EXPECT_EQ(kArrows[i],
1013 bubble_view_api.GetBubbleFrameView()->bubble_border()->arrow());
1009 } 1014 }
1010 } 1015 }
1011 1016
1012 // Adds button until overflow then removes first added one. Verifies that 1017 // Adds button until overflow then removes first added one. Verifies that
1013 // the last added one changes from invisible to visible and overflow 1018 // the last added one changes from invisible to visible and overflow
1014 // chevron is gone. 1019 // chevron is gone.
1015 TEST_F(ShelfViewTest, RemoveButtonRevealsOverflowed) { 1020 TEST_F(ShelfViewTest, RemoveButtonRevealsOverflowed) {
1016 // All buttons should be visible. 1021 // All buttons should be visible.
1017 ASSERT_EQ(test_api_->GetButtonCount(), 1022 ASSERT_EQ(test_api_->GetButtonCount(),
1018 test_api_->GetLastVisibleIndex() + 1); 1023 test_api_->GetLastVisibleIndex() + 1);
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1951 test_api_->RunMessageLoopUntilAnimationsDone(); 1956 test_api_->RunMessageLoopUntilAnimationsDone();
1952 CheckAllItemsAreInBounds(); 1957 CheckAllItemsAreInBounds();
1953 } 1958 }
1954 1959
1955 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); 1960 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool());
1956 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, 1961 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest,
1957 testing::Bool()); 1962 testing::Bool());
1958 1963
1959 } // namespace test 1964 } // namespace test
1960 } // namespace ash 1965 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/overflow_bubble_view.cc ('k') | ash/test/overflow_bubble_view_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698