| 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 |
| 11 namespace views { | 11 namespace views { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class BoxLayoutTest : public testing::Test { | 15 class BoxLayoutTest : public testing::Test { |
| 16 public: | 16 public: |
| 17 virtual void SetUp() override { | 17 void SetUp() override { host_.reset(new View); } |
| 18 host_.reset(new View); | |
| 19 } | |
| 20 | 18 |
| 21 scoped_ptr<View> host_; | 19 scoped_ptr<View> host_; |
| 22 }; | 20 }; |
| 23 | 21 |
| 24 } // namespace | 22 } // namespace |
| 25 | 23 |
| 26 TEST_F(BoxLayoutTest, Empty) { | 24 TEST_F(BoxLayoutTest, Empty) { |
| 27 BoxLayout* layout = new BoxLayout(BoxLayout::kHorizontal, 10, 10, 20); | 25 BoxLayout* layout = new BoxLayout(BoxLayout::kHorizontal, 10, 10, 20); |
| 28 host_->SetLayoutManager(layout); | 26 host_->SetLayoutManager(layout); |
| 29 EXPECT_EQ(gfx::Size(20, 20), layout->GetPreferredSize(host_.get())); | 27 EXPECT_EQ(gfx::Size(20, 20), layout->GetPreferredSize(host_.get())); |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 BoxLayout* layout = new BoxLayout(BoxLayout::kHorizontal, 0, 0, 0); | 602 BoxLayout* layout = new BoxLayout(BoxLayout::kHorizontal, 0, 0, 0); |
| 605 host_->SetLayoutManager(layout); | 603 host_->SetLayoutManager(layout); |
| 606 View* v1 = new StaticSizedView(gfx::Size(20, 10)); | 604 View* v1 = new StaticSizedView(gfx::Size(20, 10)); |
| 607 host_->AddChildView(v1); | 605 host_->AddChildView(v1); |
| 608 layout->set_minimum_cross_axis_size(30); | 606 layout->set_minimum_cross_axis_size(30); |
| 609 | 607 |
| 610 EXPECT_EQ(gfx::Size(20, 30), layout->GetPreferredSize(host_.get())); | 608 EXPECT_EQ(gfx::Size(20, 30), layout->GetPreferredSize(host_.get())); |
| 611 } | 609 } |
| 612 | 610 |
| 613 } // namespace views | 611 } // namespace views |
| OLD | NEW |