Add test case covering padding on child
Summary: Add coverage exposed by https://github.com/facebook/css-layout/pull/262 Reviewed By: splhack Differential Revision: D4247282 fbshipit-source-id: 25500bcfced58a8095665b73eeebca8d1c266a17
This commit is contained in:
committed by
Facebook Github Bot
parent
b32b6029de
commit
7d74e1cb66
@@ -192,3 +192,45 @@ TEST(CSSLayoutTest, padding_center_child) {
|
||||
|
||||
CSSNodeFreeRecursive(root);
|
||||
}
|
||||
|
||||
TEST(CSSLayoutTest, child_with_padding_align_end) {
|
||||
const CSSNodeRef root = CSSNodeNew();
|
||||
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
|
||||
CSSNodeStyleSetAlignItems(root, CSSAlignFlexEnd);
|
||||
CSSNodeStyleSetWidth(root, 200);
|
||||
CSSNodeStyleSetHeight(root, 200);
|
||||
|
||||
const CSSNodeRef root_child0 = CSSNodeNew();
|
||||
CSSNodeStyleSetPadding(root_child0, CSSEdgeLeft, 20);
|
||||
CSSNodeStyleSetPadding(root_child0, CSSEdgeTop, 20);
|
||||
CSSNodeStyleSetPadding(root_child0, CSSEdgeRight, 20);
|
||||
CSSNodeStyleSetPadding(root_child0, CSSEdgeBottom, 20);
|
||||
CSSNodeStyleSetWidth(root_child0, 100);
|
||||
CSSNodeStyleSetHeight(root_child0, 100);
|
||||
CSSNodeInsertChild(root, root_child0, 0);
|
||||
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(200, CSSNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(200, CSSNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
|
||||
|
||||
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(200, CSSNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(200, CSSNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
|
||||
|
||||
CSSNodeFreeRecursive(root);
|
||||
}
|
||||
|
Reference in New Issue
Block a user