Revert D48712710: C++ Cleanup 3/N: Reorganize YGNode
Differential Revision: D48712710 Original commit changeset: d28eae38469a Original Phabricator Diff: D48712710 fbshipit-source-id: 7a10b071edcf045ce98bbf8f9deca0d0e2e80a14
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6ca56e87ce
commit
ea7f61a3db
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/YGNode.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
struct _MeasureConstraint {
|
||||
@@ -27,7 +28,7 @@ static YGSize _measure(
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
struct _MeasureConstraintList* constraintList =
|
||||
(struct _MeasureConstraintList*) YGNodeGetContext(node);
|
||||
(struct _MeasureConstraintList*) node->getContext();
|
||||
struct _MeasureConstraint* constraints = constraintList->constraints;
|
||||
uint32_t currentIndex = constraintList->length;
|
||||
(&constraints[currentIndex])->width = width;
|
||||
@@ -54,8 +55,10 @@ TEST(YogaTest, exactly_measure_stretched_child_column) {
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeSetContext(root_child0, &constraintList);
|
||||
YGNodeSetMeasureFunc(root_child0, _measure);
|
||||
// root_child0->setContext(&constraintList);
|
||||
root_child0->setContext(&constraintList);
|
||||
root_child0->setMeasureFunc(_measure);
|
||||
// root_child0->setMeasureFunc(_measure);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -82,8 +85,9 @@ TEST(YogaTest, exactly_measure_stretched_child_row) {
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeSetContext(root_child0, &constraintList);
|
||||
YGNodeSetMeasureFunc(root_child0, _measure);
|
||||
// root_child0->setContext(&constraintList);
|
||||
root_child0->setContext(&constraintList);
|
||||
root_child0->setMeasureFunc(_measure);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -109,8 +113,8 @@ TEST(YogaTest, at_most_main_axis_column) {
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeSetContext(root_child0, &constraintList);
|
||||
YGNodeSetMeasureFunc(root_child0, _measure);
|
||||
root_child0->setContext(&constraintList);
|
||||
root_child0->setMeasureFunc(_measure);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -137,8 +141,8 @@ TEST(YogaTest, at_most_cross_axis_column) {
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeSetContext(root_child0, &constraintList);
|
||||
YGNodeSetMeasureFunc(root_child0, _measure);
|
||||
root_child0->setContext(&constraintList);
|
||||
root_child0->setMeasureFunc(_measure);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -165,8 +169,8 @@ TEST(YogaTest, at_most_main_axis_row) {
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeSetContext(root_child0, &constraintList);
|
||||
YGNodeSetMeasureFunc(root_child0, _measure);
|
||||
root_child0->setContext(&constraintList);
|
||||
root_child0->setMeasureFunc(_measure);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -194,8 +198,8 @@ TEST(YogaTest, at_most_cross_axis_row) {
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeSetContext(root_child0, &constraintList);
|
||||
YGNodeSetMeasureFunc(root_child0, _measure);
|
||||
root_child0->setContext(&constraintList);
|
||||
root_child0->setMeasureFunc(_measure);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -221,8 +225,8 @@ TEST(YogaTest, flex_child) {
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeSetContext(root_child0, &constraintList);
|
||||
YGNodeSetMeasureFunc(root_child0, _measure);
|
||||
root_child0->setContext(&constraintList);
|
||||
root_child0->setMeasureFunc(_measure);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -252,8 +256,8 @@ TEST(YogaTest, flex_child_with_flex_basis) {
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetFlexBasis(root_child0, 0);
|
||||
YGNodeSetContext(root_child0, &constraintList);
|
||||
YGNodeSetMeasureFunc(root_child0, _measure);
|
||||
root_child0->setContext(&constraintList);
|
||||
root_child0->setMeasureFunc(_measure);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -281,8 +285,8 @@ TEST(YogaTest, overflow_scroll_column) {
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeSetContext(root_child0, &constraintList);
|
||||
YGNodeSetMeasureFunc(root_child0, _measure);
|
||||
root_child0->setContext(&constraintList);
|
||||
root_child0->setMeasureFunc(_measure);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -314,8 +318,8 @@ TEST(YogaTest, overflow_scroll_row) {
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeSetContext(root_child0, &constraintList);
|
||||
YGNodeSetMeasureFunc(root_child0, _measure);
|
||||
root_child0->setContext(&constraintList);
|
||||
root_child0->setMeasureFunc(_measure);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
Reference in New Issue
Block a user