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

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

Issue 1422703004: BoxLayout: Added set_collapse_when_hidden(), like views::Label. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@exclusiveaccess-minor-refactor
Patch Set: Created 5 years, 2 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
« ui/views/layout/box_layout.cc ('K') | « 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 59866b14d1034658a182963e4aaf351094b315a3..e2091963727ad9bfc69d5e5ab14b0478df26018c 100644
--- a/ui/views/layout/box_layout_unittest.cc
+++ b/ui/views/layout/box_layout_unittest.cc
@@ -133,6 +133,18 @@ TEST_F(BoxLayoutTest, NoSpace) {
EXPECT_EQ(gfx::Rect(0, 0, 0, 0), childView->bounds());
}
+TEST_F(BoxLayoutTest, InvisibleHost) {
+ BoxLayout* layout = new BoxLayout(BoxLayout::kHorizontal, 10, 10, 20);
+ host_->SetLayoutManager(layout);
+ host_->SetVisible(false);
+ // No collapse_when_hidden; expect full size.
+ EXPECT_EQ(gfx::Size(20, 20), layout->GetPreferredSize(host_.get()));
+
+ // Set collapse_when_hidden; expect 0x0.
+ layout->set_collapse_when_hidden(true);
+ EXPECT_EQ(gfx::Size(), layout->GetPreferredSize(host_.get()));
+}
+
TEST_F(BoxLayoutTest, InvisibleChild) {
BoxLayout* layout = new BoxLayout(BoxLayout::kHorizontal, 10, 10, 10);
host_->SetLayoutManager(layout);
« ui/views/layout/box_layout.cc ('K') | « ui/views/layout/box_layout.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698