Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc |
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc |
| index a7755c88adc7fd546316456eea7a3294c18accb1..6014802c24e55065543eea66769f4baccb3e6833 100644 |
| --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc |
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc |
| @@ -402,5 +402,28 @@ TEST_F(NGBlockLayoutAlgorithmTest, BorderAndPadding) { |
| EXPECT_EQ(kBorderTop + kPaddingTop, child->TopOffset()); |
| EXPECT_EQ(kBorderLeft + kPaddingLeft, child->LeftOffset()); |
| } |
| + |
| +TEST_F(NGBlockLayoutAlgorithmTest, PercentageSize) { |
| + const int kPaddingLeft = 10; |
| + const int kWidth = 30; |
| + style_->setWidth(Length(kWidth, Fixed)); |
| + style_->setPaddingLeft(Length(kPaddingLeft, Fixed)); |
| + |
| + RefPtr<ComputedStyle> first_style = ComputedStyle::create(); |
| + first_style->setWidth(Length(40, Percent)); |
| + NGBox* first_child = new NGBox(first_style.get()); |
| + |
| + auto* space = |
| + new NGConstraintSpace(HorizontalTopBottom, LeftToRight, |
| + NGLogicalSize(LayoutUnit(100), NGSizeIndefinite)); |
| + NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child); |
| + |
| + EXPECT_EQ(frag->Width(), LayoutUnit(kWidth + kPaddingLeft)); |
| + EXPECT_EQ(frag->Type(), NGPhysicalFragmentBase::FragmentBox); |
| + ASSERT_EQ(frag->Children().size(), 1UL); |
| + |
| + const NGPhysicalFragmentBase* child = frag->Children()[0]; |
| + EXPECT_EQ(child->Width(), LayoutUnit(12)); |
|
eae
2016/09/20 08:09:38
You might want an EXPECT_EQ(frag->Children().size(
cbiesinger
2016/09/20 13:43:37
There's already an ASSERT_EQ for that above.
|
| +} |
| } // namespace |
| } // namespace blink |