Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1126)

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc

Issue 2289353002: [layoutng] Add methods to compute border and padding (Closed)
Patch Set: better enum name Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
+ 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc ('k') | third_party/WebKit/Source/core/layout/ng/ng_units.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698