code review changes

This commit is contained in:
Lukas Woehrl
2016-12-19 19:15:48 +01:00
parent e258d9867d
commit a7003b6821
21 changed files with 768 additions and 829 deletions

View File

@@ -12,7 +12,7 @@ function toValueCpp(value) {
return n + (Number(n) == n && n % 1 !== 0 ? 'f' : ''); return n + (Number(n) == n && n % 1 !== 0 ? 'f' : '');
} }
function toValueCppWithUnitCpp(value) { function toValueCppCpp(value) {
var methodName = ''; var methodName = '';
if(value.indexOf('px') >= 0){ if(value.indexOf('px') >= 0){
methodName = 'YGPx'; methodName = 'YGPx';
@@ -164,7 +164,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
}}, }},
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) { YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
this.push('YGNodeStyleSetFlexBasisWithUnit(' + nodeName + ', ' + toValueCppWithUnitCpp(value) + ');'); this.push('YGNodeStyleSetFlexBasis(' + nodeName + ', ' + toValueCppCpp(value) + ');');
}}, }},
YGNodeStyleSetFlexDirection:{value:function(nodeName, value) { YGNodeStyleSetFlexDirection:{value:function(nodeName, value) {
@@ -184,7 +184,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
}}, }},
YGNodeStyleSetHeight:{value:function(nodeName, value) { YGNodeStyleSetHeight:{value:function(nodeName, value) {
this.push('YGNodeStyleSetHeightWithUnit(' + nodeName + ', ' + toValueCppWithUnitCpp(value) + ');'); this.push('YGNodeStyleSetHeight(' + nodeName + ', ' + toValueCppCpp(value) + ');');
}}, }},
YGNodeStyleSetJustifyContent:{value:function(nodeName, value) { YGNodeStyleSetJustifyContent:{value:function(nodeName, value) {
@@ -192,23 +192,23 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
}}, }},
YGNodeStyleSetMargin:{value:function(nodeName, edge, value) { YGNodeStyleSetMargin:{value:function(nodeName, edge, value) {
this.push('YGNodeStyleSetMarginWithUnit(' + nodeName + ', ' + edge + ', ' + toValueCppWithUnitCpp(value) + ');'); this.push('YGNodeStyleSetMargin(' + nodeName + ', ' + edge + ', ' + toValueCppCpp(value) + ');');
}}, }},
YGNodeStyleSetMaxHeight:{value:function(nodeName, value) { YGNodeStyleSetMaxHeight:{value:function(nodeName, value) {
this.push('YGNodeStyleSetMaxHeightWithUnit(' + nodeName + ', ' + toValueCppWithUnitCpp(value) + ');'); this.push('YGNodeStyleSetMaxHeight(' + nodeName + ', ' + toValueCppCpp(value) + ');');
}}, }},
YGNodeStyleSetMaxWidth:{value:function(nodeName, value) { YGNodeStyleSetMaxWidth:{value:function(nodeName, value) {
this.push('YGNodeStyleSetMaxWidthWithUnit(' + nodeName + ', ' + toValueCppWithUnitCpp(value) + ');'); this.push('YGNodeStyleSetMaxWidth(' + nodeName + ', ' + toValueCppCpp(value) + ');');
}}, }},
YGNodeStyleSetMinHeight:{value:function(nodeName, value) { YGNodeStyleSetMinHeight:{value:function(nodeName, value) {
this.push('YGNodeStyleSetMinHeightWithUnit(' + nodeName + ', ' + toValueCppWithUnitCpp(value) + ');'); this.push('YGNodeStyleSetMinHeight(' + nodeName + ', ' + toValueCppCpp(value) + ');');
}}, }},
YGNodeStyleSetMinWidth:{value:function(nodeName, value) { YGNodeStyleSetMinWidth:{value:function(nodeName, value) {
this.push('YGNodeStyleSetMinWidthWithUnit(' + nodeName + ', ' + toValueCppWithUnitCpp(value) + ');'); this.push('YGNodeStyleSetMinWidth(' + nodeName + ', ' + toValueCppCpp(value) + ');');
}}, }},
YGNodeStyleSetOverflow:{value:function(nodeName, value) { YGNodeStyleSetOverflow:{value:function(nodeName, value) {
@@ -216,11 +216,11 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
}}, }},
YGNodeStyleSetPadding:{value:function(nodeName, edge, value) { YGNodeStyleSetPadding:{value:function(nodeName, edge, value) {
this.push('YGNodeStyleSetPaddingWithUnit(' + nodeName + ', ' + edge + ', ' + toValueCppWithUnitCpp(value) + ');'); this.push('YGNodeStyleSetPadding(' + nodeName + ', ' + edge + ', ' + toValueCppCpp(value) + ');');
}}, }},
YGNodeStyleSetPosition:{value:function(nodeName, edge, value) { YGNodeStyleSetPosition:{value:function(nodeName, edge, value) {
this.push('YGNodeStyleSetPositionWithUnit(' + nodeName + ', ' + edge + ', ' + toValueCppWithUnitCpp(value) + ');'); this.push('YGNodeStyleSetPosition(' + nodeName + ', ' + edge + ', ' + toValueCppCpp(value) + ');');
}}, }},
YGNodeStyleSetPositionType:{value:function(nodeName, value) { YGNodeStyleSetPositionType:{value:function(nodeName, value) {
@@ -228,6 +228,6 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
}}, }},
YGNodeStyleSetWidth:{value:function(nodeName, value) { YGNodeStyleSetWidth:{value:function(nodeName, value) {
this.push('YGNodeStyleSetWidthWithUnit(' + nodeName + ', ' + toValueCppWithUnitCpp(value) + ');'); this.push('YGNodeStyleSetWidth(' + nodeName + ', ' + toValueCppCpp(value) + ');');
}}, }},
}); });

View File

