Rename enums

Summary: new name, start by renaming enums

Differential Revision: D4244360

fbshipit-source-id: c9fcbdd231098c9ff230a6055676bbc7cbd11001
This commit is contained in:
Emil Sjolander
2016-12-02 05:47:43 -08:00
committed by Facebook Github Bot
parent 07cf47baad
commit 42b6f6b6e5
107 changed files with 2546 additions and 2562 deletions

View File

@@ -18,13 +18,13 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -36,7 +36,7 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -57,13 +57,13 @@ TEST(CSSLayoutTest, absolute_layout_width_height_end_bottom) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -75,7 +75,7 @@ TEST(CSSLayoutTest, absolute_layout_width_height_end_bottom) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -96,13 +96,13 @@ TEST(CSSLayoutTest, absolute_layout_start_top_end_bottom) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -114,7 +114,7 @@ TEST(CSSLayoutTest, absolute_layout_start_top_end_bottom) {
ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -135,15 +135,15 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top_end_bottom) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -155,7 +155,7 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top_end_bottom) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -172,22 +172,22 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top_end_bottom) {
TEST(CSSLayoutTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetOverflow(root, CSSOverflowHidden);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetOverflow(root, YGOverflowHidden);
CSSNodeStyleSetWidth(root, 50);
CSSNodeStyleSetHeight(root, 50);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 0);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 0);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
CSSNodeInsertChild(root, root_child0, 0);
const CSSNodeRef root_child0_child0 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child0_child0, 100);
CSSNodeStyleSetHeight(root_child0_child0, 100);
CSSNodeInsertChild(root_child0, root_child0_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -204,7 +204,7 @@ TEST(CSSLayoutTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overfl
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -226,37 +226,37 @@ TEST(CSSLayoutTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overfl
TEST(CSSLayoutTest, absolute_layout_within_border) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetMargin(root, CSSEdgeLeft, 10);
CSSNodeStyleSetMargin(root, CSSEdgeTop, 10);
CSSNodeStyleSetMargin(root, CSSEdgeRight, 10);
CSSNodeStyleSetMargin(root, CSSEdgeBottom, 10);
CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10);
CSSNodeStyleSetPadding(root, CSSEdgeTop, 10);
CSSNodeStyleSetPadding(root, CSSEdgeRight, 10);
CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10);
CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10);
CSSNodeStyleSetBorder(root, CSSEdgeTop, 10);
CSSNodeStyleSetBorder(root, CSSEdgeRight, 10);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10);
CSSNodeStyleSetMargin(root, YGEdgeLeft, 10);
CSSNodeStyleSetMargin(root, YGEdgeTop, 10);
CSSNodeStyleSetMargin(root, YGEdgeRight, 10);
CSSNodeStyleSetMargin(root, YGEdgeBottom, 10);
CSSNodeStyleSetPadding(root, YGEdgeLeft, 10);
CSSNodeStyleSetPadding(root, YGEdgeTop, 10);
CSSNodeStyleSetPadding(root, YGEdgeRight, 10);
CSSNodeStyleSetPadding(root, YGEdgeBottom, 10);
CSSNodeStyleSetBorder(root, YGEdgeLeft, 10);
CSSNodeStyleSetBorder(root, YGEdgeTop, 10);
CSSNodeStyleSetBorder(root, YGEdgeRight, 10);
CSSNodeStyleSetBorder(root, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeLeft, 0);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeLeft, 0);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
CSSNodeStyleSetWidth(root_child0, 50);
CSSNodeStyleSetHeight(root_child0, 50);
CSSNodeInsertChild(root, root_child0, 0);
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child1, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child1, CSSEdgeRight, 0);
CSSNodeStyleSetPosition(root_child1, CSSEdgeBottom, 0);
CSSNodeStyleSetPositionType(root_child1, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child1, YGEdgeRight, 0);
CSSNodeStyleSetPosition(root_child1, YGEdgeBottom, 0);
CSSNodeStyleSetWidth(root_child1, 50);
CSSNodeStyleSetHeight(root_child1, 50);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root));
@@ -273,7 +273,7 @@ TEST(CSSLayoutTest, absolute_layout_within_border) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root));

View File

