Make YGNode as c++ struct with properties exposed through accessors
Summary: Moved c implementation of `YGNode` to C++ struct. Not moving to C++ class as the React Classes dependent on `Yoga.h` assume it to be C. Thats why keeping `Yoga.h` C compatible. Sorry for the long diff, didn't thought that it will turn out to be this much big.Will keep an eye on number of lines next time 😉
Reviewed By: emilsjolander
Differential Revision: D6592257
fbshipit-source-id: 641e8b9462ad00731a094511f9f5608b23a6bb21
This commit is contained in:
committed by
Facebook Github Bot
parent
dbf6a12134
commit
fbd332dee8
@@ -8,15 +8,15 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
#include <yoga/YGNode.h>
|
||||
|
||||
TEST(YogaTest, copy_style_same) {
|
||||
const YGNodeRef node0 = YGNodeNew();
|
||||
const YGNodeRef node1 = YGNodeNew();
|
||||
ASSERT_FALSE(YGNodeIsDirty(node0));
|
||||
ASSERT_FALSE(node0->isDirty());
|
||||
|
||||
YGNodeCopyStyle(node0, node1);
|
||||
ASSERT_FALSE(YGNodeIsDirty(node0));
|
||||
ASSERT_FALSE(node0->isDirty());
|
||||
|
||||
YGNodeFree(node0);
|
||||
YGNodeFree(node1);
|
||||
@@ -24,7 +24,7 @@ TEST(YogaTest, copy_style_same) {
|
||||
|
||||
TEST(YogaTest, copy_style_modified) {
|
||||
const YGNodeRef node0 = YGNodeNew();
|
||||
ASSERT_FALSE(YGNodeIsDirty(node0));
|
||||
ASSERT_FALSE(node0->isDirty());
|
||||
ASSERT_EQ(YGFlexDirectionColumn, YGNodeStyleGetFlexDirection(node0));
|
||||
ASSERT_FALSE(YGNodeStyleGetMaxHeight(node0).unit != YGUnitUndefined);
|
||||
|
||||
@@ -33,7 +33,7 @@ TEST(YogaTest, copy_style_modified) {
|
||||
YGNodeStyleSetMaxHeight(node1, 10);
|
||||
|
||||
YGNodeCopyStyle(node0, node1);
|
||||
ASSERT_TRUE(YGNodeIsDirty(node0));
|
||||
ASSERT_TRUE(node0->isDirty());
|
||||
ASSERT_EQ(YGFlexDirectionRow, YGNodeStyleGetFlexDirection(node0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeStyleGetMaxHeight(node0).value);
|
||||
|
||||
@@ -46,14 +46,14 @@ TEST(YogaTest, copy_style_modified_same) {
|
||||
YGNodeStyleSetFlexDirection(node0, YGFlexDirectionRow);
|
||||
YGNodeStyleSetMaxHeight(node0, 10);
|
||||
YGNodeCalculateLayout(node0, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
ASSERT_FALSE(YGNodeIsDirty(node0));
|
||||
ASSERT_FALSE(node0->isDirty());
|
||||
|
||||
const YGNodeRef node1 = YGNodeNew();
|
||||
YGNodeStyleSetFlexDirection(node1, YGFlexDirectionRow);
|
||||
YGNodeStyleSetMaxHeight(node1, 10);
|
||||
|
||||
YGNodeCopyStyle(node0, node1);
|
||||
ASSERT_FALSE(YGNodeIsDirty(node0));
|
||||
ASSERT_FALSE(node0->isDirty());
|
||||
|
||||
YGNodeFree(node0);
|
||||
YGNodeFree(node1);
|
||||
|
Reference in New Issue
Block a user