@@ -14,15 +14,15 @@
TEST(YogaTest, absolute_layout_width_height_start_top) { TEST(YogaTest, absolute_layout_width_height_start_top) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeStart, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeStart, YGPx(10));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeTop, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeTop, YGPx(10));
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -53,15 +53,15 @@ TEST(YogaTest, absolute_layout_width_height_start_top) {
TEST(YogaTest, absolute_layout_width_height_end_bottom) { TEST(YogaTest, absolute_layout_width_height_end_bottom) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeEnd, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeEnd, YGPx(10));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeBottom, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeBottom, YGPx(10));
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -92,15 +92,15 @@ TEST(YogaTest, absolute_layout_width_height_end_bottom) {
TEST(YogaTest, absolute_layout_start_top_end_bottom) { TEST(YogaTest, absolute_layout_start_top_end_bottom) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeStart, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeStart, YGPx(10));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeTop, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeTop, YGPx(10));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeEnd, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeEnd, YGPx(10));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeBottom, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeBottom, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -131,17 +131,17 @@ TEST(YogaTest, absolute_layout_start_top_end_bottom) {
TEST(YogaTest, absolute_layout_width_height_start_top_end_bottom) { TEST(YogaTest, absolute_layout_width_height_start_top_end_bottom) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeStart, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeStart, YGPx(10));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeTop, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeTop, YGPx(10));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeEnd, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeEnd, YGPx(10));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeBottom, YGPx(10)); YGNodeStyleSetPosition(root_child0, YGEdgeBottom, YGPx(10));
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -174,18 +174,18 @@ TEST(YogaTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hi
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetOverflow(root, YGOverflowHidden); YGNodeStyleSetOverflow(root, YGOverflowHidden);
YGNodeStyleSetWidthWithUnit(root, YGPx(50)); YGNodeStyleSetWidth(root, YGPx(50));
YGNodeStyleSetHeightWithUnit(root, YGPx(50)); YGNodeStyleSetHeight(root, YGPx(50));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeStart, YGPx(0)); YGNodeStyleSetPosition(root_child0, YGEdgeStart, YGPx(0));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeTop, YGPx(0)); YGNodeStyleSetPosition(root_child0, YGEdgeTop, YGPx(0));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child0_child0 = YGNodeNew(); const YGNodeRef root_child0_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0_child0, YGPx(100)); YGNodeStyleSetWidth(root_child0_child0, YGPx(100));
YGNodeStyleSetHeightWithUnit(root_child0_child0, YGPx(100)); YGNodeStyleSetHeight(root_child0_child0, YGPx(100));
YGNodeInsertChild(root_child0, root_child0_child0, 0); YGNodeInsertChild(root_child0, root_child0_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -226,35 +226,35 @@ TEST(YogaTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hi
TEST(YogaTest, absolute_layout_within_border) { TEST(YogaTest, absolute_layout_within_border) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetMarginWithUnit(root, YGEdgeLeft, YGPx(10)); YGNodeStyleSetMargin(root, YGEdgeLeft, YGPx(10));
YGNodeStyleSetMarginWithUnit(root, YGEdgeTop, YGPx(10)); YGNodeStyleSetMargin(root, YGEdgeTop, YGPx(10));
YGNodeStyleSetMarginWithUnit(root, YGEdgeRight, YGPx(10)); YGNodeStyleSetMargin(root, YGEdgeRight, YGPx(10));
YGNodeStyleSetMarginWithUnit(root, YGEdgeBottom, YGPx(10)); YGNodeStyleSetMargin(root, YGEdgeBottom, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeLeft, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeLeft, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeTop, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeTop, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeRight, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeRight, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeBottom, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeBottom, YGPx(10));
YGNodeStyleSetBorder(root, YGEdgeLeft, 10); YGNodeStyleSetBorder(root, YGEdgeLeft, 10);
YGNodeStyleSetBorder(root, YGEdgeTop, 10); YGNodeStyleSetBorder(root, YGEdgeTop, 10);
YGNodeStyleSetBorder(root, YGEdgeRight, 10); YGNodeStyleSetBorder(root, YGEdgeRight, 10);
YGNodeStyleSetBorder(root, YGEdgeBottom, 10); YGNodeStyleSetBorder(root, YGEdgeBottom, 10);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeLeft, YGPx(0)); YGNodeStyleSetPosition(root_child0, YGEdgeLeft, YGPx(0));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeTop, YGPx(0)); YGNodeStyleSetPosition(root_child0, YGEdgeTop, YGPx(0));
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(50)); YGNodeStyleSetWidth(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(50)); YGNodeStyleSetHeight(root_child0, YGPx(50));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetPositionType(root_child1, YGPositionTypeAbsolute); YGNodeStyleSetPositionType(root_child1, YGPositionTypeAbsolute);
YGNodeStyleSetPositionWithUnit(root_child1, YGEdgeRight, YGPx(0)); YGNodeStyleSetPosition(root_child1, YGEdgeRight, YGPx(0));
YGNodeStyleSetPositionWithUnit(root_child1, YGEdgeBottom, YGPx(0)); YGNodeStyleSetPosition(root_child1, YGEdgeBottom, YGPx(0));
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(50)); YGNodeStyleSetWidth(root_child1, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(50)); YGNodeStyleSetHeight(root_child1, YGPx(50));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -15,32 +15,32 @@
TEST(YogaTest, align_content_flex_start) { TEST(YogaTest, align_content_flex_start) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexWrap(root, YGWrapWrap); YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(50)); YGNodeStyleSetWidth(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(50)); YGNodeStyleSetWidth(root_child1, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(50)); YGNodeStyleSetWidth(root_child2, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
const YGNodeRef root_child3 = YGNodeNew(); const YGNodeRef root_child3 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child3, YGPx(50)); YGNodeStyleSetWidth(root_child3, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child3, YGPx(10)); YGNodeStyleSetHeight(root_child3, YGPx(10));
YGNodeInsertChild(root, root_child3, 3); YGNodeInsertChild(root, root_child3, 3);
const YGNodeRef root_child4 = YGNodeNew(); const YGNodeRef root_child4 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child4, YGPx(50)); YGNodeStyleSetWidth(root_child4, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child4, YGPx(10)); YGNodeStyleSetHeight(root_child4, YGPx(10));
YGNodeInsertChild(root, root_child4, 4); YGNodeInsertChild(root, root_child4, 4);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -113,32 +113,32 @@ TEST(YogaTest, align_content_flex_end) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignContent(root, YGAlignFlexEnd); YGNodeStyleSetAlignContent(root, YGAlignFlexEnd);
YGNodeStyleSetFlexWrap(root, YGWrapWrap); YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(50)); YGNodeStyleSetWidth(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(50)); YGNodeStyleSetWidth(root_child1, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(50)); YGNodeStyleSetWidth(root_child2, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
const YGNodeRef root_child3 = YGNodeNew(); const YGNodeRef root_child3 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child3, YGPx(50)); YGNodeStyleSetWidth(root_child3, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child3, YGPx(10)); YGNodeStyleSetHeight(root_child3, YGPx(10));
YGNodeInsertChild(root, root_child3, 3); YGNodeInsertChild(root, root_child3, 3);
const YGNodeRef root_child4 = YGNodeNew(); const YGNodeRef root_child4 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child4, YGPx(50)); YGNodeStyleSetWidth(root_child4, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child4, YGPx(10)); YGNodeStyleSetHeight(root_child4, YGPx(10));
YGNodeInsertChild(root, root_child4, 4); YGNodeInsertChild(root, root_child4, 4);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -211,32 +211,32 @@ TEST(YogaTest, align_content_center) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignContent(root, YGAlignCenter); YGNodeStyleSetAlignContent(root, YGAlignCenter);
YGNodeStyleSetFlexWrap(root, YGWrapWrap); YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(50)); YGNodeStyleSetWidth(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(50)); YGNodeStyleSetWidth(root_child1, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(50)); YGNodeStyleSetWidth(root_child2, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
const YGNodeRef root_child3 = YGNodeNew(); const YGNodeRef root_child3 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child3, YGPx(50)); YGNodeStyleSetWidth(root_child3, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child3, YGPx(10)); YGNodeStyleSetHeight(root_child3, YGPx(10));
YGNodeInsertChild(root, root_child3, 3); YGNodeInsertChild(root, root_child3, 3);
const YGNodeRef root_child4 = YGNodeNew(); const YGNodeRef root_child4 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child4, YGPx(50)); YGNodeStyleSetWidth(root_child4, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child4, YGPx(10)); YGNodeStyleSetHeight(root_child4, YGPx(10));
YGNodeInsertChild(root, root_child4, 4); YGNodeInsertChild(root, root_child4, 4);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -309,27 +309,27 @@ TEST(YogaTest, align_content_stretch) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignContent(root, YGAlignStretch); YGNodeStyleSetAlignContent(root, YGAlignStretch);
YGNodeStyleSetFlexWrap(root, YGWrapWrap); YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(50)); YGNodeStyleSetWidth(root_child0, YGPx(50));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(50)); YGNodeStyleSetWidth(root_child1, YGPx(50));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(50)); YGNodeStyleSetWidth(root_child2, YGPx(50));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
const YGNodeRef root_child3 = YGNodeNew(); const YGNodeRef root_child3 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child3, YGPx(50)); YGNodeStyleSetWidth(root_child3, YGPx(50));
YGNodeInsertChild(root, root_child3, 3); YGNodeInsertChild(root, root_child3, 3);
const YGNodeRef root_child4 = YGNodeNew(); const YGNodeRef root_child4 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child4, YGPx(50)); YGNodeStyleSetWidth(root_child4, YGPx(50));
YGNodeInsertChild(root, root_child4, 4); YGNodeInsertChild(root, root_child4, 4);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -14,11 +14,11 @@
TEST(YogaTest, align_items_stretch) { TEST(YogaTest, align_items_stretch) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -50,12 +50,12 @@ TEST(YogaTest, align_items_stretch) {
TEST(YogaTest, align_items_center) { TEST(YogaTest, align_items_center) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignCenter); YGNodeStyleSetAlignItems(root, YGAlignCenter);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -87,12 +87,12 @@ TEST(YogaTest, align_items_center) {
TEST(YogaTest, align_items_flex_start) { TEST(YogaTest, align_items_flex_start) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart); YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -124,12 +124,12 @@ TEST(YogaTest, align_items_flex_start) {
TEST(YogaTest, align_items_flex_end) { TEST(YogaTest, align_items_flex_end) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexEnd); YGNodeStyleSetAlignItems(root, YGAlignFlexEnd);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -14,13 +14,13 @@
TEST(YogaTest, align_self_center) { TEST(YogaTest, align_self_center) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetAlignSelf(root_child0, YGAlignCenter); YGNodeStyleSetAlignSelf(root_child0, YGAlignCenter);
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -51,13 +51,13 @@ TEST(YogaTest, align_self_center) {
TEST(YogaTest, align_self_flex_end) { TEST(YogaTest, align_self_flex_end) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd); YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd);
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -88,13 +88,13 @@ TEST(YogaTest, align_self_flex_end) {
TEST(YogaTest, align_self_flex_start) { TEST(YogaTest, align_self_flex_start) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexStart); YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexStart);
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -126,13 +126,13 @@ TEST(YogaTest, align_self_flex_start) {
TEST(YogaTest, align_self_flex_end_override_flex_start) { TEST(YogaTest, align_self_flex_end_override_flex_start) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart); YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd); YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd);
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -43,8 +43,8 @@ TEST(YogaTest, border_container_match_child) {
YGNodeStyleSetBorder(root, YGEdgeBottom, 10); YGNodeStyleSetBorder(root, YGEdgeBottom, 10);
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -79,12 +79,12 @@ TEST(YogaTest, border_flex_child) {
YGNodeStyleSetBorder(root, YGEdgeTop, 10); YGNodeStyleSetBorder(root, YGEdgeTop, 10);
YGNodeStyleSetBorder(root, YGEdgeRight, 10); YGNodeStyleSetBorder(root, YGEdgeRight, 10);
YGNodeStyleSetBorder(root, YGEdgeBottom, 10); YGNodeStyleSetBorder(root, YGEdgeBottom, 10);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -119,11 +119,11 @@ TEST(YogaTest, border_stretch_child) {
YGNodeStyleSetBorder(root, YGEdgeTop, 10); YGNodeStyleSetBorder(root, YGEdgeTop, 10);
YGNodeStyleSetBorder(root, YGEdgeRight, 10); YGNodeStyleSetBorder(root, YGEdgeRight, 10);
YGNodeStyleSetBorder(root, YGEdgeBottom, 10); YGNodeStyleSetBorder(root, YGEdgeBottom, 10);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -159,12 +159,12 @@ TEST(YogaTest, border_center_child) {
YGNodeStyleSetBorder(root, YGEdgeStart, 10); YGNodeStyleSetBorder(root, YGEdgeStart, 10);
YGNodeStyleSetBorder(root, YGEdgeEnd, 20); YGNodeStyleSetBorder(root, YGEdgeEnd, 20);
YGNodeStyleSetBorder(root, YGEdgeBottom, 20); YGNodeStyleSetBorder(root, YGEdgeBottom, 20);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -13,22 +13,22 @@
TEST(YogaTest, dirty_propagation) { TEST(YogaTest, dirty_propagation) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart); YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeight(root, 100); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50); YGNodeStyleSetWidth(root_child0, YGPx(50));
YGNodeStyleSetHeight(root_child0, 20); YGNodeStyleSetHeight(root_child0, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidth(root_child1, 50); YGNodeStyleSetWidth(root_child1, YGPx(50));
YGNodeStyleSetHeight(root_child1, 20); YGNodeStyleSetHeight(root_child1, YGPx(20));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
YGNodeStyleSetWidth(root_child0, 20); YGNodeStyleSetWidth(root_child0, YGPx(20));
EXPECT_TRUE(YGNodeIsDirty(root_child0)); EXPECT_TRUE(YGNodeIsDirty(root_child0));
EXPECT_FALSE(YGNodeIsDirty(root_child1)); EXPECT_FALSE(YGNodeIsDirty(root_child1));
@@ -46,22 +46,22 @@ TEST(YogaTest, dirty_propagation) {
TEST(YogaTest, dirty_propagation_only_if_prop_changed) { TEST(YogaTest, dirty_propagation_only_if_prop_changed) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart); YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeight(root, 100); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50); YGNodeStyleSetWidth(root_child0, YGPx(50));
YGNodeStyleSetHeight(root_child0, 20); YGNodeStyleSetHeight(root_child0, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidth(root_child1, 50); YGNodeStyleSetWidth(root_child1, YGPx(50));
YGNodeStyleSetHeight(root_child1, 20); YGNodeStyleSetHeight(root_child1, YGPx(20));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
YGNodeStyleSetWidth(root_child0, 50); YGNodeStyleSetWidth(root_child0, YGPx(50));
EXPECT_FALSE(YGNodeIsDirty(root_child0)); EXPECT_FALSE(YGNodeIsDirty(root_child0));
EXPECT_FALSE(YGNodeIsDirty(root_child1)); EXPECT_FALSE(YGNodeIsDirty(root_child1));
@@ -73,12 +73,12 @@ TEST(YogaTest, dirty_propagation_only_if_prop_changed) {
TEST(YogaTest, dirty_node_only_if_children_are_actually_removed) { TEST(YogaTest, dirty_node_only_if_children_are_actually_removed) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart); YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 50); YGNodeStyleSetWidth(root, YGPx(50));
YGNodeStyleSetHeight(root, 50); YGNodeStyleSetHeight(root, YGPx(50));
const YGNodeRef child0 = YGNodeNew(); const YGNodeRef child0 = YGNodeNew();
YGNodeStyleSetWidth(child0, 50); YGNodeStyleSetWidth(child0, YGPx(50));
YGNodeStyleSetHeight(child0, 25); YGNodeStyleSetHeight(child0, YGPx(25));
YGNodeInsertChild(root, child0, 0); YGNodeInsertChild(root, child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -13,14 +13,14 @@
TEST(YogaTest, start_overrides) { TEST(YogaTest, start_overrides) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidth(root, 100); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeight(root, 100); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMargin(root_child0, YGEdgeStart, 10); YGNodeStyleSetMargin(root_child0, YGEdgeStart, YGPx(10));
YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 20); YGNodeStyleSetMargin(root_child0, YGEdgeLeft, YGPx(20));
YGNodeStyleSetMargin(root_child0, YGEdgeRight, 20); YGNodeStyleSetMargin(root_child0, YGEdgeRight, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -37,14 +37,14 @@ TEST(YogaTest, start_overrides) {
TEST(YogaTest, end_overrides) { TEST(YogaTest, end_overrides) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidth(root, 100); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeight(root, 100); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMargin(root_child0, YGEdgeEnd, 10); YGNodeStyleSetMargin(root_child0, YGEdgeEnd, YGPx(10));
YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 20); YGNodeStyleSetMargin(root_child0, YGEdgeLeft, YGPx(20));
YGNodeStyleSetMargin(root_child0, YGEdgeRight, 20); YGNodeStyleSetMargin(root_child0, YGEdgeRight, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -61,13 +61,13 @@ TEST(YogaTest, end_overrides) {
TEST(YogaTest, horizontal_overridden) { TEST(YogaTest, horizontal_overridden) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidth(root, 100); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeight(root, 100); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMargin(root_child0, YGEdgeHorizontal, 10); YGNodeStyleSetMargin(root_child0, YGEdgeHorizontal, YGPx(10));
YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 20); YGNodeStyleSetMargin(root_child0, YGEdgeLeft, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -80,13 +80,13 @@ TEST(YogaTest, horizontal_overridden) {
TEST(YogaTest, vertical_overridden) { TEST(YogaTest, vertical_overridden) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumn); YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
YGNodeStyleSetWidth(root, 100); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeight(root, 100); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMargin(root_child0, YGEdgeVertical, 10); YGNodeStyleSetMargin(root_child0, YGEdgeVertical, YGPx(10));
YGNodeStyleSetMargin(root_child0, YGEdgeTop, 20); YGNodeStyleSetMargin(root_child0, YGEdgeTop, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -99,13 +99,13 @@ TEST(YogaTest, vertical_overridden) {
TEST(YogaTest, horizontal_overrides_all) { TEST(YogaTest, horizontal_overrides_all) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumn); YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
YGNodeStyleSetWidth(root, 100); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeight(root, 100); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMargin(root_child0, YGEdgeHorizontal, 10); YGNodeStyleSetMargin(root_child0, YGEdgeHorizontal, YGPx(10));
YGNodeStyleSetMargin(root_child0, YGEdgeAll, 20); YGNodeStyleSetMargin(root_child0, YGEdgeAll, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -120,13 +120,13 @@ TEST(YogaTest, horizontal_overrides_all) {
TEST(YogaTest, vertical_overrides_all) { TEST(YogaTest, vertical_overrides_all) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumn); YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
YGNodeStyleSetWidth(root, 100); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeight(root, 100); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMargin(root_child0, YGEdgeVertical, 10); YGNodeStyleSetMargin(root_child0, YGEdgeVertical, YGPx(10));
YGNodeStyleSetMargin(root_child0, YGEdgeAll, 20); YGNodeStyleSetMargin(root_child0, YGEdgeAll, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -141,16 +141,16 @@ TEST(YogaTest, vertical_overrides_all) {
TEST(YogaTest, all_overridden) { TEST(YogaTest, all_overridden) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumn); YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
YGNodeStyleSetWidth(root, 100); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeight(root, 100); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 10); YGNodeStyleSetMargin(root_child0, YGEdgeLeft, YGPx(10));
YGNodeStyleSetMargin(root_child0, YGEdgeTop, 10); YGNodeStyleSetMargin(root_child0, YGEdgeTop, YGPx(10));
YGNodeStyleSetMargin(root_child0, YGEdgeRight, 10); YGNodeStyleSetMargin(root_child0, YGEdgeRight, YGPx(10));
YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 10); YGNodeStyleSetMargin(root_child0, YGEdgeBottom, YGPx(10));
YGNodeStyleSetMargin(root_child0, YGEdgeAll, 20); YGNodeStyleSetMargin(root_child0, YGEdgeAll, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -14,18 +14,18 @@
TEST(YogaTest, flex_direction_column_no_height) { TEST(YogaTest, flex_direction_column_no_height) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -77,18 +77,18 @@ TEST(YogaTest, flex_direction_column_no_height) {
TEST(YogaTest, flex_direction_row_no_width) { TEST(YogaTest, flex_direction_row_no_width) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(10)); YGNodeStyleSetWidth(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(10)); YGNodeStyleSetWidth(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -139,19 +139,19 @@ TEST(YogaTest, flex_direction_row_no_width) {
TEST(YogaTest, flex_direction_column) { TEST(YogaTest, flex_direction_column) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -203,19 +203,19 @@ TEST(YogaTest, flex_direction_column) {
TEST(YogaTest, flex_direction_row) { TEST(YogaTest, flex_direction_row) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(10)); YGNodeStyleSetWidth(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(10)); YGNodeStyleSetWidth(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -267,19 +267,19 @@ TEST(YogaTest, flex_direction_row) {
TEST(YogaTest, flex_direction_column_reverse) { TEST(YogaTest, flex_direction_column_reverse) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse); YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -331,19 +331,19 @@ TEST(YogaTest, flex_direction_column_reverse) {
TEST(YogaTest, flex_direction_row_reverse) { TEST(YogaTest, flex_direction_row_reverse) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(10)); YGNodeStyleSetWidth(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(10)); YGNodeStyleSetWidth(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -14,12 +14,12 @@
TEST(YogaTest, flex_basis_flex_grow_column) { TEST(YogaTest, flex_basis_flex_grow_column) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(50)); YGNodeStyleSetFlexBasis(root_child0, YGPx(50));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
@@ -65,12 +65,12 @@ TEST(YogaTest, flex_basis_flex_grow_column) {
TEST(YogaTest, flex_basis_flex_grow_row) { TEST(YogaTest, flex_basis_flex_grow_row) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(50)); YGNodeStyleSetFlexBasis(root_child0, YGPx(50));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
@@ -115,16 +115,16 @@ TEST(YogaTest, flex_basis_flex_grow_row) {
TEST(YogaTest, flex_basis_flex_shrink_column) { TEST(YogaTest, flex_basis_flex_shrink_column) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexShrink(root_child0, 1); YGNodeStyleSetFlexShrink(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(100)); YGNodeStyleSetFlexBasis(root_child0, YGPx(100));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPx(50)); YGNodeStyleSetFlexBasis(root_child1, YGPx(50));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -166,16 +166,16 @@ TEST(YogaTest, flex_basis_flex_shrink_column) {
TEST(YogaTest, flex_basis_flex_shrink_row) { TEST(YogaTest, flex_basis_flex_shrink_row) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexShrink(root_child0, 1); YGNodeStyleSetFlexShrink(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(100)); YGNodeStyleSetFlexBasis(root_child0, YGPx(100));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPx(50)); YGNodeStyleSetFlexBasis(root_child1, YGPx(50));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -216,22 +216,22 @@ TEST(YogaTest, flex_basis_flex_shrink_row) {
TEST(YogaTest, flex_shrink_to_zero) { TEST(YogaTest, flex_shrink_to_zero) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root, YGPx(75)); YGNodeStyleSetHeight(root, YGPx(75));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(50)); YGNodeStyleSetWidth(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(50)); YGNodeStyleSetHeight(root_child0, YGPx(50));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexShrink(root_child1, 1); YGNodeStyleSetFlexShrink(root_child1, 1);
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(50)); YGNodeStyleSetWidth(root_child1, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(50)); YGNodeStyleSetHeight(root_child1, YGPx(50));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(50)); YGNodeStyleSetWidth(root_child2, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(50)); YGNodeStyleSetHeight(root_child2, YGPx(50));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -282,23 +282,23 @@ TEST(YogaTest, flex_shrink_to_zero) {
TEST(YogaTest, flex_basis_overrides_main_size) { TEST(YogaTest, flex_basis_overrides_main_size) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(50)); YGNodeStyleSetFlexBasis(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(20)); YGNodeStyleSetHeight(root_child0, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 1); YGNodeStyleSetFlexGrow(root_child1, 1);
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child2, 1); YGNodeStyleSetFlexGrow(root_child2, 1);
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -349,8 +349,8 @@ TEST(YogaTest, flex_basis_overrides_main_size) {
TEST(YogaTest, flex_grow_shrink_at_most) { TEST(YogaTest, flex_grow_shrink_at_most) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);

View File

@@ -15,26 +15,26 @@
TEST(YogaTest, wrap_column) { TEST(YogaTest, wrap_column) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexWrap(root, YGWrapWrap); YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(30)); YGNodeStyleSetWidth(root_child0, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(30)); YGNodeStyleSetHeight(root_child0, YGPx(30));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(30)); YGNodeStyleSetWidth(root_child1, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(30)); YGNodeStyleSetHeight(root_child1, YGPx(30));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(30)); YGNodeStyleSetWidth(root_child2, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(30)); YGNodeStyleSetHeight(root_child2, YGPx(30));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
const YGNodeRef root_child3 = YGNodeNew(); const YGNodeRef root_child3 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child3, YGPx(30)); YGNodeStyleSetWidth(root_child3, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child3, YGPx(30)); YGNodeStyleSetHeight(root_child3, YGPx(30));
YGNodeInsertChild(root, root_child3, 3); YGNodeInsertChild(root, root_child3, 3);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -97,26 +97,26 @@ TEST(YogaTest, wrap_row) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetFlexWrap(root, YGWrapWrap); YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(30)); YGNodeStyleSetWidth(root_child0, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(30)); YGNodeStyleSetHeight(root_child0, YGPx(30));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(30)); YGNodeStyleSetWidth(root_child1, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(30)); YGNodeStyleSetHeight(root_child1, YGPx(30));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(30)); YGNodeStyleSetWidth(root_child2, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(30)); YGNodeStyleSetHeight(root_child2, YGPx(30));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
const YGNodeRef root_child3 = YGNodeNew(); const YGNodeRef root_child3 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child3, YGPx(30)); YGNodeStyleSetWidth(root_child3, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child3, YGPx(30)); YGNodeStyleSetHeight(root_child3, YGPx(30));
YGNodeInsertChild(root, root_child3, 3); YGNodeInsertChild(root, root_child3, 3);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -180,26 +180,26 @@ TEST(YogaTest, wrap_row_align_items_flex_end) {
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignFlexEnd); YGNodeStyleSetAlignItems(root, YGAlignFlexEnd);
YGNodeStyleSetFlexWrap(root, YGWrapWrap); YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(30)); YGNodeStyleSetWidth(root_child0, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(30)); YGNodeStyleSetWidth(root_child1, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(20)); YGNodeStyleSetHeight(root_child1, YGPx(20));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(30)); YGNodeStyleSetWidth(root_child2, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(30)); YGNodeStyleSetHeight(root_child2, YGPx(30));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
const YGNodeRef root_child3 = YGNodeNew(); const YGNodeRef root_child3 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child3, YGPx(30)); YGNodeStyleSetWidth(root_child3, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child3, YGPx(30)); YGNodeStyleSetHeight(root_child3, YGPx(30));
YGNodeInsertChild(root, root_child3, 3); YGNodeInsertChild(root, root_child3, 3);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -263,26 +263,26 @@ TEST(YogaTest, wrap_row_align_items_center) {
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignCenter); YGNodeStyleSetAlignItems(root, YGAlignCenter);
YGNodeStyleSetFlexWrap(root, YGWrapWrap); YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(30)); YGNodeStyleSetWidth(root_child0, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(30)); YGNodeStyleSetWidth(root_child1, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(20)); YGNodeStyleSetHeight(root_child1, YGPx(20));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(30)); YGNodeStyleSetWidth(root_child2, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(30)); YGNodeStyleSetHeight(root_child2, YGPx(30));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
const YGNodeRef root_child3 = YGNodeNew(); const YGNodeRef root_child3 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child3, YGPx(30)); YGNodeStyleSetWidth(root_child3, YGPx(30));
YGNodeStyleSetHeightWithUnit(root_child3, YGPx(30)); YGNodeStyleSetHeight(root_child3, YGPx(30));
YGNodeInsertChild(root, root_child3, 3); YGNodeInsertChild(root, root_child3, 3);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -15,19 +15,19 @@
TEST(YogaTest, justify_content_row_flex_start) { TEST(YogaTest, justify_content_row_flex_start) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(102)); YGNodeStyleSetWidth(root, YGPx(102));
YGNodeStyleSetHeightWithUnit(root, YGPx(102)); YGNodeStyleSetHeight(root, YGPx(102));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(10)); YGNodeStyleSetWidth(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(10)); YGNodeStyleSetWidth(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -80,19 +80,19 @@ TEST(YogaTest, justify_content_row_flex_end) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd); YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
YGNodeStyleSetWidthWithUnit(root, YGPx(102)); YGNodeStyleSetWidth(root, YGPx(102));
YGNodeStyleSetHeightWithUnit(root, YGPx(102)); YGNodeStyleSetHeight(root, YGPx(102));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(10)); YGNodeStyleSetWidth(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(10)); YGNodeStyleSetWidth(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -145,19 +145,19 @@ TEST(YogaTest, justify_content_row_center) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetJustifyContent(root, YGJustifyCenter); YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
YGNodeStyleSetWidthWithUnit(root, YGPx(102)); YGNodeStyleSetWidth(root, YGPx(102));
YGNodeStyleSetHeightWithUnit(root, YGPx(102)); YGNodeStyleSetHeight(root, YGPx(102));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(10)); YGNodeStyleSetWidth(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(10)); YGNodeStyleSetWidth(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -210,19 +210,19 @@ TEST(YogaTest, justify_content_row_space_between) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetJustifyContent(root, YGJustifySpaceBetween); YGNodeStyleSetJustifyContent(root, YGJustifySpaceBetween);
YGNodeStyleSetWidthWithUnit(root, YGPx(102)); YGNodeStyleSetWidth(root, YGPx(102));
YGNodeStyleSetHeightWithUnit(root, YGPx(102)); YGNodeStyleSetHeight(root, YGPx(102));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(10)); YGNodeStyleSetWidth(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(10)); YGNodeStyleSetWidth(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -275,19 +275,19 @@ TEST(YogaTest, justify_content_row_space_around) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetJustifyContent(root, YGJustifySpaceAround); YGNodeStyleSetJustifyContent(root, YGJustifySpaceAround);
YGNodeStyleSetWidthWithUnit(root, YGPx(102)); YGNodeStyleSetWidth(root, YGPx(102));
YGNodeStyleSetHeightWithUnit(root, YGPx(102)); YGNodeStyleSetHeight(root, YGPx(102));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(10)); YGNodeStyleSetWidth(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(10)); YGNodeStyleSetWidth(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -338,18 +338,18 @@ TEST(YogaTest, justify_content_row_space_around) {
TEST(YogaTest, justify_content_column_flex_start) { TEST(YogaTest, justify_content_column_flex_start) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(102)); YGNodeStyleSetWidth(root, YGPx(102));
YGNodeStyleSetHeightWithUnit(root, YGPx(102)); YGNodeStyleSetHeight(root, YGPx(102));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -401,19 +401,19 @@ TEST(YogaTest, justify_content_column_flex_start) {
TEST(YogaTest, justify_content_column_flex_end) { TEST(YogaTest, justify_content_column_flex_end) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd); YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
YGNodeStyleSetWidthWithUnit(root, YGPx(102)); YGNodeStyleSetWidth(root, YGPx(102));
YGNodeStyleSetHeightWithUnit(root, YGPx(102)); YGNodeStyleSetHeight(root, YGPx(102));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -465,19 +465,19 @@ TEST(YogaTest, justify_content_column_flex_end) {
TEST(YogaTest, justify_content_column_center) { TEST(YogaTest, justify_content_column_center) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetJustifyContent(root, YGJustifyCenter); YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
YGNodeStyleSetWidthWithUnit(root, YGPx(102)); YGNodeStyleSetWidth(root, YGPx(102));
YGNodeStyleSetHeightWithUnit(root, YGPx(102)); YGNodeStyleSetHeight(root, YGPx(102));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -529,19 +529,19 @@ TEST(YogaTest, justify_content_column_center) {
TEST(YogaTest, justify_content_column_space_between) { TEST(YogaTest, justify_content_column_space_between) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetJustifyContent(root, YGJustifySpaceBetween); YGNodeStyleSetJustifyContent(root, YGJustifySpaceBetween);
YGNodeStyleSetWidthWithUnit(root, YGPx(102)); YGNodeStyleSetWidth(root, YGPx(102));
YGNodeStyleSetHeightWithUnit(root, YGPx(102)); YGNodeStyleSetHeight(root, YGPx(102));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -593,19 +593,19 @@ TEST(YogaTest, justify_content_column_space_between) {
TEST(YogaTest, justify_content_column_space_around) { TEST(YogaTest, justify_content_column_space_around) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetJustifyContent(root, YGJustifySpaceAround); YGNodeStyleSetJustifyContent(root, YGJustifySpaceAround);
YGNodeStyleSetWidthWithUnit(root, YGPx(102)); YGNodeStyleSetWidth(root, YGPx(102));
YGNodeStyleSetHeightWithUnit(root, YGPx(102)); YGNodeStyleSetHeight(root, YGPx(102));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -27,28 +27,28 @@ TEST(YogaTest, assert_default_values) {
ASSERT_EQ(YGOverflowVisible, YGNodeStyleGetOverflow(root)); ASSERT_EQ(YGOverflowVisible, YGNodeStyleGetOverflow(root));
ASSERT_FLOAT_EQ(0, YGNodeStyleGetFlexGrow(root)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetFlexGrow(root));
ASSERT_FLOAT_EQ(0, YGNodeStyleGetFlexShrink(root)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetFlexShrink(root));
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetFlexBasis(root))); ASSERT_FALSE(YGNodeStyleGetFlexBasis(root).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetPosition(root, YGEdgeLeft))); ASSERT_FALSE(YGNodeStyleGetPosition(root, YGEdgeLeft).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetPosition(root, YGEdgeTop))); ASSERT_FALSE(YGNodeStyleGetPosition(root, YGEdgeTop).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetPosition(root, YGEdgeRight))); ASSERT_FALSE(YGNodeStyleGetPosition(root, YGEdgeRight).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetPosition(root, YGEdgeBottom))); ASSERT_FALSE(YGNodeStyleGetPosition(root, YGEdgeBottom).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetPosition(root, YGEdgeStart))); ASSERT_FALSE(YGNodeStyleGetPosition(root, YGEdgeStart).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetPosition(root, YGEdgeEnd))); ASSERT_FALSE(YGNodeStyleGetPosition(root, YGEdgeEnd).defined);
ASSERT_FLOAT_EQ(0, YGNodeStyleGetMargin(root, YGEdgeLeft)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetMargin(root, YGEdgeLeft).value);
ASSERT_FLOAT_EQ(0, YGNodeStyleGetMargin(root, YGEdgeTop)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetMargin(root, YGEdgeTop).value);
ASSERT_FLOAT_EQ(0, YGNodeStyleGetMargin(root, YGEdgeRight)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetMargin(root, YGEdgeRight).value);
ASSERT_FLOAT_EQ(0, YGNodeStyleGetMargin(root, YGEdgeBottom)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetMargin(root, YGEdgeBottom).value);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetMargin(root, YGEdgeStart))); ASSERT_FALSE(YGNodeStyleGetMargin(root, YGEdgeStart).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetMargin(root, YGEdgeEnd))); ASSERT_FALSE(YGNodeStyleGetMargin(root, YGEdgeEnd).defined);
ASSERT_FLOAT_EQ(0, YGNodeStyleGetPadding(root, YGEdgeLeft)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetPadding(root, YGEdgeLeft).value);
ASSERT_FLOAT_EQ(0, YGNodeStyleGetPadding(root, YGEdgeTop)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetPadding(root, YGEdgeTop).value);
ASSERT_FLOAT_EQ(0, YGNodeStyleGetPadding(root, YGEdgeRight)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetPadding(root, YGEdgeRight).value);
ASSERT_FLOAT_EQ(0, YGNodeStyleGetPadding(root, YGEdgeBottom)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetPadding(root, YGEdgeBottom).value);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetPadding(root, YGEdgeStart))); ASSERT_FALSE(YGNodeStyleGetPadding(root, YGEdgeStart).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetPadding(root, YGEdgeEnd))); ASSERT_FALSE(YGNodeStyleGetPadding(root, YGEdgeEnd).defined);
ASSERT_FLOAT_EQ(0, YGNodeStyleGetBorder(root, YGEdgeLeft)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetBorder(root, YGEdgeLeft));
ASSERT_FLOAT_EQ(0, YGNodeStyleGetBorder(root, YGEdgeTop)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetBorder(root, YGEdgeTop));
@@ -57,12 +57,12 @@ TEST(YogaTest, assert_default_values) {
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetBorder(root, YGEdgeStart))); ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetBorder(root, YGEdgeStart)));
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetBorder(root, YGEdgeEnd))); ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetBorder(root, YGEdgeEnd)));
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetWidth(root))); ASSERT_FALSE(YGNodeStyleGetWidth(root).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetHeight(root))); ASSERT_FALSE(YGNodeStyleGetHeight(root).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetMinWidth(root))); ASSERT_FALSE(YGNodeStyleGetMinWidth(root).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetMinHeight(root))); ASSERT_FALSE(YGNodeStyleGetMinHeight(root).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetMaxWidth(root))); ASSERT_FALSE(YGNodeStyleGetMaxWidth(root).defined);
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetMaxHeight(root))); ASSERT_FALSE(YGNodeStyleGetMaxHeight(root).defined);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));

