Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc |
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc |
| index 5c1484acbdfa447f19ba07898b96fcf7195d78c2..d01ff4755e7b967aa27926583f57eac3925362d5 100644 |
| --- a/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc |
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc |
| @@ -193,5 +193,41 @@ TEST_F(NGLengthUtilsTest, testMargins) { |
| EXPECT_EQ(LayoutUnit(22), margins.inline_start); |
| } |
| +TEST_F(NGLengthUtilsTest, testBorders) { |
| + style_->setBorderTopWidth(1); |
| + style_->setBorderRightWidth(2); |
| + style_->setBorderBottomWidth(3); |
| + style_->setBorderLeftWidth(4); |
| + style_->setBorderTopStyle(BorderStyleSolid); |
| + style_->setBorderRightStyle(BorderStyleSolid); |
| + style_->setBorderBottomStyle(BorderStyleSolid); |
| + style_->setBorderLeftStyle(BorderStyleSolid); |
| + style_->setWritingMode(LeftToRightWritingMode); |
| + |
| + NGBoxStrut borders = computeBorders(*style_); |
| + |
| + EXPECT_EQ(LayoutUnit(4), borders.block_start); |
| + EXPECT_EQ(LayoutUnit(3), borders.inline_end); |
| + EXPECT_EQ(LayoutUnit(2), borders.block_end); |
| + EXPECT_EQ(LayoutUnit(1), borders.inline_start); |
| +} |
| + |
| +TEST_F(NGLengthUtilsTest, testPadding) { |
| + style_->setPaddingTop(Length(10, Percent)); |
| + style_->setPaddingRight(Length(52, Fixed)); |
|
Gleb Lanbin
2016/08/30 20:18:34
.nit it's better to use constants.
cbiesinger
2016/08/30 20:19:54
To use the same constant for the setting and testi
|
| + style_->setPaddingBottom(Length(Auto)); |
| + style_->setPaddingLeft(Length(11, Percent)); |
| + style_->setWritingMode(RightToLeftWritingMode); |
| + |
| + NGConstraintSpace* constraintSpace(ConstructConstraintSpace(200, 300)); |
| + |
| + NGBoxStrut padding = computePadding(*constraintSpace, *style_); |
| + |
| + EXPECT_EQ(LayoutUnit(52), padding.block_start); |
| + EXPECT_EQ(LayoutUnit(), padding.inline_end); |
| + EXPECT_EQ(LayoutUnit(22), padding.block_end); |
| + EXPECT_EQ(LayoutUnit(20), padding.inline_start); |
| +} |
| + |
| } // namespace |
| } // namespace blink |