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

Unified Diff: ui/views/controls/scroll_view_unittest.cc

Issue 2324043002: Bug Fix: Scroll View Shows Unnecessary Scrollbar (Closed)
Patch Set: Unittest Created 4 years, 3 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
« no previous file with comments | « ui/views/controls/scroll_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/scroll_view_unittest.cc
diff --git a/ui/views/controls/scroll_view_unittest.cc b/ui/views/controls/scroll_view_unittest.cc
index dd8b23228231a94dc13acec0adfe218f5e6a4e05..a5421892f11666483897485caeac4c7a49bd6ea5 100644
--- a/ui/views/controls/scroll_view_unittest.cc
+++ b/ui/views/controls/scroll_view_unittest.cc
@@ -242,6 +242,23 @@ TEST(ScrollViewTest, ViewportSizedToFit) {
EXPECT_EQ("0,0 100x100", contents->parent()->bounds().ToString());
}
+// Verifies the viewport and content is sized to fit the available space for
+// bounded scroll view.
+TEST(ScrollViewTest, BoundedViewportSizedToFit) {
+ ScrollView scroll_view;
+ View* contents = new View;
+ scroll_view.SetContents(contents);
+ scroll_view.ClipHeightTo(100, 200);
+ scroll_view.SetBoundsRect(gfx::Rect(0, 0, 100, 100));
+ scroll_view.SetBorder(Border::CreateSolidBorder(2, 0));
+ scroll_view.Layout();
+ EXPECT_EQ("2,2 96x96", contents->parent()->bounds().ToString());
+
+ // Make sure the width of |contents| is set properly not to overflow the
+ // viewport.
+ EXPECT_EQ(96, contents->width());
+}
+
// Verifies the scrollbars are added as necessary.
// If on Mac, test the non-overlay scrollbars.
TEST(ScrollViewTest, ScrollBars) {
« no previous file with comments | « ui/views/controls/scroll_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698