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

Unified Diff: ui/views/bubble/bubble_frame_view_unittest.cc

Issue 2148963002: BubbleFrameView: add top padding even when close button is hidden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix CrOS build Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/bubble/bubble_frame_view_unittest.cc
diff --git a/ui/views/bubble/bubble_frame_view_unittest.cc b/ui/views/bubble/bubble_frame_view_unittest.cc
index 9e338c563d8b20b58956405fa41e23649480f43c..c8d4ebf8ca0daa789b6cc686ff18e72cfc3a9ef3 100644
--- a/ui/views/bubble/bubble_frame_view_unittest.cc
+++ b/ui/views/bubble/bubble_frame_view_unittest.cc
@@ -12,6 +12,7 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/bubble/bubble_border.h"
+#include "ui/views/controls/button/image_button.h"
#include "ui/views/test/test_views.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/widget/widget.h"
@@ -36,7 +37,8 @@ const int kPreferredClientHeight = 250;
// These account for non-client areas like the title bar, footnote etc. However
// these do not take the bubble border into consideration.
const int kExpectedAdditionalWidth = 12;
-const int kExpectedAdditionalHeight = 12;
+// 12 for the builtin margin, 14 for the close button margin
+const int kExpectedAdditionalHeight = 12 + 14;
class TestBubbleFrameViewWidgetDelegate : public WidgetDelegate {
public:
@@ -119,9 +121,11 @@ TEST_F(BubbleFrameViewTest, GetBoundsForClientView) {
int margin_x = frame.content_margins().left();
int margin_y = frame.content_margins().top();
+ int close_y = frame.GetCloseButtonForTest()->height();
msw 2016/07/21 19:07:17 nit: close_height
gfx::Insets insets = frame.bubble_border()->GetInsets();
EXPECT_EQ(insets.left() + margin_x, frame.GetBoundsForClientView().x());
- EXPECT_EQ(insets.top() + margin_y, frame.GetBoundsForClientView().y());
+ EXPECT_EQ(insets.top() + margin_y + close_y,
+ frame.GetBoundsForClientView().y());
}
// Tests that the arrow is mirrored as needed to better fit the screen.
@@ -437,6 +441,9 @@ TEST_F(BubbleFrameViewTest, GetMinimumSize) {
// Expect that a border has been added to the minimum size.
minimum_rect.Inset(frame.bubble_border()->GetInsets());
+ ImageButton* button = frame.GetCloseButtonForTest();
msw 2016/07/21 19:07:18 nit: inline below.
+ EXPECT_EQ(button->height(), 14);
+ EXPECT_EQ(nullptr, frame.GetCloseButtonForTest()->border());
gfx::Size expected_size(kMinimumClientWidth + kExpectedAdditionalWidth,
kMinimumClientHeight + kExpectedAdditionalHeight);
EXPECT_EQ(expected_size, minimum_rect.size());
« ui/views/bubble/bubble_frame_view.cc ('K') | « ui/views/bubble/bubble_frame_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698