View File

@@ -15,12 +15,12 @@
TEST(YogaTest, margin_start) { TEST(YogaTest, margin_start) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeStart, YGPx(10)); YGNodeStyleSetMargin(root_child0, YGEdgeStart, YGPx(10));
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -51,12 +51,12 @@ TEST(YogaTest, margin_start) {
TEST(YogaTest, margin_top) { TEST(YogaTest, margin_top) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeTop, YGPx(10)); YGNodeStyleSetMargin(root_child0, YGEdgeTop, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -89,12 +89,12 @@ TEST(YogaTest, margin_end) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd); YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeEnd, YGPx(10)); YGNodeStyleSetMargin(root_child0, YGEdgeEnd, YGPx(10));
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -126,12 +126,12 @@ TEST(YogaTest, margin_end) {
TEST(YogaTest, margin_bottom) { TEST(YogaTest, margin_bottom) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd); YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeBottom, YGPx(10)); YGNodeStyleSetMargin(root_child0, YGEdgeBottom, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -163,12 +163,12 @@ TEST(YogaTest, margin_bottom) {
TEST(YogaTest, margin_and_flex_row) { TEST(YogaTest, margin_and_flex_row) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeStart, YGPx(10)); YGNodeStyleSetMargin(root_child0, YGEdgeStart, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -199,12 +199,12 @@ TEST(YogaTest, margin_and_flex_row) {
TEST(YogaTest, margin_and_flex_column) { TEST(YogaTest, margin_and_flex_column) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeTop, YGPx(10)); YGNodeStyleSetMargin(root_child0, YGEdgeTop, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -236,12 +236,12 @@ TEST(YogaTest, margin_and_flex_column) {
TEST(YogaTest, margin_and_stretch_row) { TEST(YogaTest, margin_and_stretch_row) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeTop, YGPx(10)); YGNodeStyleSetMargin(root_child0, YGEdgeTop, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -272,12 +272,12 @@ TEST(YogaTest, margin_and_stretch_row) {
TEST(YogaTest, margin_and_stretch_column) { TEST(YogaTest, margin_and_stretch_column) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeStart, YGPx(10)); YGNodeStyleSetMargin(root_child0, YGEdgeStart, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -309,8 +309,8 @@ TEST(YogaTest, margin_and_stretch_column) {
TEST(YogaTest, margin_with_sibling_row) { TEST(YogaTest, margin_with_sibling_row) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
@@ -358,8 +358,8 @@ TEST(YogaTest, margin_with_sibling_row) {
TEST(YogaTest, margin_with_sibling_column) { TEST(YogaTest, margin_with_sibling_column) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);

View File

@@ -14,12 +14,12 @@
TEST(YogaTest, max_width) { TEST(YogaTest, max_width) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetMaxWidthWithUnit(root_child0, YGPx(50)); YGNodeStyleSetMaxWidth(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -51,12 +51,12 @@ TEST(YogaTest, max_width) {
TEST(YogaTest, max_height) { TEST(YogaTest, max_height) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetMaxHeightWithUnit(root_child0, YGPx(50)); YGNodeStyleSetMaxHeight(root_child0, YGPx(50));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -87,12 +87,12 @@ TEST(YogaTest, max_height) {
TEST(YogaTest, min_height) { TEST(YogaTest, min_height) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMinHeightWithUnit(root_child0, YGPx(60)); YGNodeStyleSetMinHeight(root_child0, YGPx(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
@@ -138,12 +138,12 @@ TEST(YogaTest, min_height) {
TEST(YogaTest, min_width) { TEST(YogaTest, min_width) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMinWidthWithUnit(root_child0, YGPx(60)); YGNodeStyleSetMinWidth(root_child0, YGPx(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
@@ -189,13 +189,13 @@ TEST(YogaTest, min_width) {
TEST(YogaTest, justify_content_min_max) { TEST(YogaTest, justify_content_min_max) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetJustifyContent(root, YGJustifyCenter); YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetMinHeightWithUnit(root, YGPx(100)); YGNodeStyleSetMinHeight(root, YGPx(100));
YGNodeStyleSetMaxHeightWithUnit(root, YGPx(200)); YGNodeStyleSetMaxHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(60)); YGNodeStyleSetWidth(root_child0, YGPx(60));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(60)); YGNodeStyleSetHeight(root_child0, YGPx(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -227,13 +227,13 @@ TEST(YogaTest, justify_content_min_max) {
TEST(YogaTest, align_items_min_max) { TEST(YogaTest, align_items_min_max) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignCenter); YGNodeStyleSetAlignItems(root, YGAlignCenter);
YGNodeStyleSetMinWidthWithUnit(root, YGPx(100)); YGNodeStyleSetMinWidth(root, YGPx(100));
YGNodeStyleSetMaxWidthWithUnit(root, YGPx(200)); YGNodeStyleSetMaxWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(60)); YGNodeStyleSetWidth(root_child0, YGPx(60));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(60)); YGNodeStyleSetHeight(root_child0, YGPx(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -265,22 +265,22 @@ TEST(YogaTest, align_items_min_max) {
TEST(YogaTest, justify_content_overflow_min_max) { TEST(YogaTest, justify_content_overflow_min_max) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetJustifyContent(root, YGJustifyCenter); YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
YGNodeStyleSetMinHeightWithUnit(root, YGPx(100)); YGNodeStyleSetMinHeight(root, YGPx(100));
YGNodeStyleSetMaxHeightWithUnit(root, YGPx(110)); YGNodeStyleSetMaxHeight(root, YGPx(110));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(50)); YGNodeStyleSetWidth(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(50)); YGNodeStyleSetHeight(root_child0, YGPx(50));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child1, YGPx(50)); YGNodeStyleSetWidth(root_child1, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(50)); YGNodeStyleSetHeight(root_child1, YGPx(50));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child2, YGPx(50)); YGNodeStyleSetWidth(root_child2, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(50)); YGNodeStyleSetHeight(root_child2, YGPx(50));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -331,17 +331,17 @@ TEST(YogaTest, justify_content_overflow_min_max) {
TEST(YogaTest, flex_grow_within_max_width) { TEST(YogaTest, flex_grow_within_max_width) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
YGNodeStyleSetMaxWidthWithUnit(root_child0, YGPx(100)); YGNodeStyleSetMaxWidth(root_child0, YGPx(100));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child0_child0 = YGNodeNew(); const YGNodeRef root_child0_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0_child0, 1); YGNodeStyleSetFlexGrow(root_child0_child0, 1);
YGNodeStyleSetHeightWithUnit(root_child0_child0, YGPx(20)); YGNodeStyleSetHeight(root_child0_child0, YGPx(20));
YGNodeInsertChild(root_child0, root_child0_child0, 0); YGNodeInsertChild(root_child0, root_child0_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -382,17 +382,17 @@ TEST(YogaTest, flex_grow_within_max_width) {
TEST(YogaTest, flex_grow_within_constrained_max_width) { TEST(YogaTest, flex_grow_within_constrained_max_width) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
YGNodeStyleSetMaxWidthWithUnit(root_child0, YGPx(300)); YGNodeStyleSetMaxWidth(root_child0, YGPx(300));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child0_child0 = YGNodeNew(); const YGNodeRef root_child0_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0_child0, 1); YGNodeStyleSetFlexGrow(root_child0_child0, 1);
YGNodeStyleSetHeightWithUnit(root_child0_child0, YGPx(20)); YGNodeStyleSetHeight(root_child0_child0, YGPx(20));
YGNodeInsertChild(root_child0, root_child0_child0, 0); YGNodeInsertChild(root_child0, root_child0_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -14,10 +14,10 @@
TEST(YogaTest, padding_no_size) { TEST(YogaTest, padding_no_size) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetPaddingWithUnit(root, YGEdgeLeft, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeLeft, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeTop, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeTop, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeRight, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeRight, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeBottom, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeBottom, YGPx(10));
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
@@ -37,14 +37,14 @@ TEST(YogaTest, padding_no_size) {
TEST(YogaTest, padding_container_match_child) { TEST(YogaTest, padding_container_match_child) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetPaddingWithUnit(root, YGEdgeLeft, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeLeft, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeTop, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeTop, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeRight, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeRight, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeBottom, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeBottom, YGPx(10));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -75,16 +75,16 @@ TEST(YogaTest, padding_container_match_child) {
TEST(YogaTest, padding_flex_child) { TEST(YogaTest, padding_flex_child) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetPaddingWithUnit(root, YGEdgeLeft, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeLeft, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeTop, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeTop, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeRight, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeRight, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeBottom, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeBottom, YGPx(10));
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -115,15 +115,15 @@ TEST(YogaTest, padding_flex_child) {
TEST(YogaTest, padding_stretch_child) { TEST(YogaTest, padding_stretch_child) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetPaddingWithUnit(root, YGEdgeLeft, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeLeft, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeTop, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeTop, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeRight, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeRight, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeBottom, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeBottom, YGPx(10));
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -156,15 +156,15 @@ TEST(YogaTest, padding_center_child) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetJustifyContent(root, YGJustifyCenter); YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
YGNodeStyleSetAlignItems(root, YGAlignCenter); YGNodeStyleSetAlignItems(root, YGAlignCenter);
YGNodeStyleSetPaddingWithUnit(root, YGEdgeStart, YGPx(10)); YGNodeStyleSetPadding(root, YGEdgeStart, YGPx(10));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeEnd, YGPx(20)); YGNodeStyleSetPadding(root, YGEdgeEnd, YGPx(20));
YGNodeStyleSetPaddingWithUnit(root, YGEdgeBottom, YGPx(20)); YGNodeStyleSetPadding(root, YGEdgeBottom, YGPx(20));
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -197,16 +197,16 @@ TEST(YogaTest, child_with_padding_align_end) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd); YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
YGNodeStyleSetAlignItems(root, YGAlignFlexEnd); YGNodeStyleSetAlignItems(root, YGAlignFlexEnd);
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeLeft, YGPx(20)); YGNodeStyleSetPadding(root_child0, YGEdgeLeft, YGPx(20));
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeTop, YGPx(20)); YGNodeStyleSetPadding(root_child0, YGEdgeTop, YGPx(20));
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeRight, YGPx(20)); YGNodeStyleSetPadding(root_child0, YGEdgeRight, YGPx(20));
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeBottom, YGPx(20)); YGNodeStyleSetPadding(root_child0, YGEdgeBottom, YGPx(20));
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(100)); YGNodeStyleSetWidth(root_child0, YGPx(100));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(100)); YGNodeStyleSetHeight(root_child0, YGPx(100));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -17,12 +17,12 @@ TEST(YogaTest, percentage_width_height) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0, YGPercent(30)); YGNodeStyleSetWidth(root_child0, YGPercent(30));
YGNodeStyleSetHeightWithUnit(root_child0, YGPercent(30)); YGNodeStyleSetHeight(root_child0, YGPercent(30));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -58,14 +58,14 @@ TEST(YogaTest, percentage_position_left_top) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(400)); YGNodeStyleSetWidth(root, YGPx(400));
YGNodeStyleSetHeightWithUnit(root, YGPx(400)); YGNodeStyleSetHeight(root, YGPx(400));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeLeft, YGPercent(10)); YGNodeStyleSetPosition(root_child0, YGEdgeLeft, YGPercent(10));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeTop, YGPercent(20)); YGNodeStyleSetPosition(root_child0, YGEdgeTop, YGPercent(20));
YGNodeStyleSetWidthWithUnit(root_child0, YGPercent(45)); YGNodeStyleSetWidth(root_child0, YGPercent(45));
YGNodeStyleSetHeightWithUnit(root_child0, YGPercent(55)); YGNodeStyleSetHeight(root_child0, YGPercent(55));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -101,14 +101,14 @@ TEST(YogaTest, percentage_position_bottom_right) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(500)); YGNodeStyleSetWidth(root, YGPx(500));
YGNodeStyleSetHeightWithUnit(root, YGPx(500)); YGNodeStyleSetHeight(root, YGPx(500));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeRight, YGPercent(20)); YGNodeStyleSetPosition(root_child0, YGEdgeRight, YGPercent(20));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeBottom, YGPercent(10)); YGNodeStyleSetPosition(root_child0, YGEdgeBottom, YGPercent(10));
YGNodeStyleSetWidthWithUnit(root_child0, YGPercent(55)); YGNodeStyleSetWidth(root_child0, YGPercent(55));
YGNodeStyleSetHeightWithUnit(root_child0, YGPercent(15)); YGNodeStyleSetHeight(root_child0, YGPercent(15));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -144,17 +144,17 @@ TEST(YogaTest, percentage_flex_basis) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPercent(50)); YGNodeStyleSetFlexBasis(root_child0, YGPercent(50));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 1); YGNodeStyleSetFlexGrow(root_child1, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPercent(25)); YGNodeStyleSetFlexBasis(root_child1, YGPercent(25));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -199,17 +199,17 @@ TEST(YogaTest, percentage_flex_basis_cross) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPercent(50)); YGNodeStyleSetFlexBasis(root_child0, YGPercent(50));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 1); YGNodeStyleSetFlexGrow(root_child1, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPercent(25)); YGNodeStyleSetFlexBasis(root_child1, YGPercent(25));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -254,17 +254,17 @@ TEST(YogaTest, percentage_flex_basis_cross_min_height) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMinHeightWithUnit(root_child0, YGPercent(60)); YGNodeStyleSetMinHeight(root_child0, YGPercent(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 2); YGNodeStyleSetFlexGrow(root_child1, 2);
YGNodeStyleSetMinHeightWithUnit(root_child1, YGPercent(10)); YGNodeStyleSetMinHeight(root_child1, YGPercent(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -310,19 +310,19 @@ TEST(YogaTest, percentage_flex_basis_main_max_height) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPercent(10)); YGNodeStyleSetFlexBasis(root_child0, YGPercent(10));
YGNodeStyleSetMaxHeightWithUnit(root_child0, YGPercent(60)); YGNodeStyleSetMaxHeight(root_child0, YGPercent(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 4); YGNodeStyleSetFlexGrow(root_child1, 4);
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPercent(10)); YGNodeStyleSetFlexBasis(root_child1, YGPercent(10));
YGNodeStyleSetMaxHeightWithUnit(root_child1, YGPercent(20)); YGNodeStyleSetMaxHeight(root_child1, YGPercent(20));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -367,19 +367,19 @@ TEST(YogaTest, percentage_flex_basis_cross_max_height) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPercent(10)); YGNodeStyleSetFlexBasis(root_child0, YGPercent(10));
YGNodeStyleSetMaxHeightWithUnit(root_child0, YGPercent(60)); YGNodeStyleSetMaxHeight(root_child0, YGPercent(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 4); YGNodeStyleSetFlexGrow(root_child1, 4);
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPercent(10)); YGNodeStyleSetFlexBasis(root_child1, YGPercent(10));
YGNodeStyleSetMaxHeightWithUnit(root_child1, YGPercent(20)); YGNodeStyleSetMaxHeight(root_child1, YGPercent(20));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -425,19 +425,19 @@ TEST(YogaTest, percentage_flex_basis_main_max_width) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPercent(15)); YGNodeStyleSetFlexBasis(root_child0, YGPercent(15));
YGNodeStyleSetMaxWidthWithUnit(root_child0, YGPercent(60)); YGNodeStyleSetMaxWidth(root_child0, YGPercent(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 4); YGNodeStyleSetFlexGrow(root_child1, 4);
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPercent(10)); YGNodeStyleSetFlexBasis(root_child1, YGPercent(10));
YGNodeStyleSetMaxWidthWithUnit(root_child1, YGPercent(20)); YGNodeStyleSetMaxWidth(root_child1, YGPercent(20));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -482,19 +482,19 @@ TEST(YogaTest, percentage_flex_basis_cross_max_width) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPercent(10)); YGNodeStyleSetFlexBasis(root_child0, YGPercent(10));
YGNodeStyleSetMaxWidthWithUnit(root_child0, YGPercent(60)); YGNodeStyleSetMaxWidth(root_child0, YGPercent(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 4); YGNodeStyleSetFlexGrow(root_child1, 4);
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPercent(15)); YGNodeStyleSetFlexBasis(root_child1, YGPercent(15));
YGNodeStyleSetMaxWidthWithUnit(root_child1, YGPercent(20)); YGNodeStyleSetMaxWidth(root_child1, YGPercent(20));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -540,19 +540,19 @@ TEST(YogaTest, percentage_flex_basis_main_min_width) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPercent(15)); YGNodeStyleSetFlexBasis(root_child0, YGPercent(15));
YGNodeStyleSetMinWidthWithUnit(root_child0, YGPercent(60)); YGNodeStyleSetMinWidth(root_child0, YGPercent(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 4); YGNodeStyleSetFlexGrow(root_child1, 4);
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPercent(10)); YGNodeStyleSetFlexBasis(root_child1, YGPercent(10));
YGNodeStyleSetMinWidthWithUnit(root_child1, YGPercent(20)); YGNodeStyleSetMinWidth(root_child1, YGPercent(20));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -597,19 +597,19 @@ TEST(YogaTest, percentage_flex_basis_cross_min_width) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPercent(10)); YGNodeStyleSetFlexBasis(root_child0, YGPercent(10));
YGNodeStyleSetMinWidthWithUnit(root_child0, YGPercent(60)); YGNodeStyleSetMinWidth(root_child0, YGPercent(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 4); YGNodeStyleSetFlexGrow(root_child1, 4);
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPercent(15)); YGNodeStyleSetFlexBasis(root_child1, YGPercent(15));
YGNodeStyleSetMinWidthWithUnit(root_child1, YGPercent(20)); YGNodeStyleSetMinWidth(root_child1, YGPercent(20));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -654,51 +654,51 @@ TEST(YogaTest, percentage_multiple_nested_with_padding_margin_and_percentage_val
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(200)); YGNodeStyleSetHeight(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPercent(10)); YGNodeStyleSetFlexBasis(root_child0, YGPercent(10));
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeLeft, YGPx(5)); YGNodeStyleSetMargin(root_child0, YGEdgeLeft, YGPx(5));
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeTop, YGPx(5)); YGNodeStyleSetMargin(root_child0, YGEdgeTop, YGPx(5));
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeRight, YGPx(5)); YGNodeStyleSetMargin(root_child0, YGEdgeRight, YGPx(5));
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeBottom, YGPx(5)); YGNodeStyleSetMargin(root_child0, YGEdgeBottom, YGPx(5));
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeLeft, YGPx(3)); YGNodeStyleSetPadding(root_child0, YGEdgeLeft, YGPx(3));
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeTop, YGPx(3)); YGNodeStyleSetPadding(root_child0, YGEdgeTop, YGPx(3));
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeRight, YGPx(3)); YGNodeStyleSetPadding(root_child0, YGEdgeRight, YGPx(3));
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeBottom, YGPx(3)); YGNodeStyleSetPadding(root_child0, YGEdgeBottom, YGPx(3));
YGNodeStyleSetMinWidthWithUnit(root_child0, YGPercent(60)); YGNodeStyleSetMinWidth(root_child0, YGPercent(60));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child0_child0 = YGNodeNew(); const YGNodeRef root_child0_child0 = YGNodeNew();
YGNodeStyleSetMarginWithUnit(root_child0_child0, YGEdgeLeft, YGPx(5)); YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, YGPx(5));
YGNodeStyleSetMarginWithUnit(root_child0_child0, YGEdgeTop, YGPx(5)); YGNodeStyleSetMargin(root_child0_child0, YGEdgeTop, YGPx(5));
YGNodeStyleSetMarginWithUnit(root_child0_child0, YGEdgeRight, YGPx(5)); YGNodeStyleSetMargin(root_child0_child0, YGEdgeRight, YGPx(5));
YGNodeStyleSetMarginWithUnit(root_child0_child0, YGEdgeBottom, YGPx(5)); YGNodeStyleSetMargin(root_child0_child0, YGEdgeBottom, YGPx(5));
YGNodeStyleSetPaddingWithUnit(root_child0_child0, YGEdgeLeft, YGPercent(3)); YGNodeStyleSetPadding(root_child0_child0, YGEdgeLeft, YGPercent(3));
YGNodeStyleSetPaddingWithUnit(root_child0_child0, YGEdgeTop, YGPercent(3)); YGNodeStyleSetPadding(root_child0_child0, YGEdgeTop, YGPercent(3));
YGNodeStyleSetPaddingWithUnit(root_child0_child0, YGEdgeRight, YGPercent(3)); YGNodeStyleSetPadding(root_child0_child0, YGEdgeRight, YGPercent(3));
YGNodeStyleSetPaddingWithUnit(root_child0_child0, YGEdgeBottom, YGPercent(3)); YGNodeStyleSetPadding(root_child0_child0, YGEdgeBottom, YGPercent(3));
YGNodeStyleSetWidthWithUnit(root_child0_child0, YGPercent(50)); YGNodeStyleSetWidth(root_child0_child0, YGPercent(50));
YGNodeInsertChild(root_child0, root_child0_child0, 0); YGNodeInsertChild(root_child0, root_child0_child0, 0);
const YGNodeRef root_child0_child0_child0 = YGNodeNew(); const YGNodeRef root_child0_child0_child0 = YGNodeNew();
YGNodeStyleSetMarginWithUnit(root_child0_child0_child0, YGEdgeLeft, YGPercent(5)); YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeLeft, YGPercent(5));
YGNodeStyleSetMarginWithUnit(root_child0_child0_child0, YGEdgeTop, YGPercent(5)); YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeTop, YGPercent(5));
YGNodeStyleSetMarginWithUnit(root_child0_child0_child0, YGEdgeRight, YGPercent(5)); YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeRight, YGPercent(5));
YGNodeStyleSetMarginWithUnit(root_child0_child0_child0, YGEdgeBottom, YGPercent(5)); YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeBottom, YGPercent(5));
YGNodeStyleSetPaddingWithUnit(root_child0_child0_child0, YGEdgeLeft, YGPx(3)); YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeLeft, YGPx(3));
YGNodeStyleSetPaddingWithUnit(root_child0_child0_child0, YGEdgeTop, YGPx(3)); YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeTop, YGPx(3));
YGNodeStyleSetPaddingWithUnit(root_child0_child0_child0, YGEdgeRight, YGPx(3)); YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeRight, YGPx(3));
YGNodeStyleSetPaddingWithUnit(root_child0_child0_child0, YGEdgeBottom, YGPx(3)); YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeBottom, YGPx(3));
YGNodeStyleSetWidthWithUnit(root_child0_child0_child0, YGPercent(45)); YGNodeStyleSetWidth(root_child0_child0_child0, YGPercent(45));
YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 4); YGNodeStyleSetFlexGrow(root_child1, 4);
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPercent(15)); YGNodeStyleSetFlexBasis(root_child1, YGPercent(15));
YGNodeStyleSetMinWidthWithUnit(root_child1, YGPercent(20)); YGNodeStyleSetMinWidth(root_child1, YGPercent(20));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -763,20 +763,20 @@ TEST(YogaTest, percentage_margin_should_calculate_based_only_on_width) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeLeft, YGPercent(10)); YGNodeStyleSetMargin(root_child0, YGEdgeLeft, YGPercent(10));
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeTop, YGPercent(10)); YGNodeStyleSetMargin(root_child0, YGEdgeTop, YGPercent(10));
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeRight, YGPercent(10)); YGNodeStyleSetMargin(root_child0, YGEdgeRight, YGPercent(10));
YGNodeStyleSetMarginWithUnit(root_child0, YGEdgeBottom, YGPercent(10)); YGNodeStyleSetMargin(root_child0, YGEdgeBottom, YGPercent(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child0_child0 = YGNodeNew(); const YGNodeRef root_child0_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0_child0, YGPx(10));
YGNodeInsertChild(root_child0, root_child0_child0, 0); YGNodeInsertChild(root_child0, root_child0_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -821,20 +821,20 @@ TEST(YogaTest, percentage_padding_should_calculate_based_only_on_width) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeLeft, YGPercent(10)); YGNodeStyleSetPadding(root_child0, YGEdgeLeft, YGPercent(10));
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeTop, YGPercent(10)); YGNodeStyleSetPadding(root_child0, YGEdgeTop, YGPercent(10));
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeRight, YGPercent(10)); YGNodeStyleSetPadding(root_child0, YGEdgeRight, YGPercent(10));
YGNodeStyleSetPaddingWithUnit(root_child0, YGEdgeBottom, YGPercent(10)); YGNodeStyleSetPadding(root_child0, YGEdgeBottom, YGPercent(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child0_child0 = YGNodeNew(); const YGNodeRef root_child0_child0 = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root_child0_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0_child0, YGPx(10));
YGNodeInsertChild(root_child0, root_child0_child0, 0); YGNodeInsertChild(root_child0, root_child0_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -879,15 +879,15 @@ TEST(YogaTest, percentage_absolute_position) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(200)); YGNodeStyleSetWidth(root, YGPx(200));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeLeft, YGPercent(30)); YGNodeStyleSetPosition(root_child0, YGEdgeLeft, YGPercent(30));
YGNodeStyleSetPositionWithUnit(root_child0, YGEdgeTop, YGPercent(10)); YGNodeStyleSetPosition(root_child0, YGEdgeTop, YGPercent(10));
YGNodeStyleSetWidthWithUnit(root_child0, YGPx(10)); YGNodeStyleSetWidth(root_child0, YGPx(10));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(10)); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -16,8 +16,8 @@ TEST(YogaTest, dont_cache_computed_flex_basis_between_layouts) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 10); YGNodeStyleSetHeight(root_child0, YGPx(10));
YGNodeStyleSetFlexBasis(root_child0, 20); YGNodeStyleSetFlexBasis(root_child0, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, 100, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, 100, YGUndefined, YGDirectionLTR);

