Beispiel #1
0
TEST(YogaTest, padding_no_size) {
  const YGConfigRef config = YGConfigNew();

  const YGNodeRef root = YGNodeNewWithConfig(config);
  YGNodeStyleSetPadding(root, YGEdgeLeft, 10);
  YGNodeStyleSetPadding(root, YGEdgeTop, 10);
  YGNodeStyleSetPadding(root, YGEdgeRight, 10);
  YGNodeStyleSetPadding(root, YGEdgeBottom, 10);
  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
  ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root));
  ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root));

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
  ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root));
  ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root));

  YGNodeFreeRecursive(root);

  YGConfigFree(config);
}
TEST(YogaTest, zero_out_layout) {
  const YGNodeRef root = YGNodeNew();
  YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
  YGNodeStyleSetWidth(root, 200);
  YGNodeStyleSetHeight(root, 200);

  const YGNodeRef child = YGNodeNew();
  YGNodeInsertChild(root, child, 0);
  YGNodeStyleSetWidth(child, 100);
  YGNodeStyleSetHeight(child, 100);
  YGNodeStyleSetMargin(child, YGEdgeTop, 10);
  YGNodeStyleSetPadding(child, YGEdgeTop, 10);

  YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR);

  ASSERT_FLOAT_EQ(10, YGNodeLayoutGetMargin(child, YGEdgeTop));
  ASSERT_FLOAT_EQ(10, YGNodeLayoutGetPadding(child, YGEdgeTop));

  YGNodeStyleSetDisplay(child, YGDisplayNone);

  YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR);

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetMargin(child, YGEdgeTop));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetPadding(child, YGEdgeTop));

  YGNodeFreeRecursive(root);
}
Beispiel #3
0
TEST(YogaTest, child_with_padding_align_end) {
  const YGConfigRef config = YGConfigNew();

  const YGNodeRef root = YGNodeNewWithConfig(config);
  YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
  YGNodeStyleSetAlignItems(root, YGAlignFlexEnd);
  YGNodeStyleSetWidth(root, 200);
  YGNodeStyleSetHeight(root, 200);

  const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
  YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 20);
  YGNodeStyleSetPadding(root_child0, YGEdgeTop, 20);
  YGNodeStyleSetPadding(root_child0, YGEdgeRight, 20);
  YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 20);
  YGNodeStyleSetWidth(root_child0, 100);
  YGNodeStyleSetHeight(root_child0, 100);
  YGNodeInsertChild(root, root_child0, 0);
  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
  ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
  ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));

  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
  ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
  ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));

  YGNodeFreeRecursive(root);

  YGConfigFree(config);
}
Beispiel #4
0
TEST(YogaTest, padding_center_child) {
  const YGConfigRef config = YGConfigNew();

  const YGNodeRef root = YGNodeNewWithConfig(config);
  YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
  YGNodeStyleSetAlignItems(root, YGAlignCenter);
  YGNodeStyleSetPadding(root, YGEdgeStart, 10);
  YGNodeStyleSetPadding(root, YGEdgeEnd, 20);
  YGNodeStyleSetPadding(root, YGEdgeBottom, 20);
  YGNodeStyleSetWidth(root, 100);
  YGNodeStyleSetHeight(root, 100);

  const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
  YGNodeStyleSetWidth(root_child0, 10);
  YGNodeStyleSetHeight(root_child0, 10);
  YGNodeInsertChild(root, root_child0, 0);
  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));

  ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child0));
  ASSERT_FLOAT_EQ(35, YGNodeLayoutGetTop(root_child0));
  ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
  ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));

  ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
  ASSERT_FLOAT_EQ(35, YGNodeLayoutGetTop(root_child0));
  ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
  ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));

  YGNodeFreeRecursive(root);

  YGConfigFree(config);
}
Beispiel #5
0
TEST(YogaTest, padding_flex_child) {
  const YGConfigRef config = YGConfigNew();

  const YGNodeRef root = YGNodeNewWithConfig(config);
  YGNodeStyleSetPadding(root, YGEdgeLeft, 10);
  YGNodeStyleSetPadding(root, YGEdgeTop, 10);
  YGNodeStyleSetPadding(root, YGEdgeRight, 10);
  YGNodeStyleSetPadding(root, YGEdgeBottom, 10);
  YGNodeStyleSetWidth(root, 100);
  YGNodeStyleSetHeight(root, 100);

  const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
  YGNodeStyleSetFlexGrow(root_child0, 1);
  YGNodeStyleSetWidth(root_child0, 10);
  YGNodeInsertChild(root, root_child0, 0);
  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));

  ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0));
  ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
  ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
  ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child0));

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
  ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));

  ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0));
  ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
  ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
  ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child0));

  YGNodeFreeRecursive(root);

  YGConfigFree(config);
}
static YGSize _measureMax(YGNodeRef node,
                          float width,
                          YGMeasureMode widthMode,
                          float height,
                          YGMeasureMode heightMode) {
  int* measureCount = (int*)node->getContext();
  (*measureCount)++;

  return YGSize{
      .width = widthMode == YGMeasureModeUndefined ? 10 : width,
      .height = heightMode == YGMeasureModeUndefined ? 10 : height,
  };
}

