OLD | NEW |
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 Loading... |
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 |
OLD | NEW |