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>
|
||||
|
||||
static YGSize _measureMax(
|
||||
@@ -14,7 +15,7 @@ static YGSize _measureMax(
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
int* measureCount = (int*) YGNodeGetContext(node);
|
||||
int* measureCount = (int*) node->getContext();
|
||||
(*measureCount)++;
|
||||
|
||||
return YGSize{
|
||||
@@ -29,7 +30,7 @@ static YGSize _measureMin(
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
int* measureCount = (int*) YGNodeGetContext(node);
|
||||
int* measureCount = (int*) node->getContext();
|
||||
*measureCount = *measureCount + 1;
|
||||
return YGSize{
|
||||
widthMode == YGMeasureModeUndefined ||
|
||||
@@ -49,7 +50,7 @@ static YGSize _measure_84_49(
|
||||
YGMeasureMode /*widthMode*/,
|
||||
float /*height*/,
|
||||
YGMeasureMode /*heightMode*/) {
|
||||
int* measureCount = (int*) YGNodeGetContext(node);
|
||||
int* measureCount = (int*) node->getContext();
|
||||
if (measureCount) {
|
||||
(*measureCount)++;
|
||||
}
|
||||
@@ -66,8 +67,8 @@ TEST(YogaTest, measure_once_single_flexible_child) {
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
int measureCount = 0;
|
||||
YGNodeSetContext(root_child0, &measureCount);
|
||||
YGNodeSetMeasureFunc(root_child0, _measureMax);
|
||||
root_child0->setContext(&measureCount);
|
||||
root_child0->setMeasureFunc(_measureMax);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
@@ -83,8 +84,8 @@ TEST(YogaTest, remeasure_with_same_exact_width_larger_than_needed_height) {
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
int measureCount = 0;
|
||||
YGNodeSetContext(root_child0, &measureCount);
|
||||
YGNodeSetMeasureFunc(root_child0, _measureMin);
|
||||
root_child0->setContext(&measureCount);
|
||||
root_child0->setMeasureFunc(_measureMin);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
|
||||
@@ -101,8 +102,8 @@ TEST(YogaTest, remeasure_with_same_atmost_width_larger_than_needed_height) {
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
int measureCount = 0;
|
||||
YGNodeSetContext(root_child0, &measureCount);
|
||||
YGNodeSetMeasureFunc(root_child0, _measureMin);
|
||||
root_child0->setContext(&measureCount);
|
||||
root_child0->setMeasureFunc(_measureMin);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
|
||||
@@ -119,8 +120,8 @@ TEST(YogaTest, remeasure_with_computed_width_larger_than_needed_height) {
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
int measureCount = 0;
|
||||
YGNodeSetContext(root_child0, &measureCount);
|
||||
YGNodeSetMeasureFunc(root_child0, _measureMin);
|
||||
root_child0->setContext(&measureCount);
|
||||
root_child0->setMeasureFunc(_measureMin);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
|
||||
@@ -138,8 +139,8 @@ TEST(YogaTest, remeasure_with_atmost_computed_width_undefined_height) {
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
int measureCount = 0;
|
||||
YGNodeSetContext(root_child0, &measureCount);
|
||||
YGNodeSetMeasureFunc(root_child0, _measureMin);
|
||||
root_child0->setContext(&measureCount);
|
||||
root_child0->setMeasureFunc(_measureMin);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, 100, YGUndefined, YGDirectionLTR);
|
||||
@@ -166,8 +167,8 @@ TEST(
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNew();
|
||||
YGNodeSetContext(root_child0_child0, &measureCount);
|
||||
YGNodeSetMeasureFunc(root_child0_child0, _measure_84_49);
|
||||
root_child0_child0->setContext(&measureCount);
|
||||
root_child0_child0->setMeasureFunc(_measure_84_49);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
Reference in New Issue
Block a user