View File

@@ -17,8 +17,8 @@ TEST(YogaTest, rounding_flex_basis_flex_grow_row_width_of_100) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
@@ -85,8 +85,8 @@ TEST(YogaTest, rounding_flex_basis_flex_grow_row_prime_number_width) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(113)); YGNodeStyleSetWidth(root, YGPx(113));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
@@ -181,20 +181,20 @@ TEST(YogaTest, rounding_flex_basis_flex_shrink_row) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidthWithUnit(root, YGPx(101)); YGNodeStyleSetWidth(root, YGPx(101));
YGNodeStyleSetHeightWithUnit(root, YGPx(100)); YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexShrink(root_child0, 1); YGNodeStyleSetFlexShrink(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(100)); YGNodeStyleSetFlexBasis(root_child0, YGPx(100));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexBasisWithUnit(root_child1, YGPx(25)); YGNodeStyleSetFlexBasis(root_child1, YGPx(25));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetFlexBasisWithUnit(root_child2, YGPx(25)); YGNodeStyleSetFlexBasis(root_child2, YGPx(25));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -249,23 +249,23 @@ TEST(YogaTest, rounding_flex_basis_overrides_main_size) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(113)); YGNodeStyleSetHeight(root, YGPx(113));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(50)); YGNodeStyleSetFlexBasis(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(20)); YGNodeStyleSetHeight(root_child0, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 1); YGNodeStyleSetFlexGrow(root_child1, 1);
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child2, 1); YGNodeStyleSetFlexGrow(root_child2, 1);
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -320,23 +320,23 @@ TEST(YogaTest, rounding_total_fractial) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(87.4f)); YGNodeStyleSetWidth(root, YGPx(87.4f));
YGNodeStyleSetHeightWithUnit(root, YGPx(113.4f)); YGNodeStyleSetHeight(root, YGPx(113.4f));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 0.7f); YGNodeStyleSetFlexGrow(root_child0, 0.7f);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(50.3f)); YGNodeStyleSetFlexBasis(root_child0, YGPx(50.3f));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(20.3f)); YGNodeStyleSetHeight(root_child0, YGPx(20.3f));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 1.6f); YGNodeStyleSetFlexGrow(root_child1, 1.6f);
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child2, 1.1f); YGNodeStyleSetFlexGrow(root_child2, 1.1f);
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10.7f)); YGNodeStyleSetHeight(root_child2, YGPx(10.7f));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -391,37 +391,37 @@ TEST(YogaTest, rounding_total_fractial_nested) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(87.4f)); YGNodeStyleSetWidth(root, YGPx(87.4f));
YGNodeStyleSetHeightWithUnit(root, YGPx(113.4f)); YGNodeStyleSetHeight(root, YGPx(113.4f));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 0.7f); YGNodeStyleSetFlexGrow(root_child0, 0.7f);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(50.3f)); YGNodeStyleSetFlexBasis(root_child0, YGPx(50.3f));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(20.3f)); YGNodeStyleSetHeight(root_child0, YGPx(20.3f));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child0_child0 = YGNodeNew(); const YGNodeRef root_child0_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0_child0, 1); YGNodeStyleSetFlexGrow(root_child0_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0_child0, YGPx(0.3f)); YGNodeStyleSetFlexBasis(root_child0_child0, YGPx(0.3f));
YGNodeStyleSetPositionWithUnit(root_child0_child0, YGEdgeBottom, YGPx(13.3f)); YGNodeStyleSetPosition(root_child0_child0, YGEdgeBottom, YGPx(13.3f));
YGNodeStyleSetHeightWithUnit(root_child0_child0, YGPx(9.9f)); YGNodeStyleSetHeight(root_child0_child0, YGPx(9.9f));
YGNodeInsertChild(root_child0, root_child0_child0, 0); YGNodeInsertChild(root_child0, root_child0_child0, 0);
const YGNodeRef root_child0_child1 = YGNodeNew(); const YGNodeRef root_child0_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0_child1, 4); YGNodeStyleSetFlexGrow(root_child0_child1, 4);
YGNodeStyleSetFlexBasisWithUnit(root_child0_child1, YGPx(0.3f)); YGNodeStyleSetFlexBasis(root_child0_child1, YGPx(0.3f));
YGNodeStyleSetPositionWithUnit(root_child0_child1, YGEdgeTop, YGPx(13.3f)); YGNodeStyleSetPosition(root_child0_child1, YGEdgeTop, YGPx(13.3f));
YGNodeStyleSetHeightWithUnit(root_child0_child1, YGPx(1.1f)); YGNodeStyleSetHeight(root_child0_child1, YGPx(1.1f));
YGNodeInsertChild(root_child0, root_child0_child1, 1); YGNodeInsertChild(root_child0, root_child0_child1, 1);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 1.6f); YGNodeStyleSetFlexGrow(root_child1, 1.6f);
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child2, 1.1f); YGNodeStyleSetFlexGrow(root_child2, 1.1f);
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10.7f)); YGNodeStyleSetHeight(root_child2, YGPx(10.7f));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -496,23 +496,23 @@ TEST(YogaTest, rounding_fractial_input_1) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(113.4f)); YGNodeStyleSetHeight(root, YGPx(113.4f));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(50)); YGNodeStyleSetFlexBasis(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(20)); YGNodeStyleSetHeight(root_child0, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 1); YGNodeStyleSetFlexGrow(root_child1, 1);
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child2, 1); YGNodeStyleSetFlexGrow(root_child2, 1);
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -567,23 +567,23 @@ TEST(YogaTest, rounding_fractial_input_2) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(113.6f)); YGNodeStyleSetHeight(root, YGPx(113.6f));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(50)); YGNodeStyleSetFlexBasis(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(20)); YGNodeStyleSetHeight(root_child0, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 1); YGNodeStyleSetFlexGrow(root_child1, 1);
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child2, 1); YGNodeStyleSetFlexGrow(root_child2, 1);
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -638,24 +638,24 @@ TEST(YogaTest, rounding_fractial_input_3) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetPositionWithUnit(root, YGEdgeTop, YGPx(0.3f)); YGNodeStyleSetPosition(root, YGEdgeTop, YGPx(0.3f));
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(113.4f)); YGNodeStyleSetHeight(root, YGPx(113.4f));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(50)); YGNodeStyleSetFlexBasis(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(20)); YGNodeStyleSetHeight(root_child0, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 1); YGNodeStyleSetFlexGrow(root_child1, 1);
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child2, 1); YGNodeStyleSetFlexGrow(root_child2, 1);
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -710,24 +710,24 @@ TEST(YogaTest, rounding_fractial_input_4) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetPositionWithUnit(root, YGEdgeTop, YGPx(0.7f)); YGNodeStyleSetPosition(root, YGEdgeTop, YGPx(0.7f));
YGNodeStyleSetWidthWithUnit(root, YGPx(100)); YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetHeightWithUnit(root, YGPx(113.4f)); YGNodeStyleSetHeight(root, YGPx(113.4f));
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetFlexBasisWithUnit(root_child0, YGPx(50)); YGNodeStyleSetFlexBasis(root_child0, YGPx(50));
YGNodeStyleSetHeightWithUnit(root_child0, YGPx(20)); YGNodeStyleSetHeight(root_child0, YGPx(20));
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew(); const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child1, 1); YGNodeStyleSetFlexGrow(root_child1, 1);
YGNodeStyleSetHeightWithUnit(root_child1, YGPx(10)); YGNodeStyleSetHeight(root_child1, YGPx(10));
YGNodeInsertChild(root, root_child1, 1); YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child2 = YGNodeNew(); const YGNodeRef root_child2 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child2, 1); YGNodeStyleSetFlexGrow(root_child2, 1);
YGNodeStyleSetHeightWithUnit(root_child2, YGPx(10)); YGNodeStyleSetHeight(root_child2, YGPx(10));
YGNodeInsertChild(root, root_child2, 2); YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -113,6 +113,12 @@ YGCalloc gYGCalloc = &calloc;
YGRealloc gYGRealloc = &realloc; YGRealloc gYGRealloc = &realloc;
YGFree gYGFree = &free; YGFree gYGFree = &free;
static YGValue YGValueUndefined = {
.value = YGUndefined,
.defined = false,
.unit = YGUnitPixel
};
#ifdef ANDROID #ifdef ANDROID
#include <android/log.h> #include <android/log.h>
static int YGAndroidLog(YGLogLevel level, const char *format, va_list args) { static int YGAndroidLog(YGLogLevel level, const char *format, va_list args) {
@@ -161,29 +167,25 @@ static inline YGValue YGComputedEdgeValue(const YGValue edges[YGEdgeCount],
const float defaultValue) { const float defaultValue) {
YG_ASSERT(edge <= YGEdgeEnd, "Cannot get computed value of multi-edge shorthands"); YG_ASSERT(edge <= YGEdgeEnd, "Cannot get computed value of multi-edge shorthands");
if (!YGValueIsUndefined(edges[edge])) { if (edges[edge].defined) {
return edges[edge]; return edges[edge];
} }
if ((edge == YGEdgeTop || edge == YGEdgeBottom) && !YGValueIsUndefined(edges[YGEdgeVertical])) { if ((edge == YGEdgeTop || edge == YGEdgeBottom) && edges[YGEdgeVertical].defined) {
return edges[YGEdgeVertical]; return edges[YGEdgeVertical];
} }
if ((edge == YGEdgeLeft || edge == YGEdgeRight || edge == YGEdgeStart || edge == YGEdgeEnd) && if ((edge == YGEdgeLeft || edge == YGEdgeRight || edge == YGEdgeStart || edge == YGEdgeEnd) &&
!YGValueIsUndefined(edges[YGEdgeHorizontal])) { edges[YGEdgeHorizontal].defined) {
return edges[YGEdgeHorizontal]; return edges[YGEdgeHorizontal];
} }
if (!YGValueIsUndefined(edges[YGEdgeAll])) { if (edges[YGEdgeAll].defined) {
return edges[YGEdgeAll]; return edges[YGEdgeAll];
} }
if (edge == YGEdgeStart || edge == YGEdgeEnd) { if (edge == YGEdgeStart || edge == YGEdgeEnd) {
YGValue result; return YGValueUndefined;
result.value = YGUndefined;
result.defined = false;
result.unit = YGUnitPixel;
return result;
} }
YGValue result; YGValue result;
@@ -193,7 +195,7 @@ static inline YGValue YGComputedEdgeValue(const YGValue edges[YGEdgeCount],
return result; return result;
} }
static inline float YGValueToFloat(const YGValue unit, const float parentSize) { static inline float YGValueResolve(const YGValue unit, const float parentSize) {
if (unit.unit == YGUnitPixel){ if (unit.unit == YGUnitPixel){
return unit.value; return unit.value;
} else { } else {
@@ -223,40 +225,20 @@ static void YGNodeInit(const YGNodeRef node) {
node->style.overflow = YGOverflowVisible; node->style.overflow = YGOverflowVisible;
// Some of the fields default to undefined and not 0 // Some of the fields default to undefined and not 0
node->style.dimensions[YGDimensionWidth].value = YGUndefined; node->style.dimensions[YGDimensionWidth] = YGValueUndefined;
node->style.dimensions[YGDimensionWidth].defined = false; node->style.dimensions[YGDimensionHeight] = YGValueUndefined;
node->style.dimensions[YGDimensionWidth].unit = YGUnitPixel;
node->style.dimensions[YGDimensionHeight].value = YGUndefined;
node->style.dimensions[YGDimensionHeight].defined = false;
node->style.dimensions[YGDimensionHeight].unit = YGUnitPixel;
node->style.minDimensions[YGDimensionWidth].value = YGUndefined; node->style.minDimensions[YGDimensionWidth] = YGValueUndefined;
node->style.minDimensions[YGDimensionWidth].defined = false; node->style.minDimensions[YGDimensionHeight] = YGValueUndefined;
node->style.minDimensions[YGDimensionWidth].unit = YGUnitPixel;
node->style.minDimensions[YGDimensionHeight].value = YGUndefined;
node->style.minDimensions[YGDimensionHeight].defined = false;
node->style.minDimensions[YGDimensionHeight].unit = YGUnitPixel;
node->style.maxDimensions[YGDimensionWidth].value = YGUndefined; node->style.maxDimensions[YGDimensionWidth] = YGValueUndefined;
node->style.maxDimensions[YGDimensionWidth].defined = false; node->style.maxDimensions[YGDimensionHeight] = YGValueUndefined;
node->style.maxDimensions[YGDimensionWidth].unit = YGUnitPixel;
node->style.maxDimensions[YGDimensionHeight].value = YGUndefined;
node->style.maxDimensions[YGDimensionHeight].defined = false;
node->style.maxDimensions[YGDimensionHeight].unit = YGUnitPixel;
for (YGEdge edge = YGEdgeLeft; edge < YGEdgeCount; edge++) { for (YGEdge edge = YGEdgeLeft; edge < YGEdgeCount; edge++) {
node->style.position[edge].value = YGUndefined; node->style.position[edge] = YGValueUndefined;
node->style.position[edge].defined = false; node->style.margin[edge] = YGValueUndefined;
node->style.position[edge].unit = YGUnitPixel; node->style.padding[edge] = YGValueUndefined;
node->style.margin[edge].value = YGUndefined; node->style.border[edge] = YGValueUndefined;
node->style.margin[edge].defined = false;
node->style.margin[edge].unit = YGUnitPixel;
node->style.padding[edge].value = YGUndefined;
node->style.padding[edge].defined = false;
node->style.padding[edge].unit = YGUnitPixel;
node->style.border[edge].value = YGUndefined;
node->style.border[edge].defined = false;
node->style.border[edge].unit = YGUnitPixel;
} }
node->style.aspectRatio = YGUndefined; node->style.aspectRatio = YGUndefined;
@@ -429,18 +411,8 @@ inline float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
return 0; return 0;
} }
inline float YGNodeStyleGetFlexBasis(const YGNodeRef node) { inline YGValue YGNodeStyleGetFlexBasis(const YGNodeRef node) {
if (!YGValueIsUndefined(node->style.flexBasis)) { if (node->style.flexBasis.defined) {
return node->style.flexBasis.value;
}
if (!YGFloatIsUndefined(node->style.flex)) {
return node->style.flex > 0 ? 0 : YGUndefined;
}
return YGUndefined;
}
inline YGValue YGNodeStyleGetFlexBasisWithUnit(const YGNodeRef node) {
if (!YGValueIsUndefined(node->style.flexBasis)) {
return node->style.flexBasis; return node->style.flexBasis;
} }
if (!YGFloatIsUndefined(node->style.flex)) { if (!YGFloatIsUndefined(node->style.flex)) {
@@ -474,21 +446,13 @@ void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
} }
#define YG_NODE_STYLE_PROPERTY_SETTER_UNIT_IMPL(type, name, paramName, instanceName) \ #define YG_NODE_STYLE_PROPERTY_SETTER_UNIT_IMPL(type, name, paramName, instanceName) \
void YGNodeStyleSet##name##WithUnit(const YGNodeRef node, const type paramName) { \ void YGNodeStyleSet##name##(const YGNodeRef node, const type paramName) { \
if (node->style.instanceName.value != paramName.value || node->style.instanceName.unit != paramName.unit) { \ if (node->style.instanceName.value != paramName.value || node->style.instanceName.unit != paramName.unit) { \
node->style.instanceName.value = paramName.value; \ node->style.instanceName.value = paramName.value; \
node->style.instanceName.defined = !YGFloatIsUndefined(paramName.value); \ node->style.instanceName.defined = !YGFloatIsUndefined(paramName.value); \
node->style.instanceName.unit = paramName.unit; \ node->style.instanceName.unit = paramName.unit; \
YGNodeMarkDirtyInternal(node); \ YGNodeMarkDirtyInternal(node); \
} \ } \
} \
void YGNodeStyleSet##name(const YGNodeRef node, const float paramName) { \
if (node->style.instanceName.value != paramName || node->style.instanceName.unit != YGUnitPixel) { \
node->style.instanceName.value = paramName; \
node->style.instanceName.defined = !YGFloatIsUndefined(paramName); \
node->style.instanceName.unit = YGUnitPixel; \
YGNodeMarkDirtyInternal(node); \
} \
} }
#define YG_NODE_STYLE_PROPERTY_IMPL(type, name, paramName, instanceName) \ #define YG_NODE_STYLE_PROPERTY_IMPL(type, name, paramName, instanceName) \
@@ -501,15 +465,12 @@ void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
#define YG_NODE_STYLE_PROPERTY_UNIT_IMPL(type, name, paramName, instanceName) \ #define YG_NODE_STYLE_PROPERTY_UNIT_IMPL(type, name, paramName, instanceName) \
YG_NODE_STYLE_PROPERTY_SETTER_UNIT_IMPL(type, name, paramName, instanceName) \ YG_NODE_STYLE_PROPERTY_SETTER_UNIT_IMPL(type, name, paramName, instanceName) \
\ \
float YGNodeStyleGet##name(const YGNodeRef node) { \ type YGNodeStyleGet##name##(const YGNodeRef node) { \
return node->style.instanceName.value; \
} \
type YGNodeStyleGet##name##WithUnit(const YGNodeRef node) { \
return node->style.instanceName; \ return node->style.instanceName; \
} }
#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT_IMPL(type, name, paramName, instanceName, defaultValue) \ #define YG_NODE_STYLE_EDGE_PROPERTY_UNIT_IMPL(type, name, paramName, instanceName, defaultValue) \
void YGNodeStyleSet##name##WithUnit(const YGNodeRef node, const YGEdge edge, const type paramName) { \ void YGNodeStyleSet##name##(const YGNodeRef node, const YGEdge edge, const type paramName) { \
if (node->style.instanceName[edge].value != paramName.value || node->style.instanceName[edge].unit != paramName.unit ) { \ if (node->style.instanceName[edge].value != paramName.value || node->style.instanceName[edge].unit != paramName.unit ) { \
node->style.instanceName[edge].value = paramName.value; \ node->style.instanceName[edge].value = paramName.value; \
node->style.instanceName[edge].defined = !YGFloatIsUndefined(paramName.value); \ node->style.instanceName[edge].defined = !YGFloatIsUndefined(paramName.value); \
@@ -518,22 +479,10 @@ void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
} \ } \
} \ } \
\ \
void YGNodeStyleSet##name(const YGNodeRef node, const YGEdge edge, const float paramName) { \ type YGNodeStyleGet##name##(const YGNodeRef node, const YGEdge edge) { \
if (node->style.instanceName[edge].value != paramName || node->style.instanceName[edge].unit != YGUnitPixel ) { \
node->style.instanceName[edge].value = paramName; \
node->style.instanceName[edge].defined = !YGFloatIsUndefined(paramName); \
node->style.instanceName[edge].unit = YGUnitPixel; \
YGNodeMarkDirtyInternal(node); \
} \
} \
\
type YGNodeStyleGet##name##WithUnit(const YGNodeRef node, const YGEdge edge) { \
return YGComputedEdgeValue(node->style.instanceName, edge, defaultValue); \ return YGComputedEdgeValue(node->style.instanceName, edge, defaultValue); \
} \ } \
\
float YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge) { \
return YGComputedEdgeValue(node->style.instanceName, edge, defaultValue).value; \
}
#define YG_NODE_STYLE_EDGE_PROPERTY_IMPL(type, name, paramName, instanceName, defaultValue) \ #define YG_NODE_STYLE_EDGE_PROPERTY_IMPL(type, name, paramName, instanceName, defaultValue) \
void YGNodeStyleSet##name(const YGNodeRef node, const YGEdge edge, const float paramName) { \ void YGNodeStyleSet##name(const YGNodeRef node, const YGEdge edge, const float paramName) { \
@@ -612,17 +561,13 @@ inline bool YGFloatIsUndefined(const float value) {
return isnan(value); return isnan(value);
} }
inline bool YGValueIsUndefined(const YGValue value) {
return !value.defined;
}
static inline bool YGValueEqual(const YGValue a, const YGValue b) { static inline bool YGValueEqual(const YGValue a, const YGValue b) {
if (a.unit != b.unit){ if (a.unit != b.unit){
return false; return false;
} }
if (YGValueIsUndefined(a)) { if (!a.defined) {
return YGValueIsUndefined(b); return !b.defined;
} }
return fabs(a.value - b.value) < 0.0001; return fabs(a.value - b.value) < 0.0001;
} }
@@ -653,7 +598,7 @@ static void YGPrintNumberIfNotUndefinedf(const char *str, const float number) {
} }
static void YGPrintNumberIfNotUndefined(const char *str, const YGValue number) { static void YGPrintNumberIfNotUndefined(const char *str, const YGValue number) {
if (!YGValueIsUndefined(number)) { if (number.defined) {
YGLog(YGLogLevelDebug, "%s: %g%s, ", str, number, number.unit == YGUnitPixel ? "px" : "%"); YGLog(YGLogLevelDebug, "%s: %g%s, ", str, number, number.unit == YGUnitPixel ? "px" : "%");
} }
} }
@@ -731,7 +676,7 @@ static void YGNodePrintInternal(const YGNodeRef node,
YGPrintNumberIfNotUndefinedf("flexGrow", YGNodeStyleGetFlexGrow(node)); YGPrintNumberIfNotUndefinedf("flexGrow", YGNodeStyleGetFlexGrow(node));
YGPrintNumberIfNotUndefinedf("flexShrink", YGNodeStyleGetFlexShrink(node)); YGPrintNumberIfNotUndefinedf("flexShrink", YGNodeStyleGetFlexShrink(node));
YGPrintNumberIfNotUndefined("flexBasis", YGNodeStyleGetFlexBasisWithUnit(node)); YGPrintNumberIfNotUndefined("flexBasis", YGNodeStyleGetFlexBasis(node));
if (node->style.overflow == YGOverflowHidden) { if (node->style.overflow == YGOverflowHidden) {
YGLog(YGLogLevelDebug, "overflow: 'hidden', "); YGLog(YGLogLevelDebug, "overflow: 'hidden', ");
@@ -859,41 +804,41 @@ static inline bool YGFlexDirectionIsColumn(const YGFlexDirection flexDirection)
} }
static inline float YGNodeLeadingMargin(const YGNodeRef node, const YGFlexDirection axis, const float widthSize) { static inline float YGNodeLeadingMargin(const YGNodeRef node, const YGFlexDirection axis, const float widthSize) {
if (YGFlexDirectionIsRow(axis) && !YGValueIsUndefined(node->style.margin[YGEdgeStart])) { if (YGFlexDirectionIsRow(axis) && node->style.margin[YGEdgeStart].defined) {
return YGValueToFloat(node->style.margin[YGEdgeStart], widthSize); return YGValueResolve(node->style.margin[YGEdgeStart], widthSize);
} }
return YGValueToFloat(YGComputedEdgeValue(node->style.margin, leading[axis], 0), widthSize); return YGValueResolve(YGComputedEdgeValue(node->style.margin, leading[axis], 0), widthSize);
} }
static float YGNodeTrailingMargin(const YGNodeRef node, const YGFlexDirection axis, const float widthSize) { static float YGNodeTrailingMargin(const YGNodeRef node, const YGFlexDirection axis, const float widthSize) {
if (YGFlexDirectionIsRow(axis) && !YGValueIsUndefined(node->style.margin[YGEdgeEnd])) { if (YGFlexDirectionIsRow(axis) && node->style.margin[YGEdgeEnd].defined) {
return YGValueToFloat(node->style.margin[YGEdgeEnd], widthSize); return YGValueResolve(node->style.margin[YGEdgeEnd], widthSize);
} }
return YGValueToFloat(YGComputedEdgeValue(node->style.margin, trailing[axis], 0), widthSize); return YGValueResolve(YGComputedEdgeValue(node->style.margin, trailing[axis], 0), widthSize);
} }
static float YGNodeLeadingPadding(const YGNodeRef node, const YGFlexDirection axis, const float widthSize) { static float YGNodeLeadingPadding(const YGNodeRef node, const YGFlexDirection axis, const float widthSize) {
if (YGFlexDirectionIsRow(axis) && !YGValueIsUndefined(node->style.padding[YGEdgeStart]) && if (YGFlexDirectionIsRow(axis) && node->style.padding[YGEdgeStart].defined &&
YGValueToFloat(node->style.padding[YGEdgeStart], widthSize) >= 0) { YGValueResolve(node->style.padding[YGEdgeStart], widthSize) >= 0) {
return YGValueToFloat(node->style.padding[YGEdgeStart], widthSize); return YGValueResolve(node->style.padding[YGEdgeStart], widthSize);
} }
return fmaxf(YGValueToFloat(YGComputedEdgeValue(node->style.padding, leading[axis], 0), widthSize), 0); return fmaxf(YGValueResolve(YGComputedEdgeValue(node->style.padding, leading[axis], 0), widthSize), 0);
} }
static float YGNodeTrailingPadding(const YGNodeRef node, const YGFlexDirection axis, const float widthSize) { static float YGNodeTrailingPadding(const YGNodeRef node, const YGFlexDirection axis, const float widthSize) {
if (YGFlexDirectionIsRow(axis) && !YGValueIsUndefined(node->style.padding[YGEdgeEnd]) && if (YGFlexDirectionIsRow(axis) && node->style.padding[YGEdgeEnd].defined &&
YGValueToFloat(node->style.padding[YGEdgeEnd], widthSize) >= 0) { YGValueResolve(node->style.padding[YGEdgeEnd], widthSize) >= 0) {
return YGValueToFloat(node->style.padding[YGEdgeEnd], widthSize); return YGValueResolve(node->style.padding[YGEdgeEnd], widthSize);
} }
return fmaxf(YGValueToFloat(YGComputedEdgeValue(node->style.padding, trailing[axis], 0), widthSize), 0); return fmaxf(YGValueResolve(YGComputedEdgeValue(node->style.padding, trailing[axis], 0), widthSize), 0);
} }
static float YGNodeLeadingBorder(const YGNodeRef node, const YGFlexDirection axis) { static float YGNodeLeadingBorder(const YGNodeRef node, const YGFlexDirection axis) {
if (YGFlexDirectionIsRow(axis) && !YGValueIsUndefined(node->style.border[YGEdgeStart]) && if (YGFlexDirectionIsRow(axis) && node->style.border[YGEdgeStart].defined &&
node->style.border[YGEdgeStart].value >= 0) { node->style.border[YGEdgeStart].value >= 0) {
return node->style.border[YGEdgeStart].value; return node->style.border[YGEdgeStart].value;
} }
@@ -902,7 +847,7 @@ static float YGNodeLeadingBorder(const YGNodeRef node, const YGFlexDirection axi
} }
static float YGNodeTrailingBorder(const YGNodeRef node, const YGFlexDirection axis) { static float YGNodeTrailingBorder(const YGNodeRef node, const YGFlexDirection axis) {
if (YGFlexDirectionIsRow(axis) && !YGValueIsUndefined(node->style.border[YGEdgeEnd]) && if (YGFlexDirectionIsRow(axis) && node->style.border[YGEdgeEnd].defined &&
node->style.border[YGEdgeEnd].value >= 0) { node->style.border[YGEdgeEnd].value >= 0) {
return node->style.border[YGEdgeEnd].value; return node->style.border[YGEdgeEnd].value;
} }
@@ -974,7 +919,7 @@ static inline float YGNodeDimWithMargin(const YGNodeRef node, const YGFlexDirect
static inline bool YGNodeIsStyleDimDefined(const YGNodeRef node, const YGFlexDirection axis) { static inline bool YGNodeIsStyleDimDefined(const YGNodeRef node, const YGFlexDirection axis) {
const YGValue value = node->style.dimensions[dim[axis]]; const YGValue value = node->style.dimensions[dim[axis]];
return !YGValueIsUndefined(value) && value.value >= 0.0; return value.defined && value.value >= 0.0;
} }
static inline bool YGNodeIsLayoutDimDefined(const YGNodeRef node, const YGFlexDirection axis) { static inline bool YGNodeIsLayoutDimDefined(const YGNodeRef node, const YGFlexDirection axis) {
@@ -984,46 +929,44 @@ static inline bool YGNodeIsLayoutDimDefined(const YGNodeRef node, const YGFlexDi
static inline bool YGNodeIsLeadingPosDefined(const YGNodeRef node, const YGFlexDirection axis) { static inline bool YGNodeIsLeadingPosDefined(const YGNodeRef node, const YGFlexDirection axis) {
return (YGFlexDirectionIsRow(axis) && return (YGFlexDirectionIsRow(axis) &&
!YGValueIsUndefined( YGComputedEdgeValue(node->style.position, YGEdgeStart, YGUndefined).defined) ||
YGComputedEdgeValue(node->style.position, YGEdgeStart, YGUndefined))) || YGComputedEdgeValue(node->style.position, leading[axis], YGUndefined).defined;
!YGValueIsUndefined(YGComputedEdgeValue(node->style.position, leading[axis], YGUndefined));
} }
static inline bool YGNodeIsTrailingPosDefined(const YGNodeRef node, const YGFlexDirection axis) { static inline bool YGNodeIsTrailingPosDefined(const YGNodeRef node, const YGFlexDirection axis) {
return (YGFlexDirectionIsRow(axis) && return (YGFlexDirectionIsRow(axis) &&
!YGValueIsUndefined(YGComputedEdgeValue(node->style.position, YGEdgeEnd, YGUndefined))) || YGComputedEdgeValue(node->style.position, YGEdgeEnd, YGUndefined).defined) ||
!YGValueIsUndefined( YGComputedEdgeValue(node->style.position, trailing[axis], YGUndefined).defined;
YGComputedEdgeValue(node->style.position, trailing[axis], YGUndefined));
} }
static float YGNodeLeadingPosition(const YGNodeRef node, const YGFlexDirection axis, const float axisSize) { static float YGNodeLeadingPosition(const YGNodeRef node, const YGFlexDirection axis, const float axisSize) {
if (YGFlexDirectionIsRow(axis)) { if (YGFlexDirectionIsRow(axis)) {
const YGValue leadingPosition = const YGValue leadingPosition =
YGComputedEdgeValue(node->style.position, YGEdgeStart, YGUndefined); YGComputedEdgeValue(node->style.position, YGEdgeStart, YGUndefined);
if (!YGValueIsUndefined(leadingPosition)) { if (leadingPosition.defined) {
return YGValueToFloat(leadingPosition, axisSize); return YGValueResolve(leadingPosition, axisSize);
} }
} }
const YGValue leadingPosition = const YGValue leadingPosition =
YGComputedEdgeValue(node->style.position, leading[axis], YGUndefined); YGComputedEdgeValue(node->style.position, leading[axis], YGUndefined);
return YGValueIsUndefined(leadingPosition) ? 0 : YGValueToFloat(leadingPosition, axisSize); return !leadingPosition.defined ? 0 : YGValueResolve(leadingPosition, axisSize);
} }
static float YGNodeTrailingPosition(const YGNodeRef node, const YGFlexDirection axis, const float axisSize) { static float YGNodeTrailingPosition(const YGNodeRef node, const YGFlexDirection axis, const float axisSize) {
if (YGFlexDirectionIsRow(axis)) { if (YGFlexDirectionIsRow(axis)) {
const YGValue trailingPosition = const YGValue trailingPosition =
YGComputedEdgeValue(node->style.position, YGEdgeEnd, YGUndefined); YGComputedEdgeValue(node->style.position, YGEdgeEnd, YGUndefined);
if (!YGValueIsUndefined(trailingPosition)) { if (trailingPosition.defined) {
return YGValueToFloat(trailingPosition, axisSize); return YGValueResolve(trailingPosition, axisSize);
} }
} }
const YGValue trailingPosition = const YGValue trailingPosition =
YGComputedEdgeValue(node->style.position, trailing[axis], YGUndefined); YGComputedEdgeValue(node->style.position, trailing[axis], YGUndefined);
return YGValueIsUndefined(trailingPosition) ? 0 : YGValueToFloat(trailingPosition, axisSize); return !trailingPosition.defined ? 0 : YGValueResolve(trailingPosition, axisSize);
} }
static float YGNodeBoundAxisWithinMinAndMax(const YGNodeRef node, static float YGNodeBoundAxisWithinMinAndMax(const YGNodeRef node,
@@ -1033,11 +976,11 @@ static float YGNodeBoundAxisWithinMinAndMax(const YGNodeRef node,
float max = YGUndefined; float max = YGUndefined;
if (YGFlexDirectionIsColumn(axis)) { if (YGFlexDirectionIsColumn(axis)) {
min = YGValueToFloat(node->style.minDimensions[YGDimensionHeight], axisSize); min = YGValueResolve(node->style.minDimensions[YGDimensionHeight], axisSize);
max = YGValueToFloat(node->style.maxDimensions[YGDimensionHeight], axisSize); max = YGValueResolve(node->style.maxDimensions[YGDimensionHeight], axisSize);
} else if (YGFlexDirectionIsRow(axis)) { } else if (YGFlexDirectionIsRow(axis)) {
min = YGValueToFloat(node->style.minDimensions[YGDimensionWidth], axisSize); min = YGValueResolve(node->style.minDimensions[YGDimensionWidth], axisSize);
max = YGValueToFloat(node->style.maxDimensions[YGDimensionWidth], axisSize); max = YGValueResolve(node->style.maxDimensions[YGDimensionWidth], axisSize);
} }
float boundValue = value; float boundValue = value;
@@ -1133,23 +1076,23 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node,
const bool isRowStyleDimDefined = YGNodeIsStyleDimDefined(child, YGFlexDirectionRow); const bool isRowStyleDimDefined = YGNodeIsStyleDimDefined(child, YGFlexDirectionRow);
const bool isColumnStyleDimDefined = YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn); const bool isColumnStyleDimDefined = YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn);
if (!YGValueIsUndefined(YGNodeStyleGetFlexBasisWithUnit(child)) && if (YGNodeStyleGetFlexBasis(child).defined &&
!YGFloatIsUndefined(mainAxisSize)) { !YGFloatIsUndefined(mainAxisSize)) {
if (YGFloatIsUndefined(child->layout.computedFlexBasis) || if (YGFloatIsUndefined(child->layout.computedFlexBasis) ||
(YGIsExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis) && (YGIsExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis) &&
child->layout.computedFlexBasisGeneration != gCurrentGenerationCount)) { child->layout.computedFlexBasisGeneration != gCurrentGenerationCount)) {
child->layout.computedFlexBasis = child->layout.computedFlexBasis =
fmaxf(YGValueToFloat(YGNodeStyleGetFlexBasisWithUnit(child), mainAxisParentSize), YGNodePaddingAndBorderForAxis(child, mainAxis, parentWidth)); fmaxf(YGValueResolve(YGNodeStyleGetFlexBasis(child), mainAxisParentSize), YGNodePaddingAndBorderForAxis(child, mainAxis, parentWidth));
} }
} else if (isMainAxisRow && isRowStyleDimDefined) { } else if (isMainAxisRow && isRowStyleDimDefined) {
// The width is definite, so use that as the flex basis. // The width is definite, so use that as the flex basis.
child->layout.computedFlexBasis = child->layout.computedFlexBasis =
fmaxf(YGValueToFloat(child->style.dimensions[YGDimensionWidth], parentWidth), fmaxf(YGValueResolve(child->style.dimensions[YGDimensionWidth], parentWidth),
YGNodePaddingAndBorderForAxis(child, YGFlexDirectionRow, parentWidth)); YGNodePaddingAndBorderForAxis(child, YGFlexDirectionRow, parentWidth));
} else if (!isMainAxisRow && isColumnStyleDimDefined) { } else if (!isMainAxisRow && isColumnStyleDimDefined) {
// The height is definite, so use that as the flex basis. // The height is definite, so use that as the flex basis.
child->layout.computedFlexBasis = child->layout.computedFlexBasis =
fmaxf(YGValueToFloat(child->style.dimensions[YGDimensionHeight], parentHeight), fmaxf(YGValueResolve(child->style.dimensions[YGDimensionHeight], parentHeight),
YGNodePaddingAndBorderForAxis(child, YGFlexDirectionColumn, parentWidth)); YGNodePaddingAndBorderForAxis(child, YGFlexDirectionColumn, parentWidth));
} else { } else {
// Compute the flex basis and hypothetical main size (i.e. the clamped // Compute the flex basis and hypothetical main size (i.e. the clamped
@@ -1160,12 +1103,12 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node,
childHeightMeasureMode = YGMeasureModeUndefined; childHeightMeasureMode = YGMeasureModeUndefined;
if (isRowStyleDimDefined) { if (isRowStyleDimDefined) {
childWidth = YGValueToFloat(child->style.dimensions[YGDimensionWidth], parentWidth) + childWidth = YGValueResolve(child->style.dimensions[YGDimensionWidth], parentWidth) +
YGNodeMarginForAxis(child, YGFlexDirectionRow, parentWidth); YGNodeMarginForAxis(child, YGFlexDirectionRow, parentWidth);
childWidthMeasureMode = YGMeasureModeExactly; childWidthMeasureMode = YGMeasureModeExactly;
} }
if (isColumnStyleDimDefined) { if (isColumnStyleDimDefined) {
childHeight = YGValueToFloat(child->style.dimensions[YGDimensionHeight], parentHeight) + childHeight = YGValueResolve(child->style.dimensions[YGDimensionHeight], parentHeight) +
YGNodeMarginForAxis(child, YGFlexDirectionColumn, parentWidth); YGNodeMarginForAxis(child, YGFlexDirectionColumn, parentWidth);
childHeightMeasureMode = YGMeasureModeExactly; childHeightMeasureMode = YGMeasureModeExactly;
} }
@@ -1216,10 +1159,10 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node,
} }
} }
YGConstrainMaxSizeForMode(YGValueToFloat(child->style.maxDimensions[YGDimensionWidth], parentWidth), YGConstrainMaxSizeForMode(YGValueResolve(child->style.maxDimensions[YGDimensionWidth], parentWidth),
&childWidthMeasureMode, &childWidthMeasureMode,
&childWidth); &childWidth);
YGConstrainMaxSizeForMode(YGValueToFloat(child->style.maxDimensions[YGDimensionHeight], parentHeight), YGConstrainMaxSizeForMode(YGValueResolve(child->style.maxDimensions[YGDimensionHeight], parentHeight),
&childHeightMeasureMode, &childHeightMeasureMode,
&childHeight); &childHeight);
@@ -1260,7 +1203,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
YGMeasureMode childHeightMeasureMode = YGMeasureModeUndefined; YGMeasureMode childHeightMeasureMode = YGMeasureModeUndefined;
if (YGNodeIsStyleDimDefined(child, YGFlexDirectionRow)) { if (YGNodeIsStyleDimDefined(child, YGFlexDirectionRow)) {
childWidth = YGValueToFloat(child->style.dimensions[YGDimensionWidth], width) + childWidth = YGValueResolve(child->style.dimensions[YGDimensionWidth], width) +
YGNodeMarginForAxis(child, YGFlexDirectionRow, width); YGNodeMarginForAxis(child, YGFlexDirectionRow, width);
} else { } else {
// If the child doesn't have a specified width, compute the width based // If the child doesn't have a specified width, compute the width based
@@ -1278,7 +1221,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
} }
if (YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn)) { if (YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn)) {
childHeight = YGValueToFloat(child->style.dimensions[YGDimensionHeight], height) + childHeight = YGValueResolve(child->style.dimensions[YGDimensionHeight], height) +
YGNodeMarginForAxis(child, YGFlexDirectionColumn, width); YGNodeMarginForAxis(child, YGFlexDirectionColumn, width);
} else { } else {
// If the child doesn't have a specified height, compute the height // If the child doesn't have a specified height, compute the height
@@ -1289,8 +1232,8 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
childHeight = node->layout.measuredDimensions[YGDimensionHeight] - childHeight = node->layout.measuredDimensions[YGDimensionHeight] -
(YGNodeLeadingBorder(node, YGFlexDirectionColumn) + (YGNodeLeadingBorder(node, YGFlexDirectionColumn) +
YGNodeTrailingBorder(node, YGFlexDirectionColumn)) - YGNodeTrailingBorder(node, YGFlexDirectionColumn)) -
(YGNodeLeadingPosition(child, YGFlexDirectionColumn, width) + (YGNodeLeadingPosition(child, YGFlexDirectionColumn, height) +
YGNodeTrailingPosition(child, YGFlexDirectionColumn, width)); YGNodeTrailingPosition(child, YGFlexDirectionColumn, height));
childHeight = YGNodeBoundAxis(child, YGFlexDirectionColumn, childHeight, height, width); childHeight = YGNodeBoundAxis(child, YGFlexDirectionColumn, childHeight, height, width);
} }
} }
@@ -1982,7 +1925,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
childHeightMeasureMode = childHeightMeasureMode =
YGFloatIsUndefined(childHeight) ? YGMeasureModeUndefined : YGMeasureModeAtMost; YGFloatIsUndefined(childHeight) ? YGMeasureModeUndefined : YGMeasureModeAtMost;
} else { } else {
childHeight = YGValueToFloat(currentRelativeChild->style.dimensions[YGDimensionHeight], availableInnerHeight) + childHeight = YGValueResolve(currentRelativeChild->style.dimensions[YGDimensionHeight], availableInnerHeight) +
YGNodeMarginForAxis(currentRelativeChild, YGFlexDirectionColumn, availableInnerWidth); YGNodeMarginForAxis(currentRelativeChild, YGFlexDirectionColumn, availableInnerWidth);
childHeightMeasureMode = YGMeasureModeExactly; childHeightMeasureMode = YGMeasureModeExactly;
} }
@@ -2002,7 +1945,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
childWidthMeasureMode = childWidthMeasureMode =
YGFloatIsUndefined(childWidth) ? YGMeasureModeUndefined : YGMeasureModeAtMost; YGFloatIsUndefined(childWidth) ? YGMeasureModeUndefined : YGMeasureModeAtMost;
} else { } else {
childWidth = YGValueToFloat(currentRelativeChild->style.dimensions[YGDimensionWidth], availableInnerWidth) + childWidth = YGValueResolve(currentRelativeChild->style.dimensions[YGDimensionWidth], availableInnerWidth) +
YGNodeMarginForAxis(currentRelativeChild, YGFlexDirectionRow, availableInnerWidth); YGNodeMarginForAxis(currentRelativeChild, YGFlexDirectionRow, availableInnerWidth);
childWidthMeasureMode = YGMeasureModeExactly; childWidthMeasureMode = YGMeasureModeExactly;
} }
@@ -2022,10 +1965,10 @@ static void YGNodelayoutImpl(const YGNodeRef node,
} }
} }
YGConstrainMaxSizeForMode(YGValueToFloat(currentRelativeChild->style.maxDimensions[YGDimensionWidth], availableInnerWidth), YGConstrainMaxSizeForMode(YGValueResolve(currentRelativeChild->style.maxDimensions[YGDimensionWidth], availableInnerWidth),
&childWidthMeasureMode, &childWidthMeasureMode,
&childWidth); &childWidth);
YGConstrainMaxSizeForMode(YGValueToFloat(currentRelativeChild->style.maxDimensions[YGDimensionHeight], availableInnerHeight), YGConstrainMaxSizeForMode(YGValueResolve(currentRelativeChild->style.maxDimensions[YGDimensionHeight], availableInnerHeight),
&childHeightMeasureMode, &childHeightMeasureMode,
&childHeight); &childHeight);
@@ -2065,10 +2008,10 @@ static void YGNodelayoutImpl(const YGNodeRef node,
// constraint by the min size defined for the main axis. // constraint by the min size defined for the main axis.
if (measureModeMainDim == YGMeasureModeAtMost && remainingFreeSpace > 0) { if (measureModeMainDim == YGMeasureModeAtMost && remainingFreeSpace > 0) {
if (!YGValueIsUndefined(node->style.minDimensions[dim[mainAxis]]) && if (node->style.minDimensions[dim[mainAxis]].defined &&
YGValueToFloat(node->style.minDimensions[dim[mainAxis]], mainAxisParentSize) >= 0) { YGValueResolve(node->style.minDimensions[dim[mainAxis]], mainAxisParentSize) >= 0) {
remainingFreeSpace = fmaxf(0, remainingFreeSpace = fmaxf(0,
YGValueToFloat(node->style.minDimensions[dim[mainAxis]], mainAxisParentSize) - YGValueResolve(node->style.minDimensions[dim[mainAxis]], mainAxisParentSize) -
(availableInnerMainDim - remainingFreeSpace)); (availableInnerMainDim - remainingFreeSpace));
} else { } else {
remainingFreeSpace = 0; remainingFreeSpace = 0;
@@ -2222,10 +2165,10 @@ static void YGNodelayoutImpl(const YGNodeRef node,
YGNodeMarginForAxis(child, YGFlexDirectionColumn, availableInnerWidth); YGNodeMarginForAxis(child, YGFlexDirectionColumn, availableInnerWidth);
} }
YGConstrainMaxSizeForMode(YGValueToFloat(child->style.maxDimensions[YGDimensionWidth], availableInnerWidth), YGConstrainMaxSizeForMode(YGValueResolve(child->style.maxDimensions[YGDimensionWidth], availableInnerWidth),
&childWidthMeasureMode, &childWidthMeasureMode,
&childWidth); &childWidth);
YGConstrainMaxSizeForMode(YGValueToFloat(child->style.maxDimensions[YGDimensionHeight], availableInnerHeight), YGConstrainMaxSizeForMode(YGValueResolve(child->style.maxDimensions[YGDimensionHeight], availableInnerHeight),
&childHeightMeasureMode, &childHeightMeasureMode,
&childHeight); &childHeight);
@@ -2763,22 +2706,22 @@ void YGNodeCalculateLayout(const YGNodeRef node,
if (!YGFloatIsUndefined(width)) { if (!YGFloatIsUndefined(width)) {
widthMeasureMode = YGMeasureModeExactly; widthMeasureMode = YGMeasureModeExactly;
} else if (YGNodeIsStyleDimDefined(node, YGFlexDirectionRow)) { } else if (YGNodeIsStyleDimDefined(node, YGFlexDirectionRow)) {
width = YGValueToFloat(node->style.dimensions[dim[YGFlexDirectionRow]], availableWidth) + width = YGValueResolve(node->style.dimensions[dim[YGFlexDirectionRow]], availableWidth) +
YGNodeMarginForAxis(node, YGFlexDirectionRow, availableWidth); YGNodeMarginForAxis(node, YGFlexDirectionRow, availableWidth);
widthMeasureMode = YGMeasureModeExactly; widthMeasureMode = YGMeasureModeExactly;
} else if (YGValueToFloat(node->style.maxDimensions[YGDimensionWidth], availableWidth) >= 0.0) { } else if (YGValueResolve(node->style.maxDimensions[YGDimensionWidth], availableWidth) >= 0.0) {
width = YGValueToFloat(node->style.maxDimensions[YGDimensionWidth], availableWidth); width = YGValueResolve(node->style.maxDimensions[YGDimensionWidth], availableWidth);
widthMeasureMode = YGMeasureModeAtMost; widthMeasureMode = YGMeasureModeAtMost;
} }
if (!YGFloatIsUndefined(height)) { if (!YGFloatIsUndefined(height)) {
heightMeasureMode = YGMeasureModeExactly; heightMeasureMode = YGMeasureModeExactly;
} else if (YGNodeIsStyleDimDefined(node, YGFlexDirectionColumn)) { } else if (YGNodeIsStyleDimDefined(node, YGFlexDirectionColumn)) {
height = YGValueToFloat(node->style.dimensions[dim[YGFlexDirectionColumn]], availableHeight) + height = YGValueResolve(node->style.dimensions[dim[YGFlexDirectionColumn]], availableHeight) +
YGNodeMarginForAxis(node, YGFlexDirectionColumn, availableWidth); YGNodeMarginForAxis(node, YGFlexDirectionColumn, availableWidth);
heightMeasureMode = YGMeasureModeExactly; heightMeasureMode = YGMeasureModeExactly;
} else if (YGValueToFloat(node->style.maxDimensions[YGDimensionHeight], availableHeight) >= 0.0) { } else if (YGValueResolve(node->style.maxDimensions[YGDimensionHeight], availableHeight) >= 0.0) {
height = YGValueToFloat(node->style.maxDimensions[YGDimensionHeight], availableHeight); height = YGValueResolve(node->style.maxDimensions[YGDimensionHeight], availableHeight);
heightMeasureMode = YGMeasureModeAtMost; heightMeasureMode = YGMeasureModeAtMost;
} }

View File

@@ -42,7 +42,6 @@ typedef struct YGValue{
float value; float value;
YGUnit unit; YGUnit unit;
bool defined; bool defined;
} YGValue; } YGValue;
WIN_EXPORT YGValue YGPx(const float value); WIN_EXPORT YGValue YGPx(const float value);
@@ -93,7 +92,6 @@ WIN_EXPORT bool YGNodeIsDirty(const YGNodeRef node);
WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options); WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options);
WIN_EXPORT bool YGFloatIsUndefined(const float value); WIN_EXPORT bool YGFloatIsUndefined(const float value);
WIN_EXPORT bool YGValueIsUndefined(const YGValue value);
WIN_EXPORT bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode, WIN_EXPORT bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
const float width, const float width,
@@ -119,9 +117,8 @@ WIN_EXPORT void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node); WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node);
#define YG_NODE_STYLE_PROPERTY_UNIT(type, name, paramName) \ #define YG_NODE_STYLE_PROPERTY_UNIT(type, name, paramName) \
YG_NODE_STYLE_PROPERTY(float, name, paramName); \ WIN_EXPORT void YGNodeStyleSet##name##(const YGNodeRef node, const type paramName); \
WIN_EXPORT void YGNodeStyleSet##name##WithUnit(const YGNodeRef node, const type paramName); \ WIN_EXPORT type YGNodeStyleGet##name##(const YGNodeRef node);
WIN_EXPORT type YGNodeStyleGet##name##WithUnit(const YGNodeRef node);
#define YG_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \ #define YG_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, \ WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, \
@@ -130,11 +127,10 @@ WIN_EXPORT void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge); WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge);
#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT(type, name, paramName) \ #define YG_NODE_STYLE_EDGE_PROPERTY_UNIT(type, name, paramName) \
YG_NODE_STYLE_EDGE_PROPERTY(float, name, paramName) \ WIN_EXPORT void YGNodeStyleSet##name##(const YGNodeRef node, \
WIN_EXPORT void YGNodeStyleSet##name##WithUnit(const YGNodeRef node, \
const YGEdge edge, \ const YGEdge edge, \
const type paramName); \ const type paramName); \
WIN_EXPORT type YGNodeStyleGet##name##WithUnit(const YGNodeRef node, const YGEdge edge); WIN_EXPORT type YGNodeStyleGet##name##(const YGNodeRef node, const YGEdge edge);
#define YG_NODE_LAYOUT_PROPERTY(type, name) \ #define YG_NODE_LAYOUT_PROPERTY(type, name) \
WIN_EXPORT type YGNodeLayoutGet##name(const YGNodeRef node); WIN_EXPORT type YGNodeLayoutGet##name(const YGNodeRef node);