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

Side by Side Diff: ui/views/bubble/bubble_frame_view_unittest.cc

Issue 2840623002: Re-land 4ced9f3c7e9534b6b730d: Fix layout of BubbleFrameView when there's only a close button in th… (Closed)
Patch Set: Created 3 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 | « ui/views/bubble/bubble_frame_view.cc ('k') | ui/views/window/dialog_delegate_unittest.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 "ui/views/bubble/bubble_frame_view.h" 5 #include "ui/views/bubble/bubble_frame_view.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 TEST_F(BubbleFrameViewTest, GetBoundsForClientViewWithClose) { 138 TEST_F(BubbleFrameViewTest, GetBoundsForClientViewWithClose) {
139 TestBubbleFrameView frame(this); 139 TestBubbleFrameView frame(this);
140 // TestBubbleFrameView::GetWidget() is responsible for creating the widget and 140 // TestBubbleFrameView::GetWidget() is responsible for creating the widget and
141 // widget delegate at first call, so it is called here for that side-effect. 141 // widget delegate at first call, so it is called here for that side-effect.
142 ignore_result(frame.GetWidget()); 142 ignore_result(frame.GetWidget());
143 frame.widget_delegate()->SetShouldShowCloseButton(true); 143 frame.widget_delegate()->SetShouldShowCloseButton(true);
144 frame.ResetWindowControls(); 144 frame.ResetWindowControls();
145 EXPECT_EQ(kArrow, frame.bubble_border()->arrow()); 145 EXPECT_EQ(kArrow, frame.bubble_border()->arrow());
146 EXPECT_EQ(kColor, frame.bubble_border()->background_color()); 146 EXPECT_EQ(kColor, frame.bubble_border()->background_color());
147 147
148 int margin_x = frame.content_margins().left(); 148 gfx::Insets frame_insets = frame.GetInsets();
149 int margin_y = frame.content_margins().top() + 149 gfx::Insets border_insets = frame.bubble_border()->GetInsets();
150 frame.GetCloseButtonForTest()->height(); 150 EXPECT_EQ(border_insets.left() + frame_insets.left(),
151 gfx::Insets insets = frame.bubble_border()->GetInsets(); 151 frame.GetBoundsForClientView().x());
152 EXPECT_EQ(insets.left() + margin_x, frame.GetBoundsForClientView().x()); 152 EXPECT_EQ(border_insets.top() + frame_insets.top(),
153 EXPECT_EQ(insets.top() + margin_y, frame.GetBoundsForClientView().y()); 153 frame.GetBoundsForClientView().y());
154 } 154 }
155 155
156 // Tests that the arrow is mirrored as needed to better fit the screen. 156 // Tests that the arrow is mirrored as needed to better fit the screen.
157 TEST_F(BubbleFrameViewTest, GetUpdatedWindowBounds) { 157 TEST_F(BubbleFrameViewTest, GetUpdatedWindowBounds) {
158 TestBubbleFrameView frame(this); 158 TestBubbleFrameView frame(this);
159 gfx::Rect window_bounds; 159 gfx::Rect window_bounds;
160 160
161 gfx::Insets insets = frame.bubble_border()->GetInsets(); 161 gfx::Insets insets = frame.bubble_border()->GetInsets();
162 int xposition = 95 - insets.width(); 162 int xposition = 95 - insets.width();
163 163
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 maximum_rect.Inset(frame.bubble_border()->GetInsets()); 482 maximum_rect.Inset(frame.bubble_border()->GetInsets());
483 483
484 // Should ignore the contents view's maximum size and use the preferred size. 484 // Should ignore the contents view's maximum size and use the preferred size.
485 gfx::Size expected_size(kPreferredClientWidth + kExpectedAdditionalWidth, 485 gfx::Size expected_size(kPreferredClientWidth + kExpectedAdditionalWidth,
486 kPreferredClientHeight + kExpectedAdditionalHeight); 486 kPreferredClientHeight + kExpectedAdditionalHeight);
487 EXPECT_EQ(expected_size, maximum_rect.size()); 487 EXPECT_EQ(expected_size, maximum_rect.size());
488 #endif 488 #endif
489 } 489 }
490 490
491 } // namespace views 491 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_frame_view.cc ('k') | ui/views/window/dialog_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698