@@ -14,7 +14,7 @@
TEST(CSSLayoutTest, align_content_flex_start) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -42,7 +42,7 @@ TEST(CSSLayoutTest, align_content_flex_start) {
CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeStyleSetHeight(root_child4, 10);
CSSNodeInsertChild(root, root_child4, 4);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -74,7 +74,7 @@ TEST(CSSLayoutTest, align_content_flex_start) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child4));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -111,8 +111,8 @@ TEST(CSSLayoutTest, align_content_flex_start) {
TEST(CSSLayoutTest, align_content_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignContent(root, CSSAlignFlexEnd);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetAlignContent(root, YGAlignFlexEnd);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -140,7 +140,7 @@ TEST(CSSLayoutTest, align_content_flex_end) {
CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeStyleSetHeight(root_child4, 10);
CSSNodeInsertChild(root, root_child4, 4);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -172,7 +172,7 @@ TEST(CSSLayoutTest, align_content_flex_end) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child4));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -209,8 +209,8 @@ TEST(CSSLayoutTest, align_content_flex_end) {
TEST(CSSLayoutTest, align_content_center) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignContent(root, CSSAlignCenter);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetAlignContent(root, YGAlignCenter);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -238,7 +238,7 @@ TEST(CSSLayoutTest, align_content_center) {
CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeStyleSetHeight(root_child4, 10);
CSSNodeInsertChild(root, root_child4, 4);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -270,7 +270,7 @@ TEST(CSSLayoutTest, align_content_center) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child4));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -307,8 +307,8 @@ TEST(CSSLayoutTest, align_content_center) {
TEST(CSSLayoutTest, align_content_stretch) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignContent(root, CSSAlignStretch);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetAlignContent(root, YGAlignStretch);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -331,7 +331,7 @@ TEST(CSSLayoutTest, align_content_stretch) {
const CSSNodeRef root_child4 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeInsertChild(root, root_child4, 4);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -363,7 +363,7 @@ TEST(CSSLayoutTest, align_content_stretch) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetHeight(root_child4));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -20,7 +20,7 @@ TEST(CSSLayoutTest, align_items_stretch) {
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -32,7 +32,7 @@ TEST(CSSLayoutTest, align_items_stretch) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -49,7 +49,7 @@ TEST(CSSLayoutTest, align_items_stretch) {
TEST(CSSLayoutTest, align_items_center) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignCenter);
CSSNodeStyleSetAlignItems(root, YGAlignCenter);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -57,7 +57,7 @@ TEST(CSSLayoutTest, align_items_center) {
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -69,7 +69,7 @@ TEST(CSSLayoutTest, align_items_center) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -86,7 +86,7 @@ TEST(CSSLayoutTest, align_items_center) {
TEST(CSSLayoutTest, align_items_flex_start) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -94,7 +94,7 @@ TEST(CSSLayoutTest, align_items_flex_start) {
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -106,7 +106,7 @@ TEST(CSSLayoutTest, align_items_flex_start) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -123,7 +123,7 @@ TEST(CSSLayoutTest, align_items_flex_start) {
TEST(CSSLayoutTest, align_items_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexEnd);
CSSNodeStyleSetAlignItems(root, YGAlignFlexEnd);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -131,7 +131,7 @@ TEST(CSSLayoutTest, align_items_flex_end) {
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -143,7 +143,7 @@ TEST(CSSLayoutTest, align_items_flex_end) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -18,11 +18,11 @@ TEST(CSSLayoutTest, align_self_center) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignCenter);
CSSNodeStyleSetAlignSelf(root_child0, YGAlignCenter);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -34,7 +34,7 @@ TEST(CSSLayoutTest, align_self_center) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -55,11 +55,11 @@ TEST(CSSLayoutTest, align_self_flex_end) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexEnd);
CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -71,7 +71,7 @@ TEST(CSSLayoutTest, align_self_flex_end) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -92,11 +92,11 @@ TEST(CSSLayoutTest, align_self_flex_start) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexStart);
CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexStart);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -108,7 +108,7 @@ TEST(CSSLayoutTest, align_self_flex_start) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -125,16 +125,16 @@ TEST(CSSLayoutTest, align_self_flex_start) {
TEST(CSSLayoutTest, align_self_flex_end_override_flex_start) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexEnd);
CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -146,7 +146,7 @@ TEST(CSSLayoutTest, align_self_flex_end_override_flex_start) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -12,18 +12,18 @@
static CSSSize _measure(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
YGMeasureMode widthMode,
float height,
CSSMeasureMode heightMode) {
YGMeasureMode heightMode) {
return CSSSize {
.width = widthMode == CSSMeasureModeExactly ? width : 50,
.height = heightMode == CSSMeasureModeExactly ? height : 50,
.width = widthMode == YGMeasureModeExactly ? width : 50,
.height = heightMode == YGMeasureModeExactly ? height : 50,
};
}
TEST(CSSLayoutTest, aspect_ratio_cross_defined) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -32,7 +32,7 @@ TEST(CSSLayoutTest, aspect_ratio_cross_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -44,7 +44,7 @@ TEST(CSSLayoutTest, aspect_ratio_cross_defined) {
TEST(CSSLayoutTest, aspect_ratio_main_defined) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -53,7 +53,7 @@ TEST(CSSLayoutTest, aspect_ratio_main_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -73,7 +73,7 @@ TEST(CSSLayoutTest, aspect_ratio_both_dimensions_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -92,7 +92,7 @@ TEST(CSSLayoutTest, aspect_ratio_align_stretch) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -104,7 +104,7 @@ TEST(CSSLayoutTest, aspect_ratio_align_stretch) {
TEST(CSSLayoutTest, aspect_ratio_flex_grow) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -114,7 +114,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_grow) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -126,7 +126,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_grow) {
TEST(CSSLayoutTest, aspect_ratio_flex_shrink) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -136,7 +136,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_shrink) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -148,7 +148,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_shrink) {
TEST(CSSLayoutTest, aspect_ratio_basis) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -157,7 +157,7 @@ TEST(CSSLayoutTest, aspect_ratio_basis) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -173,14 +173,14 @@ TEST(CSSLayoutTest, aspect_ratio_absolute_layout_width_defined) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeLeft, 0);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeLeft, 0);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
CSSNodeStyleSetWidth(root_child0, 50);
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -196,14 +196,14 @@ TEST(CSSLayoutTest, aspect_ratio_absolute_layout_height_defined) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeLeft, 0);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeLeft, 0);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
CSSNodeStyleSetHeight(root_child0, 50);
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -215,7 +215,7 @@ TEST(CSSLayoutTest, aspect_ratio_absolute_layout_height_defined) {
TEST(CSSLayoutTest, aspect_ratio_with_max_cross_defined) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -225,7 +225,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_max_cross_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -237,7 +237,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_max_cross_defined) {
TEST(CSSLayoutTest, aspect_ratio_with_max_main_defined) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -247,7 +247,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_max_main_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -259,7 +259,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_max_main_defined) {
TEST(CSSLayoutTest, aspect_ratio_with_min_cross_defined) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -269,7 +269,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_min_cross_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -281,7 +281,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_min_cross_defined) {
TEST(CSSLayoutTest, aspect_ratio_with_min_main_defined) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -291,7 +291,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_min_main_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -303,7 +303,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_min_main_defined) {
TEST(CSSLayoutTest, aspect_ratio_double_cross) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -312,7 +312,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_cross) {
CSSNodeStyleSetAspectRatio(root_child0, 2);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -324,7 +324,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_cross) {
TEST(CSSLayoutTest, aspect_ratio_half_cross) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -333,7 +333,7 @@ TEST(CSSLayoutTest, aspect_ratio_half_cross) {
CSSNodeStyleSetAspectRatio(root_child0, 0.5);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -345,7 +345,7 @@ TEST(CSSLayoutTest, aspect_ratio_half_cross) {
TEST(CSSLayoutTest, aspect_ratio_double_main) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -354,7 +354,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_main) {
CSSNodeStyleSetAspectRatio(root_child0, 2);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -366,7 +366,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_main) {
TEST(CSSLayoutTest, aspect_ratio_half_main) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -375,7 +375,7 @@ TEST(CSSLayoutTest, aspect_ratio_half_main) {
CSSNodeStyleSetAspectRatio(root_child0, 0.5);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -387,7 +387,7 @@ TEST(CSSLayoutTest, aspect_ratio_half_main) {
TEST(CSSLayoutTest, aspect_ratio_with_measure_func) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -396,7 +396,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_measure_func) {
CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));

View File

@@ -14,18 +14,18 @@
TEST(CSSLayoutTest, border_no_size) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10);
CSSNodeStyleSetBorder(root, CSSEdgeTop, 10);
CSSNodeStyleSetBorder(root, CSSEdgeRight, 10);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeStyleSetBorder(root, YGEdgeLeft, 10);
CSSNodeStyleSetBorder(root, YGEdgeTop, 10);
CSSNodeStyleSetBorder(root, YGEdgeRight, 10);
CSSNodeStyleSetBorder(root, YGEdgeBottom, 10);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -37,16 +37,16 @@ TEST(CSSLayoutTest, border_no_size) {
TEST(CSSLayoutTest, border_container_match_child) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10);
CSSNodeStyleSetBorder(root, CSSEdgeTop, 10);
CSSNodeStyleSetBorder(root, CSSEdgeRight, 10);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10);
CSSNodeStyleSetBorder(root, YGEdgeLeft, 10);
CSSNodeStyleSetBorder(root, YGEdgeTop, 10);
CSSNodeStyleSetBorder(root, YGEdgeRight, 10);
CSSNodeStyleSetBorder(root, YGEdgeBottom, 10);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -58,7 +58,7 @@ TEST(CSSLayoutTest, border_container_match_child) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -75,10 +75,10 @@ TEST(CSSLayoutTest, border_container_match_child) {
TEST(CSSLayoutTest, border_flex_child) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10);
CSSNodeStyleSetBorder(root, CSSEdgeTop, 10);
CSSNodeStyleSetBorder(root, CSSEdgeRight, 10);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10);
CSSNodeStyleSetBorder(root, YGEdgeLeft, 10);
CSSNodeStyleSetBorder(root, YGEdgeTop, 10);
CSSNodeStyleSetBorder(root, YGEdgeRight, 10);
CSSNodeStyleSetBorder(root, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -86,7 +86,7 @@ TEST(CSSLayoutTest, border_flex_child) {
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -98,7 +98,7 @@ TEST(CSSLayoutTest, border_flex_child) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -115,17 +115,17 @@ TEST(CSSLayoutTest, border_flex_child) {
TEST(CSSLayoutTest, border_stretch_child) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10);
CSSNodeStyleSetBorder(root, CSSEdgeTop, 10);
CSSNodeStyleSetBorder(root, CSSEdgeRight, 10);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10);
CSSNodeStyleSetBorder(root, YGEdgeLeft, 10);
CSSNodeStyleSetBorder(root, YGEdgeTop, 10);
CSSNodeStyleSetBorder(root, YGEdgeRight, 10);
CSSNodeStyleSetBorder(root, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -137,7 +137,7 @@ TEST(CSSLayoutTest, border_stretch_child) {
ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -154,11 +154,11 @@ TEST(CSSLayoutTest, border_stretch_child) {
TEST(CSSLayoutTest, border_center_child) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter);
CSSNodeStyleSetAlignItems(root, CSSAlignCenter);
CSSNodeStyleSetBorder(root, CSSEdgeStart, 10);
CSSNodeStyleSetBorder(root, CSSEdgeEnd, 20);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 20);
CSSNodeStyleSetJustifyContent(root, YGJustifyCenter);
CSSNodeStyleSetAlignItems(root, YGAlignCenter);
CSSNodeStyleSetBorder(root, YGEdgeStart, 10);
CSSNodeStyleSetBorder(root, YGEdgeEnd, 20);
CSSNodeStyleSetBorder(root, YGEdgeBottom, 20);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -166,7 +166,7 @@ TEST(CSSLayoutTest, border_center_child) {
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -178,7 +178,7 @@ TEST(CSSLayoutTest, border_center_child) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -16,46 +16,46 @@ TEST(CSSLayoutTest, assert_default_values) {
ASSERT_EQ(0, CSSNodeChildCount(root));
ASSERT_EQ(NULL, CSSNodeGetChild(root, 1));
ASSERT_EQ(CSSDirectionInherit, CSSNodeStyleGetDirection(root));
ASSERT_EQ(CSSFlexDirectionColumn, CSSNodeStyleGetFlexDirection(root));
ASSERT_EQ(CSSJustifyFlexStart, CSSNodeStyleGetJustifyContent(root));
ASSERT_EQ(CSSAlignFlexStart, CSSNodeStyleGetAlignContent(root));
ASSERT_EQ(CSSAlignStretch, CSSNodeStyleGetAlignItems(root));
ASSERT_EQ(CSSAlignAuto, CSSNodeStyleGetAlignSelf(root));
ASSERT_EQ(CSSPositionTypeRelative, CSSNodeStyleGetPositionType(root));
ASSERT_EQ(CSSWrapNoWrap, CSSNodeStyleGetFlexWrap(root));
ASSERT_EQ(CSSOverflowVisible, CSSNodeStyleGetOverflow(root));
ASSERT_EQ(YGDirectionInherit, CSSNodeStyleGetDirection(root));
ASSERT_EQ(YGFlexDirectionColumn, CSSNodeStyleGetFlexDirection(root));
ASSERT_EQ(YGJustifyFlexStart, CSSNodeStyleGetJustifyContent(root));
ASSERT_EQ(YGAlignFlexStart, CSSNodeStyleGetAlignContent(root));
ASSERT_EQ(YGAlignStretch, CSSNodeStyleGetAlignItems(root));
ASSERT_EQ(YGAlignAuto, CSSNodeStyleGetAlignSelf(root));
ASSERT_EQ(YGPositionTypeRelative, CSSNodeStyleGetPositionType(root));
ASSERT_EQ(YGWrapNoWrap, CSSNodeStyleGetFlexWrap(root));
ASSERT_EQ(YGOverflowVisible, CSSNodeStyleGetOverflow(root));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetFlexGrow(root));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetFlexShrink(root));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(root)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeLeft)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeTop)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeRight)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeBottom)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeEnd)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeLeft)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeTop)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeRight)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeBottom)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeEnd)));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeLeft));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeTop));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeRight));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeBottom));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, CSSEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, CSSEdgeEnd)));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeLeft));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeTop));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeRight));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeBottom));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, YGEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, YGEdgeEnd)));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeLeft));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeTop));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeRight));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeBottom));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, CSSEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, CSSEdgeEnd)));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeLeft));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeTop));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeRight));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeBottom));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, YGEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, YGEdgeEnd)));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeLeft));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeTop));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeRight));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeBottom));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, CSSEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, CSSEdgeEnd)));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeLeft));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeTop));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeRight));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeBottom));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, YGEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, YGEdgeEnd)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetWidth(root)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetHeight(root)));
@@ -70,7 +70,7 @@ TEST(CSSLayoutTest, assert_default_values) {
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetBottom(root));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeLayoutGetWidth(root)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeLayoutGetHeight(root)));
ASSERT_EQ(CSSDirectionInherit, CSSNodeLayoutGetDirection(root));
ASSERT_EQ(YGDirectionInherit, CSSNodeLayoutGetDirection(root));
CSSNodeFreeRecursive(root);
}

