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 f65529e501601baf1dfbfce8ef21eecb7cb517e3..93ea4e504dcdbcc954206d042dd9b3d8c221dcf1 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 |
@@ -5,6 +5,7 @@ |
#include "core/layout/ng/ng_length_utils.h" |
#include "core/layout/ng/ng_constraint_space.h" |
+#include "core/layout/ng/ng_margin_strut.h" |
#include "core/style/ComputedStyle.h" |
#include "platform/CalculationValue.h" |
#include "platform/LayoutUnit.h" |
@@ -158,5 +159,21 @@ TEST_F(NGLengthUtilsTest, testComputeBlockSizeForFragment) { |
// TODO(layout-ng): test {min,max}-content on max-height. |
} |
+TEST_F(NGLengthUtilsTest, testMargins) { |
+ style_->setMarginTop(Length(10, Percent)); |
+ style_->setMarginRight(Length(52, Fixed)); |
+ style_->setMarginBottom(Length(Auto)); |
+ style_->setMarginLeft(Length(11, Percent)); |
+ |
+ NGConstraintSpace constraintSpace(constructConstraintSpace(200, 300)); |
+ |
+ NGBoxMargins margins = computeMargins(constraintSpace, *style_); |
+ |
+ EXPECT_EQ(LayoutUnit(20), margins.blockStart); |
+ EXPECT_EQ(LayoutUnit(52), margins.inlineEnd); |
+ EXPECT_EQ(LayoutUnit(), margins.blockEnd); |
+ EXPECT_EQ(LayoutUnit(22), margins.inlineStart); |
+} |
+ |
} // namespace |
} // namespace blink |