Rebase of facebook flexbox to yoga
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-third-party / yoga / YGNodeChildTest.cpp
1 /**
2  * Copyright (c) 2014-present, Facebook, Inc.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7
8 #include <gtest/gtest.h>
9 #include <yoga/Yoga.h>
10
11 TEST(YogaTest, reset_layout_when_child_removed) {
12   const YGNodeRef root = YGNodeNew();
13
14   const YGNodeRef root_child0 = YGNodeNew();
15   YGNodeStyleSetWidth(root_child0, 100);
16   YGNodeStyleSetHeight(root_child0, 100);
17   YGNodeInsertChild(root, root_child0, 0);
18
19   YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
20
21   ASSERT_EQ(0, YGNodeLayoutGetLeft(root_child0));
22   ASSERT_EQ(0, YGNodeLayoutGetTop(root_child0));
23   ASSERT_EQ(100, YGNodeLayoutGetWidth(root_child0));
24   ASSERT_EQ(100, YGNodeLayoutGetHeight(root_child0));
25
26   YGNodeRemoveChild(root, root_child0);
27
28   ASSERT_EQ(0, YGNodeLayoutGetLeft(root_child0));
29   ASSERT_EQ(0, YGNodeLayoutGetTop(root_child0));
30   ASSERT_TRUE(YGFloatIsUndefined(YGNodeLayoutGetWidth(root_child0)));
31   ASSERT_TRUE(YGFloatIsUndefined(YGNodeLayoutGetHeight(root_child0)));
32
33   YGNodeFreeRecursive(root);
34 }