diff --git a/tests/YGTraversalTest.cpp b/tests/YGTraversalTest.cpp deleted file mode 100644 index 1c80e6de..00000000 --- a/tests/YGTraversalTest.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include - -TEST(YogaTest, pre_order_traversal) { - YGNodeRef const root = YGNodeNew(); - YGNodeRef const root_child0 = YGNodeNew(); - YGNodeRef const root_child1 = YGNodeNew(); - YGNodeRef const root_child0_child0 = YGNodeNew(); - - YGNodeSetChildren(root, {root_child0, root_child1}); - YGNodeInsertChild(root_child0, root_child0_child0, 0); - - std::vector visited; - YGTraversePreOrder( - root, [&visited](YGNodeRef node) { visited.push_back(node); }); - - const std::vector expected = { - root, root_child0, root_child0_child0, root_child1}; - ASSERT_EQ(visited, expected); - - YGNodeFreeRecursive(root); -} diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 915de666..78486e2e 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -4347,22 +4347,3 @@ YOGA_EXPORT void YGConfigSetCloneNodeFunc( const YGCloneNodeFunc callback) { config->setCloneNodeCallback(callback); } - -static void YGTraverseChildrenPreOrder( - const YGVector& children, - const std::function& f) { - for (YGNodeRef node : children) { - f(node); - YGTraverseChildrenPreOrder(node->getChildren(), f); - } -} - -void YGTraversePreOrder( - YGNodeRef const node, - std::function&& f) { - if (!node) { - return; - } - f(node); - YGTraverseChildrenPreOrder(node->getChildren(), f); -} diff --git a/yoga/Yoga.h b/yoga/Yoga.h index 501506d5..7b579687 100644 --- a/yoga/Yoga.h +++ b/yoga/Yoga.h @@ -367,14 +367,8 @@ YG_EXTERN_C_END #ifdef __cplusplus -#include #include -// Calls f on each node in the tree including the given node argument. -void YGTraversePreOrder( - YGNodeRef node, - std::function&& f); - void YGNodeSetChildren(YGNodeRef owner, const std::vector& children); #endif