View File

@@ -12,7 +12,7 @@
TEST(CSSLayoutTest, dirty_propagation) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -26,7 +26,7 @@ TEST(CSSLayoutTest, dirty_propagation) {
CSSNodeStyleSetHeight(root_child1, 20);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
CSSNodeStyleSetWidth(root_child0, 20);
@@ -34,7 +34,7 @@ TEST(CSSLayoutTest, dirty_propagation) {
EXPECT_FALSE(CSSNodeIsDirty(root_child1));
EXPECT_TRUE(CSSNodeIsDirty(root));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
EXPECT_FALSE(CSSNodeIsDirty(root_child0));
EXPECT_FALSE(CSSNodeIsDirty(root_child1));
@@ -45,7 +45,7 @@ TEST(CSSLayoutTest, dirty_propagation) {
TEST(CSSLayoutTest, dirty_propagation_only_if_prop_changed) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -59,7 +59,7 @@ TEST(CSSLayoutTest, dirty_propagation_only_if_prop_changed) {
CSSNodeStyleSetHeight(root_child1, 20);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
CSSNodeStyleSetWidth(root_child0, 50);
@@ -72,7 +72,7 @@ TEST(CSSLayoutTest, dirty_propagation_only_if_prop_changed) {
TEST(CSSLayoutTest, dirty_node_only_if_children_are_actually_removed) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 50);
CSSNodeStyleSetHeight(root, 50);
@@ -81,7 +81,7 @@ TEST(CSSLayoutTest, dirty_node_only_if_children_are_actually_removed) {
CSSNodeStyleSetHeight(child0, 25);
CSSNodeInsertChild(root, child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
const CSSNodeRef child1 = CSSNodeNew();
CSSNodeRemoveChild(root, child1);

View File

@@ -12,22 +12,22 @@
TEST(CSSLayoutTest, start_overrides) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 20);
CSSNodeStyleSetMargin(root_child0, CSSEdgeRight, 20);
CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 20);
CSSNodeStyleSetMargin(root_child0, YGEdgeRight, 20);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
@@ -36,22 +36,22 @@ TEST(CSSLayoutTest, start_overrides) {
TEST(CSSLayoutTest, end_overrides) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeEnd, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 20);
CSSNodeStyleSetMargin(root_child0, CSSEdgeRight, 20);
CSSNodeStyleSetMargin(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 20);
CSSNodeStyleSetMargin(root_child0, YGEdgeRight, 20);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0));
@@ -60,17 +60,17 @@ TEST(CSSLayoutTest, end_overrides) {
TEST(CSSLayoutTest, horizontal_overridden) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeHorizontal, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 20);
CSSNodeStyleSetMargin(root_child0, YGEdgeHorizontal, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 20);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
@@ -79,17 +79,17 @@ TEST(CSSLayoutTest, horizontal_overridden) {
TEST(CSSLayoutTest, vertical_overridden) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeVertical, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 20);
CSSNodeStyleSetMargin(root_child0, YGEdgeVertical, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 20);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetBottom(root_child0));
@@ -98,17 +98,17 @@ TEST(CSSLayoutTest, vertical_overridden) {
TEST(CSSLayoutTest, horizontal_overrides_all) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeHorizontal, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeAll, 20);
CSSNodeStyleSetMargin(root_child0, YGEdgeHorizontal, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeAll, 20);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
@@ -119,17 +119,17 @@ TEST(CSSLayoutTest, horizontal_overrides_all) {
TEST(CSSLayoutTest, vertical_overrides_all) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeVertical, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeAll, 20);
CSSNodeStyleSetMargin(root_child0, YGEdgeVertical, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeAll, 20);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0));
@@ -140,20 +140,20 @@ TEST(CSSLayoutTest, vertical_overrides_all) {
TEST(CSSLayoutTest, all_overridden) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeRight, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeBottom, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeAll, 20);
CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeRight, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeBottom, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeAll, 20);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));

