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

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

Issue 462373002: Allow the native theme to paint the corner between scrollbars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make the test a friend Created 6 years, 4 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 8f34377553fce576748fd8655a610df69630e3a8..a2cba6ffe6d2ddfce054d3b4348b61e27b6f63cb 100644
--- a/ui/views/controls/scroll_view_unittest.cc
+++ b/ui/views/controls/scroll_view_unittest.cc
@@ -334,4 +334,45 @@ TEST(ScrollViewTest, ClipHeightToScrollbarUsesWidth) {
EXPECT_EQ(gfx::Size(kWidth, kMaxHeight), scroll_view.size());
}
+TEST(ScrollViewTest, CornerViewVisibility) {
+ ScrollView scroll_view;
+ View* contents = new View;
+ scroll_view.SetContents(contents);
+ scroll_view.SetBoundsRect(gfx::Rect(0, 0, 100, 100));
+ View* corner_view = scroll_view.corner_view_;
+
+ // Corner view should be visible when both scrollbars are visible.
+ contents->SetBounds(0, 0, 200, 200);
+ scroll_view.Layout();
+ EXPECT_EQ(&scroll_view, corner_view->parent());
+ EXPECT_TRUE(corner_view->visible());
+
+ // Corner view should be aligned to the scrollbars.
+ EXPECT_EQ(scroll_view.vertical_scroll_bar()->x(), corner_view->x());
+ EXPECT_EQ(scroll_view.horizontal_scroll_bar()->y(), corner_view->y());
+ EXPECT_EQ(scroll_view.GetScrollBarWidth(), corner_view->width());
+ EXPECT_EQ(scroll_view.GetScrollBarHeight(), corner_view->height());
+
+ // Corner view should be removed when only the vertical scrollbar is visible.
+ contents->SetBounds(0, 0, 50, 200);
+ scroll_view.Layout();
+ EXPECT_FALSE(corner_view->parent());
+
+ // ... or when only the horizontal scrollbar is visible.
+ contents->SetBounds(0, 0, 200, 50);
+ scroll_view.Layout();
+ EXPECT_FALSE(corner_view->parent());
+
+ // ... or when no scrollbar is visible.
+ contents->SetBounds(0, 0, 50, 50);
+ scroll_view.Layout();
+ EXPECT_FALSE(corner_view->parent());
+
+ // Corner view should reappear when both scrollbars reappear.
+ contents->SetBounds(0, 0, 200, 200);
+ scroll_view.Layout();
+ EXPECT_EQ(&scroll_view, corner_view->parent());
+ EXPECT_TRUE(corner_view->visible());
+}
+
} // namespace views
« 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