static YGSize _measureMin(YGNodeRef node,
                          float width,
                          YGMeasureMode widthMode,
                          float height,
                          YGMeasureMode heightMode) {
  int* measureCount = (int*)node->getContext();
  *measureCount = *measureCount + 1;
  return YGSize{
      .width =
          widthMode == YGMeasureModeUndefined || (widthMode == YGMeasureModeAtMost && width > 10)
              ? 10
              : width,
      .height =
          heightMode == YGMeasureModeUndefined || (heightMode == YGMeasureModeAtMost && height > 10)
              ? 10
              : height,
  };
}

static YGSize _measure_84_49(YGNodeRef node,
                             float width,
                             YGMeasureMode widthMode,
                             float height,
                             YGMeasureMode heightMode) {
  int* measureCount = (int*)node->getContext();
  if (measureCount) {
    (*measureCount)++;
  }

  return YGSize{
      .width = 84.f, .height = 49.f,
  };
}

TEST(YogaTest, measure_once_single_flexible_child) {
  const YGNodeRef root = YGNodeNew();
  YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
  YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
  YGNodeStyleSetWidth(root, 100);
  YGNodeStyleSetHeight(root, 100);

  const YGNodeRef root_child0 = YGNodeNew();
  int measureCount = 0;
  root_child0->setContext(&measureCount);
  root_child0->setMeasureFunc(_measureMax);
  YGNodeStyleSetFlexGrow(root_child0, 1);
  YGNodeInsertChild(root, root_child0, 0);

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_EQ(1, measureCount);

  YGNodeFreeRecursive(root);
}

TEST(YogaTest, remeasure_with_same_exact_width_larger_than_needed_height) {
  const YGNodeRef root = YGNodeNew();

  const YGNodeRef root_child0 = YGNodeNew();
  int measureCount = 0;
  root_child0->setContext(&measureCount);
  root_child0->setMeasureFunc(_measureMin);
  YGNodeInsertChild(root, root_child0, 0);

  YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
  YGNodeCalculateLayout(root, 100, 50, YGDirectionLTR);

  ASSERT_EQ(1, measureCount);

  YGNodeFreeRecursive(root);
}

TEST(YogaTest, remeasure_with_same_atmost_width_larger_than_needed_height) {
  const YGNodeRef root = YGNodeNew();
  YGNodeStyleSetAlignItems(root, YGAlignFlexStart);

  const YGNodeRef root_child0 = YGNodeNew();
  int measureCount = 0;
  root_child0->setContext(&measureCount);
  root_child0->setMeasureFunc(_measureMin);
  YGNodeInsertChild(root, root_child0, 0);

  YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
  YGNodeCalculateLayout(root, 100, 50, YGDirectionLTR);

  ASSERT_EQ(1, measureCount);

  YGNodeFreeRecursive(root);
}

TEST(YogaTest, remeasure_with_computed_width_larger_than_needed_height) {
  const YGNodeRef root = YGNodeNew();
  YGNodeStyleSetAlignItems(root, YGAlignFlexStart);

  const YGNodeRef root_child0 = YGNodeNew();
  int measureCount = 0;
  root_child0->setContext(&measureCount);
  root_child0->setMeasureFunc(_measureMin);
  YGNodeInsertChild(root, root_child0, 0);

  YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
  YGNodeStyleSetAlignItems(root, YGAlignStretch);
  YGNodeCalculateLayout(root, 10, 50, YGDirectionLTR);

  ASSERT_EQ(1, measureCount);

  YGNodeFreeRecursive(root);
}

