Fix flex-end/flex-start RTL transpilation

Summary: Oops, when regexing start->left/right end->left/right I did not take into account flex-start and flex-end. Easiest solution is to regex back flex-left and flex-right into their correct values.

Reviewed By: lucasr

Differential Revision: D3930244

fbshipit-source-id: 20742cbc8e5f23af694e14584c7c3df89526876e
This commit is contained in:
Emil Sjolander
2016-09-27 08:46:07 -07:00
committed by Facebook Github Bot 4
parent 9c93c7fc42
commit 6b16dc4060
7 changed files with 52 additions and 28 deletions

View File

@@ -140,6 +140,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) {
TEST(CSSLayoutTest, justify_content_row_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -161,17 +162,17 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) {
ASSERT_EQ(102, CSSNodeLayoutGetWidth(root));
ASSERT_EQ(102, CSSNodeLayoutGetHeight(root));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(72, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_EQ(102, CSSNodeLayoutGetHeight(root_child0));
ASSERT_EQ(10, CSSNodeLayoutGetLeft(root_child1));
ASSERT_EQ(82, CSSNodeLayoutGetLeft(root_child1));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child1));
ASSERT_EQ(10, CSSNodeLayoutGetWidth(root_child1));
ASSERT_EQ(102, CSSNodeLayoutGetHeight(root_child1));
ASSERT_EQ(20, CSSNodeLayoutGetLeft(root_child2));
ASSERT_EQ(92, CSSNodeLayoutGetLeft(root_child2));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child2));
ASSERT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
@@ -183,17 +184,17 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) {
ASSERT_EQ(102, CSSNodeLayoutGetWidth(root));
ASSERT_EQ(102, CSSNodeLayoutGetHeight(root));
ASSERT_EQ(92, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_EQ(102, CSSNodeLayoutGetHeight(root_child0));
ASSERT_EQ(82, CSSNodeLayoutGetLeft(root_child1));
ASSERT_EQ(10, CSSNodeLayoutGetLeft(root_child1));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child1));
ASSERT_EQ(10, CSSNodeLayoutGetWidth(root_child1));
ASSERT_EQ(102, CSSNodeLayoutGetHeight(root_child1));
ASSERT_EQ(72, CSSNodeLayoutGetLeft(root_child2));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child2));
ASSERT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
@@ -450,6 +451,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_start) {
TEST(CSSLayoutTest, justify_content_column_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -472,17 +474,17 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) {
ASSERT_EQ(102, CSSNodeLayoutGetHeight(root));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_EQ(72, CSSNodeLayoutGetTop(root_child0));
ASSERT_EQ(102, CSSNodeLayoutGetWidth(root_child0));
ASSERT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_EQ(10, CSSNodeLayoutGetTop(root_child1));
ASSERT_EQ(82, CSSNodeLayoutGetTop(root_child1));
ASSERT_EQ(102, CSSNodeLayoutGetWidth(root_child1));
ASSERT_EQ(10, CSSNodeLayoutGetHeight(root_child1));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_EQ(20, CSSNodeLayoutGetTop(root_child2));
ASSERT_EQ(92, CSSNodeLayoutGetTop(root_child2));
ASSERT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
@@ -494,17 +496,17 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) {
ASSERT_EQ(102, CSSNodeLayoutGetHeight(root));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_EQ(72, CSSNodeLayoutGetTop(root_child0));
ASSERT_EQ(102, CSSNodeLayoutGetWidth(root_child0));
ASSERT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_EQ(10, CSSNodeLayoutGetTop(root_child1));
ASSERT_EQ(82, CSSNodeLayoutGetTop(root_child1));
ASSERT_EQ(102, CSSNodeLayoutGetWidth(root_child1));
ASSERT_EQ(10, CSSNodeLayoutGetHeight(root_child1));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_EQ(20, CSSNodeLayoutGetTop(root_child2));
ASSERT_EQ(92, CSSNodeLayoutGetTop(root_child2));
ASSERT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
}