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

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

Issue 2489953006: Utility routines for ng_units (Closed)
Patch Set: Added missing CORE_EXPORT Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_units.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ng/ng_units_test.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_units_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_units_test.cc
index c353df5259c21872a556e7c34a7a38a9afb2b408..10d4834456411bd1f4a4bd3bb2f2f61b808a836c 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_units_test.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_units_test.cc
@@ -69,6 +69,37 @@ TEST(NGUnitsTest, ConvertLogicalOffsetToPhysicalOffset) {
EXPECT_EQ(LayoutUnit(20), offset.top);
}
+// Ideally, this would be tested by NGBoxStrut::ConvertToPhysical, but
+// this has not been implemented yet.
+TEST(NGUnitsTest, ConvertPhysicalStrutToLogical) {
+ LayoutUnit left{5}, right{10}, top{15}, bottom{20};
+ NGPhysicalBoxStrut physical{left, right, top, bottom};
+
+ NGBoxStrut logical = physical.ConvertToLogical(HorizontalTopBottom, LTR);
+ EXPECT_EQ(left, logical.inline_start);
+ EXPECT_EQ(top, logical.block_start);
+
+ logical = physical.ConvertToLogical(HorizontalTopBottom, RTL);
+ EXPECT_EQ(right, logical.inline_start);
+ EXPECT_EQ(top, logical.block_start);
+
+ logical = physical.ConvertToLogical(VerticalLeftRight, LTR);
+ EXPECT_EQ(top, logical.inline_start);
+ EXPECT_EQ(left, logical.block_start);
+
+ logical = physical.ConvertToLogical(VerticalLeftRight, RTL);
+ EXPECT_EQ(bottom, logical.inline_start);
+ EXPECT_EQ(left, logical.block_start);
+
+ logical = physical.ConvertToLogical(VerticalRightLeft, LTR);
+ EXPECT_EQ(top, logical.inline_start);
+ EXPECT_EQ(right, logical.block_start);
+
+ logical = physical.ConvertToLogical(VerticalRightLeft, RTL);
+ EXPECT_EQ(bottom, logical.inline_start);
+ EXPECT_EQ(right, logical.block_start);
+}
+
} // namespace
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_units.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698