| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/layout/ng/ng_block_node.h" | 5 #include "core/layout/ng/ng_block_node.h" |
| 6 | 6 |
| 7 #include "core/layout/ng/ng_box_fragment.h" | 7 #include "core/layout/ng/ng_box_fragment.h" |
| 8 #include "core/layout/ng/ng_min_max_content_size.h" | |
| 9 #include "core/style/ComputedStyle.h" | 8 #include "core/style/ComputedStyle.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 10 |
| 12 namespace blink { | 11 namespace blink { |
| 13 namespace { | 12 namespace { |
| 14 class NGBlockNodeForTest : public ::testing::Test { | 13 class NGBlockNodeForTest : public ::testing::Test { |
| 15 protected: | 14 protected: |
| 16 void SetUp() override { style_ = ComputedStyle::create(); } | 15 void SetUp() override { style_ = ComputedStyle::create(); } |
| 17 | 16 |
| 18 RefPtr<ComputedStyle> style_; | 17 RefPtr<ComputedStyle> style_; |
| 19 }; | 18 }; |
| 20 | 19 |
| 21 TEST_F(NGBlockNodeForTest, MinAndMaxContent) { | 20 TEST_F(NGBlockNodeForTest, MinAndMaxContent) { |
| 22 const int kWidth = 30; | 21 const int kWidth = 30; |
| 23 | 22 |
| 24 RefPtr<ComputedStyle> first_style = ComputedStyle::create(); | 23 RefPtr<ComputedStyle> first_style = ComputedStyle::create(); |
| 25 first_style->setWidth(Length(kWidth, Fixed)); | 24 first_style->setWidth(Length(kWidth, Fixed)); |
| 26 NGBlockNode* first_child = new NGBlockNode(first_style.get()); | 25 NGBlockNode* first_child = new NGBlockNode(first_style.get()); |
| 27 | 26 |
| 28 NGBlockNode* box = new NGBlockNode(style_.get()); | 27 NGBlockNode* box = new NGBlockNode(style_.get()); |
| 29 box->SetFirstChild(first_child); | 28 box->SetFirstChild(first_child); |
| 30 | 29 |
| 31 MinMaxContentSize sizes = box->ComputeMinMaxContentSize(); | 30 MinAndMaxContentSizes sizes = box->ComputeMinAndMaxContentSizes(); |
| 32 EXPECT_EQ(LayoutUnit(kWidth), sizes.min_content); | 31 EXPECT_EQ(LayoutUnit(kWidth), sizes.min_content); |
| 33 EXPECT_EQ(LayoutUnit(kWidth), sizes.max_content); | 32 EXPECT_EQ(LayoutUnit(kWidth), sizes.max_content); |
| 34 } | 33 } |
| 35 } // namespace | 34 } // namespace |
| 36 } // namespace blink | 35 } // namespace blink |
| OLD | NEW |