Rebase of facebook flexbox to yoga
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-third-party / yoga / YGComputedMarginTest.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, computed_layout_margin) {
12   const YGNodeRef root = YGNodeNew();
13   YGNodeStyleSetWidth(root, 100);
14   YGNodeStyleSetHeight(root, 100);
15   YGNodeStyleSetMarginPercent(root, YGEdgeStart, 10);
16
17   YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
18
19   ASSERT_FLOAT_EQ(10, YGNodeLayoutGetMargin(root, YGEdgeLeft));
20   ASSERT_FLOAT_EQ(0, YGNodeLayoutGetMargin(root, YGEdgeRight));
21
22   YGNodeCalculateLayout(root, 100, 100, YGDirectionRTL);
23
24   ASSERT_FLOAT_EQ(0, YGNodeLayoutGetMargin(root, YGEdgeLeft));
25   ASSERT_FLOAT_EQ(10, YGNodeLayoutGetMargin(root, YGEdgeRight));
26
27   YGNodeFreeRecursive(root);
28 }