View File

@@ -27,7 +27,7 @@ TEST(CSSLayoutTest, flex_direction_column_no_height) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -49,7 +49,7 @@ TEST(CSSLayoutTest, flex_direction_column_no_height) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -76,7 +76,7 @@ TEST(CSSLayoutTest, flex_direction_column_no_height) {
TEST(CSSLayoutTest, flex_direction_row_no_width) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
@@ -90,7 +90,7 @@ TEST(CSSLayoutTest, flex_direction_row_no_width) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -112,7 +112,7 @@ TEST(CSSLayoutTest, flex_direction_row_no_width) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -153,7 +153,7 @@ TEST(CSSLayoutTest, flex_direction_column) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -175,7 +175,7 @@ TEST(CSSLayoutTest, flex_direction_column) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -202,7 +202,7 @@ TEST(CSSLayoutTest, flex_direction_column) {
TEST(CSSLayoutTest, flex_direction_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -217,7 +217,7 @@ TEST(CSSLayoutTest, flex_direction_row) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -239,7 +239,7 @@ TEST(CSSLayoutTest, flex_direction_row) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -266,7 +266,7 @@ TEST(CSSLayoutTest, flex_direction_row) {
TEST(CSSLayoutTest, flex_direction_column_reverse) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumnReverse);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -281,7 +281,7 @@ TEST(CSSLayoutTest, flex_direction_column_reverse) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -303,7 +303,7 @@ TEST(CSSLayoutTest, flex_direction_column_reverse) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -330,7 +330,7 @@ TEST(CSSLayoutTest, flex_direction_column_reverse) {
TEST(CSSLayoutTest, flex_direction_row_reverse) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRowReverse);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -345,7 +345,7 @@ TEST(CSSLayoutTest, flex_direction_row_reverse) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -367,7 +367,7 @@ TEST(CSSLayoutTest, flex_direction_row_reverse) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -25,7 +25,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_column) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -42,7 +42,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_column) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -64,7 +64,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_column) {
TEST(CSSLayoutTest, flex_basis_flex_grow_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -76,7 +76,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_row) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -93,7 +93,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_row) {
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -126,7 +126,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_column) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexBasis(root_child1, 50);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -143,7 +143,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_column) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -165,7 +165,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_column) {
TEST(CSSLayoutTest, flex_basis_flex_shrink_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -177,7 +177,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_row) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexBasis(root_child1, 50);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -194,7 +194,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_row) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -233,7 +233,7 @@ TEST(CSSLayoutTest, flex_shrink_to_zero) {
CSSNodeStyleSetWidth(root_child2, 50);
CSSNodeStyleSetHeight(root_child2, 50);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -255,7 +255,7 @@ TEST(CSSLayoutTest, flex_shrink_to_zero) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -300,7 +300,7 @@ TEST(CSSLayoutTest, flex_basis_overrides_main_size) {
CSSNodeStyleSetFlexGrow(root_child2, 1);
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -322,7 +322,7 @@ TEST(CSSLayoutTest, flex_basis_overrides_main_size) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -359,7 +359,7 @@ TEST(CSSLayoutTest, flex_grow_shrink_at_most) {
CSSNodeStyleSetFlexGrow(root_child0_child0, 1);
CSSNodeStyleSetFlexShrink(root_child0_child0, 1);
CSSNodeInsertChild(root_child0, root_child0_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -376,7 +376,7 @@ TEST(CSSLayoutTest, flex_grow_shrink_at_most) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetHeight(root_child0_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -14,7 +14,7 @@
TEST(CSSLayoutTest, wrap_column) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
@@ -36,7 +36,7 @@ TEST(CSSLayoutTest, wrap_column) {
CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -63,7 +63,7 @@ TEST(CSSLayoutTest, wrap_column) {
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -95,8 +95,8 @@ TEST(CSSLayoutTest, wrap_column) {
TEST(CSSLayoutTest, wrap_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
@@ -118,7 +118,7 @@ TEST(CSSLayoutTest, wrap_row) {
CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -145,7 +145,7 @@ TEST(CSSLayoutTest, wrap_row) {
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -177,9 +177,9 @@ TEST(CSSLayoutTest, wrap_row) {
TEST(CSSLayoutTest, wrap_row_align_items_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, CSSAlignFlexEnd);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, YGAlignFlexEnd);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
@@ -201,7 +201,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_flex_end) {
CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -228,7 +228,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_flex_end) {
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -260,9 +260,9 @@ TEST(CSSLayoutTest, wrap_row_align_items_flex_end) {
TEST(CSSLayoutTest, wrap_row_align_items_center) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, CSSAlignCenter);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, YGAlignCenter);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
@@ -284,7 +284,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_center) {
CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -311,7 +311,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_center) {
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -14,7 +14,7 @@
TEST(CSSLayoutTest, justify_content_row_flex_start) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -29,7 +29,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -51,7 +51,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -78,8 +78,8 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) {
TEST(CSSLayoutTest, justify_content_row_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -94,7 +94,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -116,7 +116,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -143,8 +143,8 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) {
TEST(CSSLayoutTest, justify_content_row_center) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, YGJustifyCenter);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -159,7 +159,7 @@ TEST(CSSLayoutTest, justify_content_row_center) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -181,7 +181,7 @@ TEST(CSSLayoutTest, justify_content_row_center) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -208,8 +208,8 @@ TEST(CSSLayoutTest, justify_content_row_center) {
TEST(CSSLayoutTest, justify_content_row_space_between) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceBetween);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, YGJustifySpaceBetween);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -224,7 +224,7 @@ TEST(CSSLayoutTest, justify_content_row_space_between) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -246,7 +246,7 @@ TEST(CSSLayoutTest, justify_content_row_space_between) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -273,8 +273,8 @@ TEST(CSSLayoutTest, justify_content_row_space_between) {
TEST(CSSLayoutTest, justify_content_row_space_around) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceAround);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, YGJustifySpaceAround);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -289,7 +289,7 @@ TEST(CSSLayoutTest, justify_content_row_space_around) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -311,7 +311,7 @@ TEST(CSSLayoutTest, justify_content_row_space_around) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -351,7 +351,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_start) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -373,7 +373,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_start) {
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -400,7 +400,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_start) {
TEST(CSSLayoutTest, justify_content_column_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -415,7 +415,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -437,7 +437,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) {
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -464,7 +464,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) {
TEST(CSSLayoutTest, justify_content_column_center) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter);
CSSNodeStyleSetJustifyContent(root, YGJustifyCenter);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -479,7 +479,7 @@ TEST(CSSLayoutTest, justify_content_column_center) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -501,7 +501,7 @@ TEST(CSSLayoutTest, justify_content_column_center) {
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -528,7 +528,7 @@ TEST(CSSLayoutTest, justify_content_column_center) {
TEST(CSSLayoutTest, justify_content_column_space_between) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceBetween);
CSSNodeStyleSetJustifyContent(root, YGJustifySpaceBetween);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -543,7 +543,7 @@ TEST(CSSLayoutTest, justify_content_column_space_between) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -565,7 +565,7 @@ TEST(CSSLayoutTest, justify_content_column_space_between) {
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -592,7 +592,7 @@ TEST(CSSLayoutTest, justify_content_column_space_between) {
TEST(CSSLayoutTest, justify_content_column_space_around) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceAround);
CSSNodeStyleSetJustifyContent(root, YGJustifySpaceAround);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -607,7 +607,7 @@ TEST(CSSLayoutTest, justify_content_column_space_around) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -629,7 +629,7 @@ TEST(CSSLayoutTest, justify_content_column_space_around) {
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -14,15 +14,15 @@
TEST(CSSLayoutTest, margin_start) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -34,7 +34,7 @@ TEST(CSSLayoutTest, margin_start) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -55,10 +55,10 @@ TEST(CSSLayoutTest, margin_top) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -70,7 +70,7 @@ TEST(CSSLayoutTest, margin_top) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -87,16 +87,16 @@ TEST(CSSLayoutTest, margin_top) {
TEST(CSSLayoutTest, margin_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeEnd, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -108,7 +108,7 @@ TEST(CSSLayoutTest, margin_end) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -125,15 +125,15 @@ TEST(CSSLayoutTest, margin_end) {
TEST(CSSLayoutTest, margin_bottom) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeBottom, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeBottom, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -145,7 +145,7 @@ TEST(CSSLayoutTest, margin_bottom) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -162,15 +162,15 @@ TEST(CSSLayoutTest, margin_bottom) {
TEST(CSSLayoutTest, margin_and_flex_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -182,7 +182,7 @@ TEST(CSSLayoutTest, margin_and_flex_row) {
ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -204,9 +204,9 @@ TEST(CSSLayoutTest, margin_and_flex_column) {
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -218,7 +218,7 @@ TEST(CSSLayoutTest, margin_and_flex_column) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -235,15 +235,15 @@ TEST(CSSLayoutTest, margin_and_flex_column) {
TEST(CSSLayoutTest, margin_and_stretch_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -255,7 +255,7 @@ TEST(CSSLayoutTest, margin_and_stretch_row) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -277,9 +277,9 @@ TEST(CSSLayoutTest, margin_and_stretch_column) {
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -291,7 +291,7 @@ TEST(CSSLayoutTest, margin_and_stretch_column) {
ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -308,7 +308,7 @@ TEST(CSSLayoutTest, margin_and_stretch_column) {
TEST(CSSLayoutTest, margin_with_sibling_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -319,7 +319,7 @@ TEST(CSSLayoutTest, margin_with_sibling_row) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -336,7 +336,7 @@ TEST(CSSLayoutTest, margin_with_sibling_row) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -368,7 +368,7 @@ TEST(CSSLayoutTest, margin_with_sibling_column) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -385,7 +385,7 @@ TEST(CSSLayoutTest, margin_with_sibling_column) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -12,37 +12,37 @@
static CSSSize _measureMax(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
YGMeasureMode widthMode,
float height,
CSSMeasureMode heightMode) {
YGMeasureMode heightMode) {
int *measureCount = (int *)CSSNodeGetContext(node);
(*measureCount)++;
return CSSSize {
.width = widthMode == CSSMeasureModeUndefined ? 10 : width,
.height = heightMode == CSSMeasureModeUndefined ? 10 : height,
.width = widthMode == YGMeasureModeUndefined ? 10 : width,
.height = heightMode == YGMeasureModeUndefined ? 10 : height,
};
}
static CSSSize _measureMin(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
YGMeasureMode widthMode,
float height,
CSSMeasureMode heightMode) {
YGMeasureMode heightMode) {
int *measureCount = (int *)CSSNodeGetContext(node);
*measureCount = *measureCount + 1;
return CSSSize {
.width = widthMode == CSSMeasureModeUndefined || (widthMode == CSSMeasureModeAtMost && width > 10) ? 10 : width,
.height = heightMode == CSSMeasureModeUndefined || (heightMode == CSSMeasureModeAtMost && height > 10) ? 10 : height,
.width = widthMode == YGMeasureModeUndefined || (widthMode == YGMeasureModeAtMost && width > 10) ? 10 : width,
.height = heightMode == YGMeasureModeUndefined || (heightMode == YGMeasureModeAtMost && height > 10) ? 10 : height,
};
}
TEST(CSSLayoutTest, measure_once_single_flexible_child) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -53,7 +53,7 @@ TEST(CSSLayoutTest, measure_once_single_flexible_child) {
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, measureCount);
@@ -69,8 +69,8 @@ TEST(CSSLayoutTest, remeasure_with_same_exact_width_larger_than_needed_height) {
CSSNodeSetMeasureFunc(root_child0, _measureMin);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR);
CSSNodeCalculateLayout(root, 100, 50, CSSDirectionLTR);
CSSNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
CSSNodeCalculateLayout(root, 100, 50, YGDirectionLTR);
ASSERT_EQ(1, measureCount);
@@ -79,7 +79,7 @@ TEST(CSSLayoutTest, remeasure_with_same_exact_width_larger_than_needed_height) {
TEST(CSSLayoutTest, remeasure_with_same_atmost_width_larger_than_needed_height) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
const CSSNodeRef root_child0 = CSSNodeNew();
int measureCount = 0;
@@ -87,8 +87,8 @@ TEST(CSSLayoutTest, remeasure_with_same_atmost_width_larger_than_needed_height)
CSSNodeSetMeasureFunc(root_child0, _measureMin);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR);
CSSNodeCalculateLayout(root, 100, 50, CSSDirectionLTR);
CSSNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
CSSNodeCalculateLayout(root, 100, 50, YGDirectionLTR);
ASSERT_EQ(1, measureCount);
@@ -97,7 +97,7 @@ TEST(CSSLayoutTest, remeasure_with_same_atmost_width_larger_than_needed_height)
TEST(CSSLayoutTest, remeasure_with_computed_width_larger_than_needed_height) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
const CSSNodeRef root_child0 = CSSNodeNew();
int measureCount = 0;
@@ -105,9 +105,9 @@ TEST(CSSLayoutTest, remeasure_with_computed_width_larger_than_needed_height) {
CSSNodeSetMeasureFunc(root_child0, _measureMin);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR);
CSSNodeStyleSetAlignItems(root, CSSAlignStretch);
CSSNodeCalculateLayout(root, 10, 50, CSSDirectionLTR);
CSSNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
CSSNodeStyleSetAlignItems(root, YGAlignStretch);
CSSNodeCalculateLayout(root, 10, 50, YGDirectionLTR);
ASSERT_EQ(1, measureCount);
@@ -116,7 +116,7 @@ TEST(CSSLayoutTest, remeasure_with_computed_width_larger_than_needed_height) {
TEST(CSSLayoutTest, remeasure_with_atmost_computed_width_undefined_height) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
const CSSNodeRef root_child0 = CSSNodeNew();
int measureCount = 0;
@@ -124,8 +124,8 @@ TEST(CSSLayoutTest, remeasure_with_atmost_computed_width_undefined_height) {
CSSNodeSetMeasureFunc(root_child0, _measureMin);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, 100, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, 10, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, 100, YGUndefined, YGDirectionLTR);
CSSNodeCalculateLayout(root, 10, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, measureCount);

View File

@@ -12,9 +12,9 @@
struct _MeasureConstraint {
float width;
CSSMeasureMode widthMode;
YGMeasureMode widthMode;
float height;
CSSMeasureMode heightMode;
YGMeasureMode heightMode;
};
struct _MeasureConstraintList {
@@ -24,9 +24,9 @@ struct _MeasureConstraintList {
static CSSSize _measure(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
YGMeasureMode widthMode,
float height,
CSSMeasureMode heightMode) {
YGMeasureMode heightMode) {
struct _MeasureConstraintList *constraintList = (struct _MeasureConstraintList *)CSSNodeGetContext(node);
struct _MeasureConstraint *constraints = constraintList->constraints;
uint32_t currentIndex = constraintList->length;
@@ -37,8 +37,8 @@ static CSSSize _measure(CSSNodeRef node,
constraintList->length = currentIndex + 1;
return CSSSize {
.width = widthMode == CSSMeasureModeUndefined ? 10 : width,
.height = heightMode == CSSMeasureModeUndefined ? 10 : width,
.width = widthMode == YGMeasureModeUndefined ? 10 : width,
.height = heightMode == YGMeasureModeUndefined ? 10 : width,
};
}
@@ -57,12 +57,12 @@ TEST(CSSLayoutTest, exactly_measure_stretched_child_column) {
CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width);
ASSERT_EQ(CSSMeasureModeExactly, constraintList.constraints[0].widthMode);
ASSERT_EQ(YGMeasureModeExactly, constraintList.constraints[0].widthMode);
free(constraintList.constraints);
CSSNodeFreeRecursive(root);
@@ -75,7 +75,7 @@ TEST(CSSLayoutTest, exactly_measure_stretched_child_row) {
};
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -84,12 +84,12 @@ TEST(CSSLayoutTest, exactly_measure_stretched_child_row) {
CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height);
ASSERT_EQ(CSSMeasureModeExactly, constraintList.constraints[0].heightMode);
ASSERT_EQ(YGMeasureModeExactly, constraintList.constraints[0].heightMode);
free(constraintList.constraints);
CSSNodeFreeRecursive(root);
@@ -110,12 +110,12 @@ TEST(CSSLayoutTest, at_most_main_axis_column) {
CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height);
ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].heightMode);
ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].heightMode);
free(constraintList.constraints);
CSSNodeFreeRecursive(root);
@@ -128,7 +128,7 @@ TEST(CSSLayoutTest, at_most_cross_axis_column) {
};
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -137,12 +137,12 @@ TEST(CSSLayoutTest, at_most_cross_axis_column) {
CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width);
ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].widthMode);
ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].widthMode);
free(constraintList.constraints);
CSSNodeFreeRecursive(root);
@@ -155,7 +155,7 @@ TEST(CSSLayoutTest, at_most_main_axis_row) {
};
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -164,12 +164,12 @@ TEST(CSSLayoutTest, at_most_main_axis_row) {
CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width);
ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].widthMode);
ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].widthMode);
free(constraintList.constraints);
CSSNodeFreeRecursive(root);
@@ -182,8 +182,8 @@ TEST(CSSLayoutTest, at_most_cross_axis_row) {
};
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -192,12 +192,12 @@ TEST(CSSLayoutTest, at_most_cross_axis_row) {
CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height);
ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].heightMode);
ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].heightMode);
free(constraintList.constraints);
CSSNodeFreeRecursive(root);
@@ -218,15 +218,15 @@ TEST(CSSLayoutTest, flex_child) {
CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(2, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height);
ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].heightMode);
ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].heightMode);
ASSERT_FLOAT_EQ(100, constraintList.constraints[1].height);
ASSERT_EQ(CSSMeasureModeExactly, constraintList.constraints[1].heightMode);
ASSERT_EQ(YGMeasureModeExactly, constraintList.constraints[1].heightMode);
free(constraintList.constraints);
CSSNodeFreeRecursive(root);
@@ -248,12 +248,12 @@ TEST(CSSLayoutTest, flex_child_with_flex_basis) {
CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height);
ASSERT_EQ(CSSMeasureModeExactly, constraintList.constraints[0].heightMode);
ASSERT_EQ(YGMeasureModeExactly, constraintList.constraints[0].heightMode);
free(constraintList.constraints);
CSSNodeFreeRecursive(root);
@@ -266,8 +266,8 @@ TEST(CSSLayoutTest, overflow_scroll_column) {
};
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetOverflow(root, CSSOverflowScroll);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetOverflow(root, YGOverflowScroll);
CSSNodeStyleSetHeight(root, 100);
CSSNodeStyleSetWidth(root, 100);
@@ -276,15 +276,15 @@ TEST(CSSLayoutTest, overflow_scroll_column) {
CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width);
ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].widthMode);
ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].widthMode);
ASSERT_TRUE(CSSValueIsUndefined(constraintList.constraints[0].height));
ASSERT_EQ(CSSMeasureModeUndefined, constraintList.constraints[0].heightMode);
ASSERT_EQ(YGMeasureModeUndefined, constraintList.constraints[0].heightMode);
free(constraintList.constraints);
CSSNodeFreeRecursive(root);
@@ -297,9 +297,9 @@ TEST(CSSLayoutTest, overflow_scroll_row) {
};
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetOverflow(root, CSSOverflowScroll);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetOverflow(root, YGOverflowScroll);
CSSNodeStyleSetHeight(root, 100);
CSSNodeStyleSetWidth(root, 100);
@@ -308,15 +308,15 @@ TEST(CSSLayoutTest, overflow_scroll_row) {
CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length);
ASSERT_TRUE(CSSValueIsUndefined(constraintList.constraints[0].width));
ASSERT_EQ(CSSMeasureModeUndefined, constraintList.constraints[0].widthMode);
ASSERT_EQ(YGMeasureModeUndefined, constraintList.constraints[0].widthMode);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height);
ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].heightMode);
ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].heightMode);
free(constraintList.constraints);
CSSNodeFreeRecursive(root);

