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

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

Issue 2189123002: BubbleFrameView: add padding if platform dislikes close buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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..5b058fa06e1fc591d14be62eab5d226666dd6dee 100644
--- a/ui/views/bubble/bubble_frame_view_unittest.cc
+++ b/ui/views/bubble/bubble_frame_view_unittest.cc
@@ -36,7 +36,15 @@ 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;
+#if defined(OS_MACOSX)
+// On Mac, since the close button is never visible, dialogs get an extra top
+// inset equal to the normal height of the close button, but this is considered
+// part of the inset, while it isn't on other platforms, so on Mac we have to
+// expect more additional height. Blech.
+const int kExpectedAdditionalHeight = 12 + 16;
+#else
const int kExpectedAdditionalHeight = 12;
+#endif
class TestBubbleFrameViewWidgetDelegate : public WidgetDelegate {
public:
@@ -120,6 +128,11 @@ TEST_F(BubbleFrameViewTest, GetBoundsForClientView) {
int margin_x = frame.content_margins().left();
int margin_y = frame.content_margins().top();
gfx::Insets insets = frame.bubble_border()->GetInsets();
+#if defined(OS_MACOSX)
+ // The insets are larger on Mac, to make up for the padding the close button
+ // would normally supply.
+ insets += gfx::Insets(16, 0, 0, 0);
+#endif
EXPECT_EQ(insets.left() + margin_x, frame.GetBoundsForClientView().x());
EXPECT_EQ(insets.top() + margin_y, frame.GetBoundsForClientView().y());
}
« 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