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

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

Issue 310753002: Add ability to set the border insets of a box layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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.h ('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 659f39e66e458cbdd2671b9100ebd4003c770e26..42f8f4272c66f019ed7c64b44aa6be79e0a198a5 100644
--- a/ui/views/layout/box_layout_unittest.cc
+++ b/ui/views/layout/box_layout_unittest.cc
@@ -55,6 +55,27 @@ TEST_F(BoxLayoutTest, AlignmentVertical) {
EXPECT_EQ(gfx::Rect(0, 10, 20, 10), v2->bounds());
}
+TEST_F(BoxLayoutTest, SetInsideBorderInsets) {
+ layout_.reset(new BoxLayout(BoxLayout::kHorizontal, 10, 20, 0));
+ View* v1 = new StaticSizedView(gfx::Size(10, 20));
+ host_->AddChildView(v1);
+ View* v2 = new StaticSizedView(gfx::Size(10, 10));
+ host_->AddChildView(v2);
+ EXPECT_EQ(gfx::Size(40, 60), layout_->GetPreferredSize(host_.get()));
+ host_->SetBounds(0, 0, 40, 60);
+ layout_->Layout(host_.get());
+ EXPECT_EQ(gfx::Rect(10, 20, 10, 20), v1->bounds());
+ EXPECT_EQ(gfx::Rect(20, 20, 10, 20), v2->bounds());
+
+ layout_->set_inside_border_insets(
+ gfx::Insets(5, 10, 15, 20));
+ EXPECT_EQ(gfx::Size(50, 40), layout_->GetPreferredSize(host_.get()));
+ host_->SetBounds(0, 0, 50, 40);
+ layout_->Layout(host_.get());
+ EXPECT_EQ(gfx::Rect(10, 5, 10, 20), v1->bounds());
+ EXPECT_EQ(gfx::Rect(20, 5, 10, 20), v2->bounds());
+}
+
TEST_F(BoxLayoutTest, Spacing) {
layout_.reset(new BoxLayout(BoxLayout::kHorizontal, 7, 7, 8));
View* v1 = new StaticSizedView(gfx::Size(10, 20));
« no previous file with comments | « ui/views/layout/box_layout.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698