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

Side by Side Diff: ui/views/layout/box_layout_unittest.cc

Issue 494273003: Add a minimum cross axis size to BoxLayout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initialize Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/layout/box_layout.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/layout/box_layout.h" 5 #include "ui/views/layout/box_layout.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/views/test/test_views.h" 8 #include "ui/views/test/test_views.h"
9 #include "ui/views/view.h" 9 #include "ui/views/view.h"
10 10
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 layout->SetFlexForView(v1, 1); 583 layout->SetFlexForView(v1, 1);
584 layout->SetFlexForView(v2, 1); 584 layout->SetFlexForView(v2, 1);
585 layout->SetFlexForView(v3, 1); 585 layout->SetFlexForView(v3, 1);
586 host_->Layout(); 586 host_->Layout();
587 EXPECT_EQ(gfx::Rect(0, 0, 20, 3).ToString(), v1->bounds().ToString()); 587 EXPECT_EQ(gfx::Rect(0, 0, 20, 3).ToString(), v1->bounds().ToString());
588 EXPECT_EQ(gfx::Rect(0, 3, 20, 14).ToString(), v2->bounds().ToString()); 588 EXPECT_EQ(gfx::Rect(0, 3, 20, 14).ToString(), v2->bounds().ToString());
589 EXPECT_EQ(gfx::Rect(0, 17, 20, 3).ToString(), v3->bounds().ToString()); 589 EXPECT_EQ(gfx::Rect(0, 17, 20, 3).ToString(), v3->bounds().ToString());
590 } 590 }
591 } 591 }
592 592
593 TEST_F(BoxLayoutTest, MinimumCrossAxisVertical) {
594 BoxLayout* layout = new BoxLayout(BoxLayout::kVertical, 0, 0, 0);
595 host_->SetLayoutManager(layout);
596 View* v1 = new StaticSizedView(gfx::Size(20, 10));
597 host_->AddChildView(v1);
598 layout->set_minimum_cross_axis_size(30);
599
600 EXPECT_EQ(gfx::Size(30, 10), layout->GetPreferredSize(host_.get()));
601 }
602
603 TEST_F(BoxLayoutTest, MinimumCrossAxisHorizontal) {
604 BoxLayout* layout = new BoxLayout(BoxLayout::kHorizontal, 0, 0, 0);
605 host_->SetLayoutManager(layout);
606 View* v1 = new StaticSizedView(gfx::Size(20, 10));
607 host_->AddChildView(v1);
608 layout->set_minimum_cross_axis_size(30);
609
610 EXPECT_EQ(gfx::Size(20, 30), layout->GetPreferredSize(host_.get()));
611 }
612
593 } // namespace views 613 } // namespace views
OLDNEW
« 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