View File

@@ -12,9 +12,9 @@
static CSSSize _measure(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
YGMeasureMode widthMode,
float height,
CSSMeasureMode heightMode) {
YGMeasureMode heightMode) {
int *measureCount = (int*) CSSNodeGetContext(node);
if (measureCount) {
(*measureCount)++;
@@ -40,7 +40,7 @@ TEST(CSSLayoutTest, dont_measure_single_grow_shrink_child) {
CSSNodeStyleSetFlexShrink(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, measureCount);

View File

@@ -21,7 +21,7 @@ TEST(CSSLayoutTest, max_width) {
CSSNodeStyleSetMaxWidth(root_child0, 50);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -33,7 +33,7 @@ TEST(CSSLayoutTest, max_width) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -50,7 +50,7 @@ TEST(CSSLayoutTest, max_width) {
TEST(CSSLayoutTest, max_height) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -58,7 +58,7 @@ TEST(CSSLayoutTest, max_height) {
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetMaxHeight(root_child0, 50);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -70,7 +70,7 @@ TEST(CSSLayoutTest, max_height) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -98,7 +98,7 @@ TEST(CSSLayoutTest, min_height) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -115,7 +115,7 @@ TEST(CSSLayoutTest, min_height) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -137,7 +137,7 @@ TEST(CSSLayoutTest, min_height) {
TEST(CSSLayoutTest, min_width) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -149,7 +149,7 @@ TEST(CSSLayoutTest, min_width) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -166,7 +166,7 @@ TEST(CSSLayoutTest, min_width) {
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -188,7 +188,7 @@ TEST(CSSLayoutTest, min_width) {
TEST(CSSLayoutTest, justify_content_min_max) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter);
CSSNodeStyleSetJustifyContent(root, YGJustifyCenter);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetMinHeight(root, 100);
CSSNodeStyleSetMaxHeight(root, 200);
@@ -197,7 +197,7 @@ TEST(CSSLayoutTest, justify_content_min_max) {
CSSNodeStyleSetWidth(root_child0, 60);
CSSNodeStyleSetHeight(root_child0, 60);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -209,7 +209,7 @@ TEST(CSSLayoutTest, justify_content_min_max) {
ASSERT_FLOAT_EQ(60, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(60, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -226,7 +226,7 @@ TEST(CSSLayoutTest, justify_content_min_max) {
TEST(CSSLayoutTest, align_items_min_max) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignCenter);
CSSNodeStyleSetAlignItems(root, YGAlignCenter);
CSSNodeStyleSetMinWidth(root, 100);
CSSNodeStyleSetMaxWidth(root, 200);
CSSNodeStyleSetHeight(root, 100);
@@ -235,7 +235,7 @@ TEST(CSSLayoutTest, align_items_min_max) {
CSSNodeStyleSetWidth(root_child0, 60);
CSSNodeStyleSetHeight(root_child0, 60);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -247,7 +247,7 @@ TEST(CSSLayoutTest, align_items_min_max) {
ASSERT_FLOAT_EQ(60, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(60, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -264,7 +264,7 @@ TEST(CSSLayoutTest, align_items_min_max) {
TEST(CSSLayoutTest, justify_content_overflow_min_max) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter);
CSSNodeStyleSetJustifyContent(root, YGJustifyCenter);
CSSNodeStyleSetMinHeight(root, 100);
CSSNodeStyleSetMaxHeight(root, 110);
@@ -282,7 +282,7 @@ TEST(CSSLayoutTest, justify_content_overflow_min_max) {
CSSNodeStyleSetWidth(root_child2, 50);
CSSNodeStyleSetHeight(root_child2, 50);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -304,7 +304,7 @@ TEST(CSSLayoutTest, justify_content_overflow_min_max) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -335,7 +335,7 @@ TEST(CSSLayoutTest, flex_grow_within_max_width) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root_child0, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
CSSNodeStyleSetMaxWidth(root_child0, 100);
CSSNodeInsertChild(root, root_child0, 0);
@@ -343,7 +343,7 @@ TEST(CSSLayoutTest, flex_grow_within_max_width) {
CSSNodeStyleSetFlexGrow(root_child0_child0, 1);
CSSNodeStyleSetHeight(root_child0_child0, 20);
CSSNodeInsertChild(root_child0, root_child0_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -360,7 +360,7 @@ TEST(CSSLayoutTest, flex_grow_within_max_width) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child0_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -386,7 +386,7 @@ TEST(CSSLayoutTest, flex_grow_within_constrained_max_width) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root_child0, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
CSSNodeStyleSetMaxWidth(root_child0, 300);
CSSNodeInsertChild(root, root_child0, 0);
@@ -394,7 +394,7 @@ TEST(CSSLayoutTest, flex_grow_within_constrained_max_width) {
CSSNodeStyleSetFlexGrow(root_child0_child0, 1);
CSSNodeStyleSetHeight(root_child0_child0, 20);
CSSNodeInsertChild(root_child0, root_child0_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -411,7 +411,7 @@ TEST(CSSLayoutTest, flex_grow_within_constrained_max_width) {
ASSERT_FLOAT_EQ(200, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child0_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -14,18 +14,18 @@
TEST(CSSLayoutTest, padding_no_size) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10);
CSSNodeStyleSetPadding(root, CSSEdgeTop, 10);
CSSNodeStyleSetPadding(root, CSSEdgeRight, 10);
CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeStyleSetPadding(root, YGEdgeLeft, 10);
CSSNodeStyleSetPadding(root, YGEdgeTop, 10);
CSSNodeStyleSetPadding(root, YGEdgeRight, 10);
CSSNodeStyleSetPadding(root, YGEdgeBottom, 10);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -37,16 +37,16 @@ TEST(CSSLayoutTest, padding_no_size) {
TEST(CSSLayoutTest, padding_container_match_child) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10);
CSSNodeStyleSetPadding(root, CSSEdgeTop, 10);
CSSNodeStyleSetPadding(root, CSSEdgeRight, 10);
CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10);
CSSNodeStyleSetPadding(root, YGEdgeLeft, 10);
CSSNodeStyleSetPadding(root, YGEdgeTop, 10);
CSSNodeStyleSetPadding(root, YGEdgeRight, 10);
CSSNodeStyleSetPadding(root, YGEdgeBottom, 10);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -58,7 +58,7 @@ TEST(CSSLayoutTest, padding_container_match_child) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -75,10 +75,10 @@ TEST(CSSLayoutTest, padding_container_match_child) {
TEST(CSSLayoutTest, padding_flex_child) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10);
CSSNodeStyleSetPadding(root, CSSEdgeTop, 10);
CSSNodeStyleSetPadding(root, CSSEdgeRight, 10);
CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10);
CSSNodeStyleSetPadding(root, YGEdgeLeft, 10);
CSSNodeStyleSetPadding(root, YGEdgeTop, 10);
CSSNodeStyleSetPadding(root, YGEdgeRight, 10);
CSSNodeStyleSetPadding(root, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -86,7 +86,7 @@ TEST(CSSLayoutTest, padding_flex_child) {
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -98,7 +98,7 @@ TEST(CSSLayoutTest, padding_flex_child) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -115,17 +115,17 @@ TEST(CSSLayoutTest, padding_flex_child) {
TEST(CSSLayoutTest, padding_stretch_child) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10);
CSSNodeStyleSetPadding(root, CSSEdgeTop, 10);
CSSNodeStyleSetPadding(root, CSSEdgeRight, 10);
CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10);
CSSNodeStyleSetPadding(root, YGEdgeLeft, 10);
CSSNodeStyleSetPadding(root, YGEdgeTop, 10);
CSSNodeStyleSetPadding(root, YGEdgeRight, 10);
CSSNodeStyleSetPadding(root, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -137,7 +137,7 @@ TEST(CSSLayoutTest, padding_stretch_child) {
ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -154,11 +154,11 @@ TEST(CSSLayoutTest, padding_stretch_child) {
TEST(CSSLayoutTest, padding_center_child) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter);
CSSNodeStyleSetAlignItems(root, CSSAlignCenter);
CSSNodeStyleSetPadding(root, CSSEdgeStart, 10);
CSSNodeStyleSetPadding(root, CSSEdgeEnd, 20);
CSSNodeStyleSetPadding(root, CSSEdgeBottom, 20);
CSSNodeStyleSetJustifyContent(root, YGJustifyCenter);
CSSNodeStyleSetAlignItems(root, YGAlignCenter);
CSSNodeStyleSetPadding(root, YGEdgeStart, 10);
CSSNodeStyleSetPadding(root, YGEdgeEnd, 20);
CSSNodeStyleSetPadding(root, YGEdgeBottom, 20);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -166,7 +166,7 @@ TEST(CSSLayoutTest, padding_center_child) {
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -178,7 +178,7 @@ TEST(CSSLayoutTest, padding_center_child) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -195,20 +195,20 @@ TEST(CSSLayoutTest, padding_center_child) {
TEST(CSSLayoutTest, child_with_padding_align_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
CSSNodeStyleSetAlignItems(root, CSSAlignFlexEnd);
CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetAlignItems(root, YGAlignFlexEnd);
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);
CSSNodeStyleSetPadding(root_child0, YGEdgeLeft, 20);
CSSNodeStyleSetPadding(root_child0, YGEdgeTop, 20);
CSSNodeStyleSetPadding(root_child0, YGEdgeRight, 20);
CSSNodeStyleSetPadding(root_child0, YGEdgeBottom, 20);
CSSNodeStyleSetWidth(root_child0, 100);
CSSNodeStyleSetHeight(root_child0, 100);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -220,7 +220,7 @@ TEST(CSSLayoutTest, child_with_padding_align_end) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -11,7 +11,7 @@
#include <gtest/gtest.h>
TEST(CSSLayoutTest, dont_cache_computed_flex_basis_between_layouts) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis, true);
const CSSNodeRef root = CSSNodeNew();
@@ -20,12 +20,12 @@ TEST(CSSLayoutTest, dont_cache_computed_flex_basis_between_layouts) {
CSSNodeStyleSetFlexBasis(root_child0, 20);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, 100, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR);
CSSNodeCalculateLayout(root, 100, YGUndefined, YGDirectionLTR);
CSSNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child0));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis, false);
}

View File

@@ -12,9 +12,9 @@
static CSSSize _measureFloor(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
YGMeasureMode widthMode,
float height,
CSSMeasureMode heightMode) {
YGMeasureMode heightMode) {
return CSSSize{
width = 10.2,
@@ -24,9 +24,9 @@ static CSSSize _measureFloor(CSSNodeRef node,
static CSSSize _measureCeil(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
YGMeasureMode widthMode,
float height,
CSSMeasureMode heightMode) {
YGMeasureMode heightMode) {
return CSSSize{
width = 10.5,
@@ -35,7 +35,7 @@ static CSSSize _measureCeil(CSSNodeRef node,
}
TEST(CSSLayoutTest, rounding_feature_with_custom_measure_func_floor) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
@@ -43,18 +43,18 @@ TEST(CSSLayoutTest, rounding_feature_with_custom_measure_func_floor) {
CSSNodeSetMeasureFunc(root_child0, _measureFloor);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_feature_with_custom_measure_func_ceil) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
@@ -62,12 +62,12 @@ TEST(CSSLayoutTest, rounding_feature_with_custom_measure_func_ceil) {
CSSNodeSetMeasureFunc(root_child0, _measureCeil);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(11, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(11, CSSNodeLayoutGetHeight(root_child0));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}

View File

@@ -13,10 +13,10 @@
#include <gtest/gtest.h>
TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_width_of_100) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -31,7 +31,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_width_of_100) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child2, 1);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -53,7 +53,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_width_of_100) {
ASSERT_FLOAT_EQ(33, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -77,14 +77,14 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_width_of_100) {
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_prime_number_width) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 113);
CSSNodeStyleSetHeight(root, 100);
@@ -107,7 +107,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_prime_number_width) {
const CSSNodeRef root_child4 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child4, 1);
CSSNodeInsertChild(root, root_child4, 4);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -139,7 +139,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_prime_number_width) {
ASSERT_FLOAT_EQ(23, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child4));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -173,14 +173,14 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_prime_number_width) {
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_flex_basis_flex_shrink_row) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 101);
CSSNodeStyleSetHeight(root, 100);
@@ -196,7 +196,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_shrink_row) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetFlexBasis(root_child2, 25);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -218,7 +218,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_shrink_row) {
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -242,11 +242,11 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_shrink_row) {
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_flex_basis_overrides_main_size) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 100);
@@ -267,7 +267,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_overrides_main_size) {
CSSNodeStyleSetFlexGrow(root_child2, 1);
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -289,7 +289,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_overrides_main_size) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -313,11 +313,11 @@ TEST(CSSLayoutTest, rounding_flex_basis_overrides_main_size) {
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_total_fractial) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 87.4f);
@@ -338,7 +338,7 @@ TEST(CSSLayoutTest, rounding_total_fractial) {
CSSNodeStyleSetFlexGrow(root_child2, 1.1f);
CSSNodeStyleSetHeight(root_child2, 10.7f);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -360,7 +360,7 @@ TEST(CSSLayoutTest, rounding_total_fractial) {
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -384,11 +384,11 @@ TEST(CSSLayoutTest, rounding_total_fractial) {
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_total_fractial_nested) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 87.4f);
@@ -403,14 +403,14 @@ TEST(CSSLayoutTest, rounding_total_fractial_nested) {
const CSSNodeRef root_child0_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0_child0, 1);
CSSNodeStyleSetFlexBasis(root_child0_child0, 0.3f);
CSSNodeStyleSetPosition(root_child0_child0, CSSEdgeBottom, 13.3f);
CSSNodeStyleSetPosition(root_child0_child0, YGEdgeBottom, 13.3f);
CSSNodeStyleSetHeight(root_child0_child0, 9.9f);
CSSNodeInsertChild(root_child0, root_child0_child0, 0);
const CSSNodeRef root_child0_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0_child1, 4);
CSSNodeStyleSetFlexBasis(root_child0_child1, 0.3f);
CSSNodeStyleSetPosition(root_child0_child1, CSSEdgeTop, 13.3f);
CSSNodeStyleSetPosition(root_child0_child1, YGEdgeTop, 13.3f);
CSSNodeStyleSetHeight(root_child0_child1, 1.1f);
CSSNodeInsertChild(root_child0, root_child0_child1, 1);
@@ -423,7 +423,7 @@ TEST(CSSLayoutTest, rounding_total_fractial_nested) {
CSSNodeStyleSetFlexGrow(root_child2, 1.1f);
CSSNodeStyleSetHeight(root_child2, 10.7f);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -455,7 +455,7 @@ TEST(CSSLayoutTest, rounding_total_fractial_nested) {
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -489,11 +489,11 @@ TEST(CSSLayoutTest, rounding_total_fractial_nested) {
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_fractial_input_1) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 100);
@@ -514,7 +514,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_1) {
CSSNodeStyleSetFlexGrow(root_child2, 1);
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -536,7 +536,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_1) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -560,11 +560,11 @@ TEST(CSSLayoutTest, rounding_fractial_input_1) {
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_fractial_input_2) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 100);
@@ -585,7 +585,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_2) {
CSSNodeStyleSetFlexGrow(root_child2, 1);
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -607,7 +607,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_2) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -631,14 +631,14 @@ TEST(CSSLayoutTest, rounding_fractial_input_2) {
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_fractial_input_3) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetPosition(root, CSSEdgeTop, 0.3f);
CSSNodeStyleSetPosition(root, YGEdgeTop, 0.3f);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 113.4f);
@@ -657,7 +657,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_3) {
CSSNodeStyleSetFlexGrow(root_child2, 1);
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -679,7 +679,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_3) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -703,14 +703,14 @@ TEST(CSSLayoutTest, rounding_fractial_input_3) {
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_fractial_input_4) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetPosition(root, CSSEdgeTop, 0.7f);
CSSNodeStyleSetPosition(root, YGEdgeTop, 0.7f);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 113.4f);
@@ -729,7 +729,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_4) {
CSSNodeStyleSetFlexGrow(root_child2, 1);
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(1, CSSNodeLayoutGetTop(root));
@@ -751,7 +751,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_4) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(1, CSSNodeLayoutGetTop(root));
@@ -775,5 +775,5 @@ TEST(CSSLayoutTest, rounding_fractial_input_4) {
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
}

View File

@@ -25,16 +25,16 @@ TEST(CSSLayoutTest, copy_style_same) {
TEST(CSSLayoutTest, copy_style_modified) {
const CSSNodeRef node0 = CSSNodeNew();
ASSERT_FALSE(CSSNodeIsDirty(node0));
ASSERT_EQ(CSSFlexDirectionColumn, CSSNodeStyleGetFlexDirection(node0));
ASSERT_EQ(YGFlexDirectionColumn, CSSNodeStyleGetFlexDirection(node0));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMaxHeight(node0)));
const CSSNodeRef node1 = CSSNodeNew();
CSSNodeStyleSetFlexDirection(node1, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(node1, YGFlexDirectionRow);
CSSNodeStyleSetMaxHeight(node1, 10);
CSSNodeCopyStyle(node0, node1);
ASSERT_TRUE(CSSNodeIsDirty(node0));
ASSERT_EQ(CSSFlexDirectionRow, CSSNodeStyleGetFlexDirection(node0));
ASSERT_EQ(YGFlexDirectionRow, CSSNodeStyleGetFlexDirection(node0));
ASSERT_FLOAT_EQ(10, CSSNodeStyleGetMaxHeight(node0));
CSSNodeFree(node0);
@@ -43,13 +43,13 @@ TEST(CSSLayoutTest, copy_style_modified) {
TEST(CSSLayoutTest, copy_style_modified_same) {
const CSSNodeRef node0 = CSSNodeNew();
CSSNodeStyleSetFlexDirection(node0, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(node0, YGFlexDirectionRow);
CSSNodeStyleSetMaxHeight(node0, 10);
CSSNodeCalculateLayout(node0, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(node0, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FALSE(CSSNodeIsDirty(node0));
const CSSNodeRef node1 = CSSNodeNew();
CSSNodeStyleSetFlexDirection(node1, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(node1, YGFlexDirectionRow);
CSSNodeStyleSetMaxHeight(node1, 10);
CSSNodeCopyStyle(node0, node1);