TEST(YogaTest, remeasure_with_atmost_computed_width_undefined_height) {
  const YGNodeRef root = YGNodeNew();
  YGNodeStyleSetAlignItems(root, YGAlignFlexStart);

  const YGNodeRef root_child0 = YGNodeNew();
  int measureCount = 0;
  root_child0->setContext(&measureCount);
  root_child0->setMeasureFunc(_measureMin);
  YGNodeInsertChild(root, root_child0, 0);

  YGNodeCalculateLayout(root, 100, YGUndefined, YGDirectionLTR);
  YGNodeCalculateLayout(root, 10, YGUndefined, YGDirectionLTR);

  ASSERT_EQ(1, measureCount);

  YGNodeFreeRecursive(root);
}

TEST(YogaTest, remeasure_with_already_measured_value_smaller_but_still_float_equal) {
  int measureCount = 0;

  const YGNodeRef root = YGNodeNew();
  YGNodeStyleSetWidth(root, 288.f);
  YGNodeStyleSetHeight(root, 288.f);
  YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);

  const YGNodeRef root_child0 = YGNodeNew();
  YGNodeStyleSetPadding(root_child0, YGEdgeAll, 2.88f);
  YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
  YGNodeInsertChild(root, root_child0, 0);

  const YGNodeRef root_child0_child0 = YGNodeNew();
  root_child0_child0->setContext(&measureCount);
  root_child0_child0->setMeasureFunc(_measure_84_49);
  YGNodeInsertChild(root_child0, root_child0_child0, 0);

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  YGNodeFreeRecursive(root);

  ASSERT_EQ(1, measureCount);
}
TEST(YogaTest, android_news_feed) {
  const YGConfigRef config = YGConfigNew();

  const YGNodeRef root = YGNodeNewWithConfig(config);
  YGNodeStyleSetAlignContent(root, YGAlignStretch);
  YGNodeStyleSetWidth(root, 1080);

  const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
  YGNodeInsertChild(root, root_child0, 0);

  const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
  YGNodeStyleSetAlignContent(root_child0_child0, YGAlignStretch);
  YGNodeInsertChild(root_child0, root_child0_child0, 0);

  const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
  YGNodeStyleSetAlignContent(root_child0_child0_child0, YGAlignStretch);
  YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);

  const YGNodeRef root_child0_child0_child0_child0 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetFlexDirection(
      root_child0_child0_child0_child0, YGFlexDirectionRow);
  YGNodeStyleSetAlignContent(root_child0_child0_child0_child0, YGAlignStretch);
  YGNodeStyleSetAlignItems(root_child0_child0_child0_child0, YGAlignFlexStart);
  YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeStart, 36);
  YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeTop, 24);
  YGNodeInsertChild(
      root_child0_child0_child0, root_child0_child0_child0_child0, 0);

  const YGNodeRef root_child0_child0_child0_child0_child0 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetFlexDirection(
      root_child0_child0_child0_child0_child0, YGFlexDirectionRow);
  YGNodeStyleSetAlignContent(
      root_child0_child0_child0_child0_child0, YGAlignStretch);
  YGNodeInsertChild(
      root_child0_child0_child0_child0,
      root_child0_child0_child0_child0_child0,
      0);

  const YGNodeRef root_child0_child0_child0_child0_child0_child0 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetAlignContent(
      root_child0_child0_child0_child0_child0_child0, YGAlignStretch);
  YGNodeStyleSetWidth(root_child0_child0_child0_child0_child0_child0, 120);
  YGNodeStyleSetHeight(root_child0_child0_child0_child0_child0_child0, 120);
  YGNodeInsertChild(
      root_child0_child0_child0_child0_child0,
      root_child0_child0_child0_child0_child0_child0,
      0);

  const YGNodeRef root_child0_child0_child0_child0_child1 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetAlignContent(
      root_child0_child0_child0_child0_child1, YGAlignStretch);
  YGNodeStyleSetFlexShrink(root_child0_child0_child0_child0_child1, 1);
  YGNodeStyleSetMargin(
      root_child0_child0_child0_child0_child1, YGEdgeRight, 36);
  YGNodeStyleSetPadding(
      root_child0_child0_child0_child0_child1, YGEdgeLeft, 36);
  YGNodeStyleSetPadding(root_child0_child0_child0_child0_child1, YGEdgeTop, 21);
  YGNodeStyleSetPadding(
      root_child0_child0_child0_child0_child1, YGEdgeRight, 36);
  YGNodeStyleSetPadding(
      root_child0_child0_child0_child0_child1, YGEdgeBottom, 18);
  YGNodeInsertChild(
      root_child0_child0_child0_child0,
      root_child0_child0_child0_child0_child1,
      1);

  const YGNodeRef root_child0_child0_child0_child0_child1_child0 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetFlexDirection(
      root_child0_child0_child0_child0_child1_child0, YGFlexDirectionRow);
  YGNodeStyleSetAlignContent(
      root_child0_child0_child0_child0_child1_child0, YGAlignStretch);
  YGNodeStyleSetFlexShrink(root_child0_child0_child0_child0_child1_child0, 1);
  YGNodeInsertChild(
      root_child0_child0_child0_child0_child1,
      root_child0_child0_child0_child0_child1_child0,
      0);

  const YGNodeRef root_child0_child0_child0_child0_child1_child1 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetAlignContent(
      root_child0_child0_child0_child0_child1_child1, YGAlignStretch);
  YGNodeStyleSetFlexShrink(root_child0_child0_child0_child0_child1_child1, 1);
  YGNodeInsertChild(
      root_child0_child0_child0_child0_child1,
      root_child0_child0_child0_child0_child1_child1,
      1);

  const YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config);
  YGNodeStyleSetAlignContent(root_child0_child0_child1, YGAlignStretch);
  YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1);

  const YGNodeRef root_child0_child0_child1_child0 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetFlexDirection(
      root_child0_child0_child1_child0, YGFlexDirectionRow);
  YGNodeStyleSetAlignContent(root_child0_child0_child1_child0, YGAlignStretch);
  YGNodeStyleSetAlignItems(root_child0_child0_child1_child0, YGAlignFlexStart);
  YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeStart, 174);
  YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeTop, 24);
  YGNodeInsertChild(
      root_child0_child0_child1, root_child0_child0_child1_child0, 0);

  const YGNodeRef root_child0_child0_child1_child0_child0 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetFlexDirection(
      root_child0_child0_child1_child0_child0, YGFlexDirectionRow);
  YGNodeStyleSetAlignContent(
      root_child0_child0_child1_child0_child0, YGAlignStretch);
  YGNodeInsertChild(
      root_child0_child0_child1_child0,
      root_child0_child0_child1_child0_child0,
      0);

  const YGNodeRef root_child0_child0_child1_child0_child0_child0 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetAlignContent(
      root_child0_child0_child1_child0_child0_child0, YGAlignStretch);
  YGNodeStyleSetWidth(root_child0_child0_child1_child0_child0_child0, 72);
  YGNodeStyleSetHeight(root_child0_child0_child1_child0_child0_child0, 72);
  YGNodeInsertChild(
      root_child0_child0_child1_child0_child0,
      root_child0_child0_child1_child0_child0_child0,
      0);

  const YGNodeRef root_child0_child0_child1_child0_child1 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetAlignContent(
      root_child0_child0_child1_child0_child1, YGAlignStretch);
  YGNodeStyleSetFlexShrink(root_child0_child0_child1_child0_child1, 1);
  YGNodeStyleSetMargin(
      root_child0_child0_child1_child0_child1, YGEdgeRight, 36);
  YGNodeStyleSetPadding(
      root_child0_child0_child1_child0_child1, YGEdgeLeft, 36);
  YGNodeStyleSetPadding(root_child0_child0_child1_child0_child1, YGEdgeTop, 21);
  YGNodeStyleSetPadding(
      root_child0_child0_child1_child0_child1, YGEdgeRight, 36);
  YGNodeStyleSetPadding(
      root_child0_child0_child1_child0_child1, YGEdgeBottom, 18);
  YGNodeInsertChild(
      root_child0_child0_child1_child0,
      root_child0_child0_child1_child0_child1,
      1);

  const YGNodeRef root_child0_child0_child1_child0_child1_child0 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetFlexDirection(
      root_child0_child0_child1_child0_child1_child0, YGFlexDirectionRow);
  YGNodeStyleSetAlignContent(
      root_child0_child0_child1_child0_child1_child0, YGAlignStretch);
  YGNodeStyleSetFlexShrink(root_child0_child0_child1_child0_child1_child0, 1);
  YGNodeInsertChild(
      root_child0_child0_child1_child0_child1,
      root_child0_child0_child1_child0_child1_child0,
      0);

  const YGNodeRef root_child0_child0_child1_child0_child1_child1 =
      YGNodeNewWithConfig(config);
  YGNodeStyleSetAlignContent(
      root_child0_child0_child1_child0_child1_child1, YGAlignStretch);
  YGNodeStyleSetFlexShrink(root_child0_child0_child1_child0_child1_child1, 1);
  YGNodeInsertChild(
      root_child0_child0_child1_child0_child1,
      root_child0_child0_child1_child0_child1_child1,
      1);
  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
  ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root));
  ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root));

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
  ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0));
  ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root_child0));

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
  ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0));
  ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root_child0_child0));

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
  ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0_child0));
  ASSERT_FLOAT_EQ(144, YGNodeLayoutGetHeight(root_child0_child0_child0));

  ASSERT_FLOAT_EQ(36, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(24, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(1044, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));

  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      120, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      120, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child0));

  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      120,
      YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      120,
      YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child0_child0));

  ASSERT_FLOAT_EQ(
      120, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1));
  ASSERT_FLOAT_EQ(
      72, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1));
  ASSERT_FLOAT_EQ(
      39, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1));

  ASSERT_FLOAT_EQ(
      36, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      21, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1_child0));

  ASSERT_FLOAT_EQ(
      36, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      21, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1_child1));

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1));
  ASSERT_FLOAT_EQ(144, YGNodeLayoutGetTop(root_child0_child0_child1));
  ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0_child1));
  ASSERT_FLOAT_EQ(96, YGNodeLayoutGetHeight(root_child0_child0_child1));

  ASSERT_FLOAT_EQ(174, YGNodeLayoutGetLeft(root_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(24, YGNodeLayoutGetTop(root_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(906, YGNodeLayoutGetWidth(root_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(72, YGNodeLayoutGetHeight(root_child0_child0_child1_child0));

  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child0));
  ASSERT_FLOAT_EQ(
      72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child0));
  ASSERT_FLOAT_EQ(
      72, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child0));

  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      72,
      YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child0_child0));

  ASSERT_FLOAT_EQ(
      72, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1));
  ASSERT_FLOAT_EQ(
      72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1));
  ASSERT_FLOAT_EQ(
      39, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1));

  ASSERT_FLOAT_EQ(
      36, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      21, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1_child0));

  ASSERT_FLOAT_EQ(
      36, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      21, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1_child1));

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
  ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root));
  ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root));

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
  ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0));
  ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root_child0));

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
  ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0));
  ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root_child0_child0));

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
  ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0_child0));
  ASSERT_FLOAT_EQ(144, YGNodeLayoutGetHeight(root_child0_child0_child0));

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(24, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(1044, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));

  ASSERT_FLOAT_EQ(
      924, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      120, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      120, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child0));

  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      120,
      YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      120,
      YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child0_child0));

  ASSERT_FLOAT_EQ(
      816, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1));
  ASSERT_FLOAT_EQ(
      72, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1));
  ASSERT_FLOAT_EQ(
      39, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1));

  ASSERT_FLOAT_EQ(
      36, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      21, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1_child0));

  ASSERT_FLOAT_EQ(
      36, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      21, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1_child1));

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1));
  ASSERT_FLOAT_EQ(144, YGNodeLayoutGetTop(root_child0_child0_child1));
  ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0_child1));
  ASSERT_FLOAT_EQ(96, YGNodeLayoutGetHeight(root_child0_child0_child1));

  ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(24, YGNodeLayoutGetTop(root_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(906, YGNodeLayoutGetWidth(root_child0_child0_child1_child0));
  ASSERT_FLOAT_EQ(72, YGNodeLayoutGetHeight(root_child0_child0_child1_child0));

  ASSERT_FLOAT_EQ(
      834, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child0));
  ASSERT_FLOAT_EQ(
      72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child0));
  ASSERT_FLOAT_EQ(
      72, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child0));

  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child0_child0));
  ASSERT_FLOAT_EQ(
      72,
      YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child0_child0));

  ASSERT_FLOAT_EQ(
      726, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1));
  ASSERT_FLOAT_EQ(
      72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1));
  ASSERT_FLOAT_EQ(
      39, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1));

  ASSERT_FLOAT_EQ(
      36, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      21, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1_child0));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1_child0));

  ASSERT_FLOAT_EQ(
      36, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      21, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1_child1));
  ASSERT_FLOAT_EQ(
      0, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1_child1));

  YGNodeFreeRecursive(root);

  YGConfigFree(config);
}