Fix position on root node with RTL direction
Summary: If the root node has a position and we have a RTL layout, that position must be like LTR direction. See #477. Closes https://github.com/facebook/yoga/pull/502 Differential Revision: D4867144 Pulled By: emilsjolander fbshipit-source-id: b5ad3d87e7054090da12d7665a3d1abe8496a548
This commit is contained in:
committed by
Facebook Github Bot
parent
3ea76f8a9b
commit
e9927377b5
@@ -713,3 +713,29 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_right_
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, position_root_with_rtl_should_position_withoutdirection) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPosition(root, YGEdgeLeft, 72);
|
||||
YGNodeStyleSetWidth(root, 52);
|
||||
YGNodeStyleSetHeight(root, 52);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(72, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(52, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(52, YGNodeLayoutGetHeight(root));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(72, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(52, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(52, YGNodeLayoutGetHeight(root));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
Reference in New Issue
Block a user