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

Unified Diff: ui/views/layout/box_layout_unittest.cc

Issue 9465042: views: Add option in BoxLayout to spread blank space among the child views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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/layout/box_layout.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/layout/box_layout_unittest.cc
diff --git a/ui/views/layout/box_layout_unittest.cc b/ui/views/layout/box_layout_unittest.cc
index dcf3227070e2e16bca2499e68a4941f5b504579b..2f6bf8ac1647ac8f9e4309deedd629da4cf8ad60 100644
--- a/ui/views/layout/box_layout_unittest.cc
+++ b/ui/views/layout/box_layout_unittest.cc
@@ -109,3 +109,20 @@ TEST_F(BoxLayoutTest, InvisibleChild) {
layout_->Layout(host_.get());
EXPECT_EQ(gfx::Rect(10, 10, 10, 10), v2->bounds());
}
+
+TEST_F(BoxLayoutTest, DistributeEmptySpace) {
+ layout_.reset(
+ new views::BoxLayout(views::BoxLayout::kHorizontal, 10, 10, 10));
+ layout_->set_spread_blank_space(true);
+
+ views::View* v1 = new StaticSizedView(gfx::Size(20, 20));
+ host_->AddChildView(v1);
+ views::View* v2 = new StaticSizedView(gfx::Size(10, 10));
+ host_->AddChildView(v2);
+ EXPECT_EQ(gfx::Size(60, 40), layout_->GetPreferredSize(host_.get()));
+
+ host_->SetBounds(0, 0, 100, 40);
+ layout_->Layout(host_.get());
+ EXPECT_EQ(gfx::Rect(10, 10, 40, 20).ToString(), v1->bounds().ToString());
+ EXPECT_EQ(gfx::Rect(60, 10, 30, 20).ToString(), v2->bounds().ToString());
+}
« no previous file with comments | « ui/views/layout/box_layout.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698