Merge branch 'main' into export-D39929963
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,21 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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 <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
#include <yoga/event/event.h>
|
||||
#include <yoga/Yoga.h>
|
||||
#include <yoga/YGEnums.h>
|
||||
#include <yoga/YGNode.h>
|
||||
#include <yoga/testutil/testutil.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <yoga/YGEnums.h>
|
||||
|
||||
#include "util/TestUtil.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace yoga {
|
||||
|
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/internal/experiments-inl.h>
|
||||
|
||||
using namespace facebook::yoga::internal;
|
||||
|
||||
struct YogaInternalTest : public testing::Test {
|
||||
void SetUp() override;
|
||||
};
|
||||
|
||||
TEST_F(YogaInternalTest, experiments_are_initially_disabled) {
|
||||
ASSERT_EQ(isEnabled(Experiment::kDoubleMeasureCallbacks), false);
|
||||
}
|
||||
|
||||
TEST_F(YogaInternalTest, experiments_are_can_be_enabled) {
|
||||
enable(Experiment::kDoubleMeasureCallbacks);
|
||||
ASSERT_EQ(isEnabled(Experiment::kDoubleMeasureCallbacks), true);
|
||||
}
|
||||
|
||||
TEST_F(YogaInternalTest, experiments_are_can_be_disabled) {
|
||||
enable(Experiment::kDoubleMeasureCallbacks);
|
||||
disable(Experiment::kDoubleMeasureCallbacks);
|
||||
|
||||
ASSERT_EQ(isEnabled(Experiment::kDoubleMeasureCallbacks), false);
|
||||
}
|
||||
|
||||
TEST_F(YogaInternalTest, experiments_are_can_be_toggled_on) {
|
||||
disable(Experiment::kDoubleMeasureCallbacks);
|
||||
|
||||
ASSERT_EQ(toggle(Experiment::kDoubleMeasureCallbacks), false);
|
||||
ASSERT_EQ(isEnabled(Experiment::kDoubleMeasureCallbacks), true);
|
||||
}
|
||||
|
||||
TEST_F(YogaInternalTest, experiments_are_can_be_toggled_off) {
|
||||
enable(Experiment::kDoubleMeasureCallbacks);
|
||||
|
||||
ASSERT_EQ(toggle(Experiment::kDoubleMeasureCallbacks), true);
|
||||
ASSERT_EQ(isEnabled(Experiment::kDoubleMeasureCallbacks), false);
|
||||
}
|
||||
|
||||
void YogaInternalTest::SetUp() {
|
||||
disableAllExperiments();
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,444 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
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);
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,15 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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 <gtest/gtest.h>
|
||||
#include <yoga/testutil/testutil.h>
|
||||
#include <yoga/YGNode.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
#include "util/TestUtil.h"
|
||||
|
||||
using facebook::yoga::test::TestUtil;
|
||||
|
||||
TEST(YogaTest, assert_layout_trees_are_same) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
@@ -580,7 +580,11 @@ TEST(YogaDeathTest, cannot_add_child_to_node_with_measure_func) {
|
||||
root->setMeasureFunc(_measure);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
#if defined(__cpp_exceptions)
|
||||
ASSERT_THROW(YGNodeInsertChild(root, root_child0, 0), std::logic_error);
|
||||
#else // !defined(__cpp_exceptions)
|
||||
ASSERT_DEATH(YGNodeInsertChild(root, root_child0, 0), "Cannot add child.*");
|
||||
#endif // defined(__cpp_exceptions)
|
||||
YGNodeFree(root_child0);
|
||||
YGNodeFreeRecursive(root);
|
||||
}
|
||||
@@ -589,7 +593,11 @@ TEST(YogaDeathTest, cannot_add_nonnull_measure_func_to_non_leaf_node) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
#if defined(__cpp_exceptions)
|
||||
ASSERT_THROW(root->setMeasureFunc(_measure), std::logic_error);
|
||||
#else // !defined(__cpp_exceptions)
|
||||
ASSERT_DEATH(root->setMeasureFunc(_measure), "Cannot set measure function.*");
|
||||
#endif // defined(__cpp_exceptions)
|
||||
YGNodeFreeRecursive(root);
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
@@ -31,4 +31,5 @@ TEST(YogaTest, reset_layout_when_child_removed) {
|
||||
ASSERT_TRUE(YGFloatIsUndefined(YGNodeLayoutGetHeight(root_child0)));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
YGNodeFreeRecursive(root_child0);
|
||||
}
|
||||
|
@@ -1,15 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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 <gtest/gtest.h>
|
||||
#include <yoga/testutil/testutil.h>
|
||||
#include <yoga/Yoga.h>
|
||||
#include <yoga/YGNode.h>
|
||||
|
||||
#include "util/TestUtil.h"
|
||||
|
||||
using facebook::yoga::test::TestUtil;
|
||||
|
||||
TEST(YogaTest, cloning_shared_root) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
|
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from
|
||||
// gentest/fixtures/YGAbsolutePositionTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
@@ -184,9 +185,7 @@ TEST(YogaTest, absolute_layout_width_height_start_top_end_bottom) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(
|
||||
YogaTest,
|
||||
do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) {
|
||||
TEST(YogaTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -578,9 +577,7 @@ TEST(YogaTest, absolute_layout_align_items_center_on_child_only) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(
|
||||
YogaTest,
|
||||
absolute_layout_align_items_and_justify_content_center_and_top_position) {
|
||||
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_top_position) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -625,9 +622,7 @@ TEST(
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(
|
||||
YogaTest,
|
||||
absolute_layout_align_items_and_justify_content_center_and_bottom_position) {
|
||||
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_bottom_position) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -672,9 +667,7 @@ TEST(
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(
|
||||
YogaTest,
|
||||
absolute_layout_align_items_and_justify_content_center_and_left_position) {
|
||||
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_left_position) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -719,9 +712,7 @@ TEST(
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(
|
||||
YogaTest,
|
||||
absolute_layout_align_items_and_justify_content_center_and_right_position) {
|
||||
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_right_position) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from
|
||||
// gentest/fixtures/YGAlignContentTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
@@ -1,10 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
@@ -1879,7 +1881,7 @@ TEST(YogaTest, align_center_should_size_based_on_content) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, align_strech_should_size_based_on_parent) {
|
||||
TEST(YogaTest, align_stretch_should_size_based_on_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
@@ -1,10 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
292
tests/generated/YGAndroidNewsFeed.cpp
Normal file
292
tests/generated/YGAndroidNewsFeed.cpp
Normal file
@@ -0,0 +1,292 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
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);
|
||||
}
|
@@ -1,10 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
@@ -1,9 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
@@ -1,10 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from
|
||||
// gentest/fixtures/YGFlexDirectionTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
@@ -1,10 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
@@ -605,121 +607,3 @@ TEST(YogaTest, flex_grow_less_than_factor_one) {
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, flex_shrink_min_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetUseWebDefaults(config, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetWidth(root, 500);
|
||||
YGNodeStyleSetHeight(root, 500);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
|
||||
YGNodeStyleSetWidth(root_child0, 100);
|
||||
YGNodeStyleSetMinWidth(root_child0, 301);
|
||||
YGNodeStyleSetHeight(root_child0, 100);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionRow);
|
||||
YGNodeStyleSetWidth(root_child1, 100);
|
||||
YGNodeStyleSetMinWidth(root_child1, 25);
|
||||
YGNodeStyleSetHeight(root_child1, 100);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
|
||||
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child2, YGFlexDirectionRow);
|
||||
YGNodeStyleSetWidth(root_child2, 100);
|
||||
YGNodeStyleSetHeight(root_child2, 100);
|
||||
YGNodeInsertChild(root, root_child2, 2);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(301, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(301, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(401, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(99, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, flex_shrink_flex_grow_min_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetUseWebDefaults(config, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetWidth(root, 500);
|
||||
YGNodeStyleSetHeight(root, 500);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 0);
|
||||
YGNodeStyleSetFlexShrink(root_child0, 1);
|
||||
YGNodeStyleSetWidth(root_child0, 100);
|
||||
YGNodeStyleSetMinWidth(root_child0, 301);
|
||||
YGNodeStyleSetHeight(root_child0, 100);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionRow);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||
YGNodeStyleSetFlexShrink(root_child1, 1);
|
||||
YGNodeStyleSetWidth(root_child1, 100);
|
||||
YGNodeStyleSetMinWidth(root_child1, 25);
|
||||
YGNodeStyleSetHeight(root_child1, 100);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
|
||||
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child2, YGFlexDirectionRow);
|
||||
YGNodeStyleSetWidth(root_child2, 100);
|
||||
YGNodeStyleSetHeight(root_child2, 100);
|
||||
YGNodeStyleSetFlexShrink(root_child2, 1);
|
||||
YGNodeStyleSetFlexGrow(root_child2, 1);
|
||||
YGNodeInsertChild(root, root_child2, 2);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(301, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(301, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(401, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(99, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
@@ -1,10 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
2113
tests/generated/YGGapTest.cpp
Normal file
2113
tests/generated/YGGapTest.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from
|
||||
// gentest/fixtures/YGJustifyContentTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
@@ -998,9 +999,7 @@ TEST(YogaTest, justify_content_row_space_evenly) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(
|
||||
YogaTest,
|
||||
justify_content_min_width_with_padding_child_width_greater_than_parent) {
|
||||
TEST(YogaTest, justify_content_min_width_with_padding_child_width_greater_than_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -1077,9 +1076,7 @@ TEST(
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(
|
||||
YogaTest,
|
||||
justify_content_min_width_with_padding_child_width_lower_than_parent) {
|
||||
TEST(YogaTest, justify_content_min_width_with_padding_child_width_lower_than_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
@@ -1,10 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
@@ -1229,7 +1231,7 @@ TEST(YogaTest, margin_auto_right) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, margin_auto_left_and_right_strech) {
|
||||
TEST(YogaTest, margin_auto_left_and_right_stretch) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -1287,7 +1289,7 @@ TEST(YogaTest, margin_auto_left_and_right_strech) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, margin_auto_top_and_bottom_strech) {
|
||||
TEST(YogaTest, margin_auto_top_and_bottom_stretch) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from
|
||||
// gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
@@ -91,115 +92,6 @@ TEST(YogaTest, max_height) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, min_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetMinHeight(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
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(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
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(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, min_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetMinWidth(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
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(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
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(20, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, justify_content_min_max) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
@@ -1295,82 +1187,3 @@ TEST(YogaTest, min_max_percent_no_width_height) {
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
static YGSize _measureCk_test_label_shrink_based_on_height(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
|
||||
if (heightMode == YGMeasureModeAtMost) {
|
||||
return YGSize{
|
||||
.width = 290,
|
||||
.height = 103,
|
||||
};
|
||||
} else {
|
||||
return YGSize{
|
||||
.width = 290,
|
||||
.height = height,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
TEST(YogaTest, min_max_percent_margin_percent_no_width_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 320);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeight(root_child0_child0, 450);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child0_child0_child0, YGFlexDirectionRow);
|
||||
YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeTop, 5);
|
||||
YGNodeStyleSetMaxHeightPercent(root_child0_child0_child0, 10);
|
||||
YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0_child0_child0 =
|
||||
YGNodeNewWithConfig(config);
|
||||
YGNodeSetMeasureFunc(
|
||||
root_child0_child0_child0_child0,
|
||||
_measureCk_test_label_shrink_based_on_height);
|
||||
YGNodeInsertChild(
|
||||
root_child0_child0_child0, root_child0_child0_child0_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(45, YGNodeLayoutGetHeight(root_child0_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(290, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(45, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
@@ -1,10 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
@@ -1,10 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
@@ -247,61 +249,6 @@ TEST(YogaTest, percentage_flex_basis_cross) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, percentage_flex_basis_cross_min_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetMinHeightPercent(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 2);
|
||||
YGNodeStyleSetMinHeightPercent(root_child1, 10);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
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(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
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(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, percentage_flex_basis_main_max_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
@@ -647,9 +594,7 @@ TEST(YogaTest, percentage_flex_basis_cross_min_width) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(
|
||||
YogaTest,
|
||||
percentage_multiple_nested_with_padding_margin_and_percentage_values) {
|
||||
TEST(YogaTest, percentage_multiple_nested_with_padding_margin_and_percentage_values) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -1193,81 +1138,3 @@ TEST(YogaTest, percent_absolute_position) {
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
static YGSize _measureCk_test_label_shrink_based_on_height(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
|
||||
if (heightMode == YGMeasureModeAtMost) {
|
||||
return YGSize{
|
||||
.width = 290,
|
||||
.height = 103,
|
||||
};
|
||||
} else {
|
||||
return YGSize{
|
||||
.width = 290,
|
||||
.height = height,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
TEST(YogaTest, margin_percent_with_measure_func) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 320);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeight(root_child0_child0, 450);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child0_child0_child0, YGFlexDirectionRow);
|
||||
YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeTop, 5);
|
||||
YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0_child0_child0 =
|
||||
YGNodeNewWithConfig(config);
|
||||
YGNodeSetMeasureFunc(
|
||||
root_child0_child0_child0_child0,
|
||||
_measureCk_test_label_shrink_based_on_height);
|
||||
YGNodeInsertChild(
|
||||
root_child0_child0_child0, root_child0_child0_child0_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(103, YGNodeLayoutGetHeight(root_child0_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(290, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
|
||||
ASSERT_FLOAT_EQ(103, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
@@ -1,10 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
* 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.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from
|
||||
// gentest/fixtures/YGSizeOverflowTest.html
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
66
tests/util/TestUtil.cpp
Normal file
66
tests/util/TestUtil.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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 "TestUtil.h"
|
||||
|
||||
#include <yoga/YGNode.h>
|
||||
#include <yoga/event/event.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace yoga {
|
||||
namespace test {
|
||||
|
||||
int nodeInstanceCount = 0;
|
||||
|
||||
namespace {
|
||||
|
||||
void yogaEventSubscriber(
|
||||
const YGNode& node,
|
||||
Event::Type eventType,
|
||||
const Event::Data& eventData) {
|
||||
|
||||
switch (eventType) {
|
||||
case Event::NodeAllocation:
|
||||
nodeInstanceCount++;
|
||||
break;
|
||||
case Event::NodeDeallocation:
|
||||
nodeInstanceCount--;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void TestUtil::startCountingNodes() {
|
||||
nodeInstanceCount = 0;
|
||||
Event::subscribe(yogaEventSubscriber);
|
||||
}
|
||||
|
||||
int TestUtil::nodeCount() {
|
||||
return nodeInstanceCount;
|
||||
}
|
||||
|
||||
int TestUtil::stopCountingNodes() {
|
||||
Event::reset();
|
||||
auto prev = nodeInstanceCount;
|
||||
nodeInstanceCount = 0;
|
||||
return prev;
|
||||
}
|
||||
|
||||
ScopedEventSubscription::ScopedEventSubscription(
|
||||
std::function<Event::Subscriber>&& s) {
|
||||
Event::subscribe(std::move(s));
|
||||
}
|
||||
|
||||
ScopedEventSubscription::~ScopedEventSubscription() {
|
||||
Event::reset();
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace yoga
|
||||
} // namespace facebook
|
31
tests/util/TestUtil.h
Normal file
31
tests/util/TestUtil.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <yoga/event/event.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace facebook {
|
||||
namespace yoga {
|
||||
namespace test {
|
||||
|
||||
struct YOGA_EXPORT TestUtil {
|
||||
static void startCountingNodes();
|
||||
static int nodeCount();
|
||||
static int stopCountingNodes();
|
||||
};
|
||||
|
||||
struct ScopedEventSubscription {
|
||||
ScopedEventSubscription(std::function<Event::Subscriber>&&);
|
||||
~ScopedEventSubscription();
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
} // namespace yoga
|
||||
} // namespace facebook
|
Reference in New Issue
Block a user