Merge branch 'main' into fix-invalidate-owner-size
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.
|
||||
|
36
tests/CMakeLists.txt
Normal file
36
tests/CMakeLists.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
# 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.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(tests)
|
||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||
|
||||
include(FetchContent)
|
||||
include(GoogleTest)
|
||||
|
||||
set(YOGA_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
include(${YOGA_ROOT}/cmake/project-defaults.cmake)
|
||||
|
||||
# Fetch GTest
|
||||
cmake_policy(SET CMP0135 NEW)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
URL https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip
|
||||
)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
|
||||
add_subdirectory(${YOGA_ROOT}/yoga ${CMAKE_CURRENT_BINARY_DIR}/yoga)
|
||||
|
||||
file(GLOB SOURCES CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/**/*.cpp)
|
||||
|
||||
enable_testing()
|
||||
|
||||
add_executable(yogatests ${SOURCES})
|
||||
target_link_libraries(yogatests yogacore GTest::gtest_main)
|
||||
|
||||
gtest_discover_tests(yogatests)
|
@@ -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 {
|
||||
@@ -233,7 +234,7 @@ TEST_F(EventTest, layout_events_has_max_measure_cache) {
|
||||
YGNodeInsertChild(root, b, 1);
|
||||
YGNodeStyleSetFlexBasis(a, 10.0f);
|
||||
|
||||
for (auto s : {20, 30, 40}) {
|
||||
for (auto s : {20.0f, 30.0f, 40.0f}) {
|
||||
YGNodeCalculateLayout(root, s, s, YGDirectionLTR);
|
||||
}
|
||||
|
||||
@@ -303,8 +304,8 @@ EventArgs createArgs(
|
||||
};
|
||||
|
||||
EventArgs args = createArgs<E>(node, data);
|
||||
args.eventTestDataPtr = {new EventTestData{eventTestData},
|
||||
deleteEventTestData};
|
||||
args.eventTestDataPtr = {
|
||||
new EventTestData{eventTestData}, deleteEventTestData};
|
||||
return args;
|
||||
}
|
||||
|
||||
|
@@ -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.
|
||||
@@ -22,10 +22,7 @@ static YGSize _measure1(
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
return YGSize{
|
||||
.width = 42,
|
||||
.height = 50,
|
||||
};
|
||||
return YGSize{42, 50};
|
||||
}
|
||||
|
||||
static YGSize _measure2(
|
||||
@@ -34,10 +31,7 @@ static YGSize _measure2(
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
return YGSize{
|
||||
.width = 279,
|
||||
.height = 126,
|
||||
};
|
||||
return YGSize{279, 126};
|
||||
}
|
||||
|
||||
static YGNodeRef createYGNode(
|
||||
@@ -51,8 +45,8 @@ static YGNodeRef createYGNode(
|
||||
if (alignBaseline) {
|
||||
YGNodeStyleSetAlignItems(node, YGAlignBaseline);
|
||||
}
|
||||
YGNodeStyleSetWidth(node, width);
|
||||
YGNodeStyleSetHeight(node, height);
|
||||
YGNodeStyleSetWidth(node, (float) width);
|
||||
YGNodeStyleSetHeight(node, (float) height);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
@@ -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.
|
||||
@@ -16,8 +16,8 @@ static YGSize _measure(
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
return YGSize{
|
||||
.width = widthMode == YGMeasureModeExactly ? width : 50,
|
||||
.height = heightMode == YGMeasureModeExactly ? height : 50,
|
||||
widthMode == YGMeasureModeExactly ? width : 50,
|
||||
heightMode == YGMeasureModeExactly ? height : 50,
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -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.
|
||||
@@ -29,12 +29,13 @@ TEST(YogaTest, computed_layout_margin) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, margin_side_overrides_horizontal_and_vertical) {
|
||||
const std::array<YGEdge, 6> edges = {{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
const std::array<YGEdge, 6> edges = {
|
||||
{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
|
||||
for (float edgeValue = 0; edgeValue < 2; ++edgeValue) {
|
||||
for (const auto& edge : edges) {
|
||||
@@ -58,12 +59,13 @@ TEST(YogaTest, margin_side_overrides_horizontal_and_vertical) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, margin_side_overrides_all) {
|
||||
const std::array<YGEdge, 6> edges = {{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
const std::array<YGEdge, 6> edges = {
|
||||
{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
|
||||
for (float edgeValue = 0; edgeValue < 2; ++edgeValue) {
|
||||
for (const auto& edge : edges) {
|
||||
|
@@ -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.
|
||||
@@ -29,12 +29,13 @@ TEST(YogaTest, computed_layout_padding) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, padding_side_overrides_horizontal_and_vertical) {
|
||||
const std::array<YGEdge, 6> edges = {{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
const std::array<YGEdge, 6> edges = {
|
||||
{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
|
||||
for (float edgeValue = 0; edgeValue < 2; ++edgeValue) {
|
||||
for (const auto& edge : edges) {
|
||||
@@ -58,12 +59,13 @@ TEST(YogaTest, padding_side_overrides_horizontal_and_vertical) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, padding_side_overrides_all) {
|
||||
const std::array<YGEdge, 6> edges = {{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
const std::array<YGEdge, 6> edges = {
|
||||
{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
|
||||
for (float edgeValue = 0; edgeValue < 2; ++edgeValue) {
|
||||
for (const auto& edge : edges) {
|
||||
|
@@ -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.
|
||||
@@ -20,7 +20,7 @@ TEST(YogaTest, assert_default_values) {
|
||||
ASSERT_EQ(YGAlignFlexStart, YGNodeStyleGetAlignContent(root));
|
||||
ASSERT_EQ(YGAlignStretch, YGNodeStyleGetAlignItems(root));
|
||||
ASSERT_EQ(YGAlignAuto, YGNodeStyleGetAlignSelf(root));
|
||||
ASSERT_EQ(YGPositionTypeRelative, YGNodeStyleGetPositionType(root));
|
||||
ASSERT_EQ(YGPositionTypeStatic, YGNodeStyleGetPositionType(root));
|
||||
ASSERT_EQ(YGWrapNoWrap, YGNodeStyleGetFlexWrap(root));
|
||||
ASSERT_EQ(YGOverflowVisible, YGNodeStyleGetOverflow(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeStyleGetFlexGrow(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,54 +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/Yoga.h>
|
||||
|
||||
// This test isn't correct from the Flexbox standard standpoint,
|
||||
// because percentages are calculated with parent constraints.
|
||||
// However, we need to make sure we fail gracefully in this case, not returning
|
||||
// NaN
|
||||
TEST(YogaTest, percent_absolute_position_infinite_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetWidth(root, 300);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child0, 300);
|
||||
YGNodeStyleSetHeight(root_child0, 300);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetPositionPercent(root_child1, YGEdgeLeft, 20);
|
||||
YGNodeStyleSetPositionPercent(root_child1, YGEdgeTop, 20);
|
||||
YGNodeStyleSetWidthPercent(root_child1, 20);
|
||||
YGNodeStyleSetHeightPercent(root_child1, 20);
|
||||
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(300, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
@@ -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.
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <stdarg.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
#if DEBUG
|
||||
|
||||
namespace {
|
||||
char writeBuffer[4096];
|
||||
int _unmanagedLogger(
|
||||
@@ -73,8 +75,7 @@ TEST(YogaTest, logger_default_node_should_print_no_style_info) {
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFree(root);
|
||||
|
||||
@@ -98,8 +99,7 @@ TEST(YogaTest, logger_node_with_percentage_absolute_position_and_margin) {
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFree(root);
|
||||
|
||||
@@ -122,8 +122,7 @@ TEST(YogaTest, logger_node_with_children_should_print_indented) {
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
@@ -134,3 +133,5 @@ TEST(YogaTest, logger_node_with_children_should_print_indented) {
|
||||
"style=\"\" ></div>\n</div>";
|
||||
ASSERT_STREQ(expected, writeBuffer);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -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.
|
||||
@@ -19,8 +19,8 @@ static YGSize _measureMax(
|
||||
(*measureCount)++;
|
||||
|
||||
return YGSize{
|
||||
.width = widthMode == YGMeasureModeUndefined ? 10 : width,
|
||||
.height = heightMode == YGMeasureModeUndefined ? 10 : height,
|
||||
widthMode == YGMeasureModeUndefined ? 10 : width,
|
||||
heightMode == YGMeasureModeUndefined ? 10 : height,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@ static YGSize _measureMin(
|
||||
int* measureCount = (int*) node->getContext();
|
||||
*measureCount = *measureCount + 1;
|
||||
return YGSize{
|
||||
.width = widthMode == YGMeasureModeUndefined ||
|
||||
widthMode == YGMeasureModeUndefined ||
|
||||
(widthMode == YGMeasureModeAtMost && width > 10)
|
||||
? 10
|
||||
: width,
|
||||
.height = heightMode == YGMeasureModeUndefined ||
|
||||
heightMode == YGMeasureModeUndefined ||
|
||||
(heightMode == YGMeasureModeAtMost && height > 10)
|
||||
? 10
|
||||
: height,
|
||||
@@ -55,10 +55,7 @@ static YGSize _measure_84_49(
|
||||
(*measureCount)++;
|
||||
}
|
||||
|
||||
return YGSize{
|
||||
.width = 84.f,
|
||||
.height = 49.f,
|
||||
};
|
||||
return YGSize{84.f, 49.f};
|
||||
}
|
||||
|
||||
TEST(YogaTest, measure_once_single_flexible_child) {
|
||||
|
@@ -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.
|
||||
@@ -38,15 +38,15 @@ static YGSize _measure(
|
||||
constraintList->length = currentIndex + 1;
|
||||
|
||||
return YGSize{
|
||||
.width = widthMode == YGMeasureModeUndefined ? 10 : width,
|
||||
.height = heightMode == YGMeasureModeUndefined ? 10 : width,
|
||||
widthMode == YGMeasureModeUndefined ? 10 : width,
|
||||
heightMode == YGMeasureModeUndefined ? 10 : width,
|
||||
};
|
||||
}
|
||||
|
||||
TEST(YogaTest, exactly_measure_stretched_child_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -74,8 +74,8 @@ TEST(YogaTest, exactly_measure_stretched_child_column) {
|
||||
|
||||
TEST(YogaTest, exactly_measure_stretched_child_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -103,8 +103,8 @@ TEST(YogaTest, exactly_measure_stretched_child_row) {
|
||||
|
||||
TEST(YogaTest, at_most_main_axis_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -130,8 +130,8 @@ TEST(YogaTest, at_most_main_axis_column) {
|
||||
|
||||
TEST(YogaTest, at_most_cross_axis_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -158,8 +158,8 @@ TEST(YogaTest, at_most_cross_axis_column) {
|
||||
|
||||
TEST(YogaTest, at_most_main_axis_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -186,8 +186,8 @@ TEST(YogaTest, at_most_main_axis_row) {
|
||||
|
||||
TEST(YogaTest, at_most_cross_axis_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -215,8 +215,8 @@ TEST(YogaTest, at_most_cross_axis_row) {
|
||||
|
||||
TEST(YogaTest, flex_child) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -245,8 +245,8 @@ TEST(YogaTest, flex_child) {
|
||||
|
||||
TEST(YogaTest, flex_child_with_flex_basis) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -273,8 +273,8 @@ TEST(YogaTest, flex_child_with_flex_basis) {
|
||||
|
||||
TEST(YogaTest, overflow_scroll_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -305,8 +305,8 @@ TEST(YogaTest, overflow_scroll_column) {
|
||||
|
||||
TEST(YogaTest, overflow_scroll_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
|
@@ -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.
|
||||
@@ -20,10 +20,7 @@ static YGSize _measure(
|
||||
(*measureCount)++;
|
||||
}
|
||||
|
||||
return YGSize{
|
||||
.width = 10,
|
||||
.height = 10,
|
||||
};
|
||||
return YGSize{10, 10};
|
||||
}
|
||||
|
||||
static YGSize _simulate_wrapping_text(
|
||||
@@ -33,13 +30,10 @@ static YGSize _simulate_wrapping_text(
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
if (widthMode == YGMeasureModeUndefined || width >= 68) {
|
||||
return YGSize{.width = 68, .height = 16};
|
||||
return YGSize{68, 16};
|
||||
}
|
||||
|
||||
return YGSize{
|
||||
.width = 50,
|
||||
.height = 32,
|
||||
};
|
||||
return YGSize{50, 32};
|
||||
}
|
||||
|
||||
static YGSize _measure_assert_negative(
|
||||
@@ -51,10 +45,7 @@ static YGSize _measure_assert_negative(
|
||||
EXPECT_GE(width, 0);
|
||||
EXPECT_GE(height, 0);
|
||||
|
||||
return YGSize{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
};
|
||||
return YGSize{0, 0};
|
||||
}
|
||||
|
||||
TEST(YogaTest, dont_measure_single_grow_shrink_child) {
|
||||
@@ -580,7 +571,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 +584,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);
|
||||
}
|
||||
|
||||
@@ -648,10 +647,7 @@ static YGSize _measure_90_10(
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
|
||||
return YGSize{
|
||||
.width = 90,
|
||||
.height = 10,
|
||||
};
|
||||
return YGSize{90, 10};
|
||||
}
|
||||
|
||||
static YGSize _measure_100_100(
|
||||
@@ -661,10 +657,7 @@ static YGSize _measure_100_100(
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
|
||||
return YGSize{
|
||||
.width = 100,
|
||||
.height = 100,
|
||||
};
|
||||
return YGSize{100, 100};
|
||||
}
|
||||
|
||||
TEST(YogaTest, percent_with_text_node) {
|
||||
|
@@ -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.
|
||||
@@ -48,7 +48,7 @@ TEST(YGNode, measure_with_context_measure_fn) {
|
||||
return *(YGSize*) ctx;
|
||||
});
|
||||
|
||||
auto result = YGSize{123.4, -56.7};
|
||||
auto result = YGSize{123.4f, -56.7f};
|
||||
ASSERT_EQ(
|
||||
n.measure(0, YGMeasureModeUndefined, 0, YGMeasureModeUndefined, &result),
|
||||
result);
|
||||
|
@@ -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.
|
||||
@@ -48,7 +48,7 @@ static YGSize measureText(
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
return (YGSize){.width = 10, .height = 10};
|
||||
return YGSize{10, 10};
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/facebook/yoga/issues/824
|
||||
@@ -57,7 +57,7 @@ TEST(YogaTest, consistent_rounding_during_repeated_layouts) {
|
||||
YGConfigSetPointScaleFactor(config, 2);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetMargin(root, YGEdgeTop, -1.49);
|
||||
YGNodeStyleSetMargin(root, YGEdgeTop, -1.49f);
|
||||
YGNodeStyleSetWidth(root, 500);
|
||||
YGNodeStyleSetHeight(root, 500);
|
||||
|
||||
@@ -70,7 +70,7 @@ TEST(YogaTest, consistent_rounding_during_repeated_layouts) {
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
// Dirty the tree so YGRoundToPixelGrid runs again
|
||||
YGNodeStyleSetMargin(root, YGEdgeLeft, i + 1);
|
||||
YGNodeStyleSetMargin(root, YGEdgeLeft, (float) (i + 1));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(node1));
|
||||
|
@@ -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.
|
||||
@@ -57,8 +57,8 @@ TEST(YogaTest, rounding_feature_with_custom_measure_func_floor) {
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(10.2, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10.2, YGNodeLayoutGetHeight(root_child0));
|
||||
ASSERT_FLOAT_EQ(10.2f, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10.2f, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGConfigSetPointScaleFactor(config, 1.0f);
|
||||
|
||||
|
@@ -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.
|
||||
@@ -81,6 +81,9 @@ namespace yoga {
|
||||
|
||||
using CompactValue = detail::CompactValue;
|
||||
|
||||
// TODO: MSVC doesn't like the macros
|
||||
#ifndef _MSC_VER
|
||||
|
||||
ACCESSOR_TEST(
|
||||
direction,
|
||||
YGDirectionInherit,
|
||||
@@ -132,9 +135,10 @@ ACCESSOR_TEST(
|
||||
|
||||
ACCESSOR_TEST(
|
||||
positionType,
|
||||
YGPositionTypeRelative,
|
||||
YGPositionTypeStatic,
|
||||
YGPositionTypeAbsolute,
|
||||
YGPositionTypeRelative)
|
||||
YGPositionTypeRelative,
|
||||
YGPositionTypeStatic)
|
||||
|
||||
ACCESSOR_TEST(
|
||||
flexWrap,
|
||||
@@ -249,5 +253,7 @@ ACCESSOR_TEST(
|
||||
YGFloatOptional{0.0f},
|
||||
YGFloatOptional{});
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace yoga
|
||||
} // namespace facebook
|
||||
|
@@ -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.
|
||||
@@ -29,8 +29,8 @@ TEST(YogaTest, set_children_adds_children_to_parent) {
|
||||
const std::vector<YGNodeRef> expectedChildren = {root_child0, root_child1};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> owners = {
|
||||
YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {root, root};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
@@ -49,8 +49,8 @@ TEST(YogaTest, set_children_to_empty_removes_old_children) {
|
||||
const std::vector<YGNodeRef> expectedChildren = {};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> owners = {
|
||||
YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, nullptr};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
@@ -73,8 +73,8 @@ TEST(YogaTest, set_children_replaces_non_common_children) {
|
||||
const std::vector<YGNodeRef> expectedChildren = {root_child2, root_child3};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> owners = {
|
||||
YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, nullptr};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
@@ -100,10 +100,11 @@ TEST(YogaTest, set_children_keeps_and_reorders_common_children) {
|
||||
root_child2, root_child1, root_child3};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1),
|
||||
YGNodeGetOwner(root_child2),
|
||||
YGNodeGetOwner(root_child3)};
|
||||
const std::vector<YGNodeRef> owners = {
|
||||
YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1),
|
||||
YGNodeGetOwner(root_child2),
|
||||
YGNodeGetOwner(root_child3)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, root, root, root};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
|
@@ -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,17 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, absolute_layout_width_height_start_top) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -55,6 +58,8 @@ TEST(YogaTest, absolute_layout_width_height_start_top) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_width_height_end_bottom) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -98,6 +103,8 @@ TEST(YogaTest, absolute_layout_width_height_end_bottom) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_start_top_end_bottom) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -141,6 +148,8 @@ TEST(YogaTest, absolute_layout_start_top_end_bottom) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_width_height_start_top_end_bottom) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -184,10 +193,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -246,6 +255,8 @@ TEST(
|
||||
|
||||
TEST(YogaTest, absolute_layout_within_border) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetMargin(root, YGEdgeLeft, 10);
|
||||
@@ -363,6 +374,8 @@ TEST(YogaTest, absolute_layout_within_border) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -407,6 +420,8 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_center) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_align_items_and_justify_content_flex_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
|
||||
@@ -451,6 +466,8 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_flex_end) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_justify_content_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -494,6 +511,8 @@ TEST(YogaTest, absolute_layout_justify_content_center) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_align_items_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -537,6 +556,8 @@ TEST(YogaTest, absolute_layout_align_items_center) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_align_items_center_on_child_only) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root, 1);
|
||||
@@ -578,10 +599,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -625,10 +646,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -672,10 +693,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -719,10 +740,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -768,6 +789,8 @@ TEST(
|
||||
|
||||
TEST(YogaTest, position_root_with_rtl_should_position_withoutdirection) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPosition(root, YGEdgeLeft, 72);
|
||||
@@ -794,6 +817,8 @@ TEST(YogaTest, position_root_with_rtl_should_position_withoutdirection) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_percentage_bottom_based_on_parent_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -870,6 +895,8 @@ TEST(YogaTest, absolute_layout_percentage_bottom_based_on_parent_height) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_in_wrap_reverse_column_container) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexWrap(root, YGWrapWrapReverse);
|
||||
@@ -912,6 +939,8 @@ TEST(YogaTest, absolute_layout_in_wrap_reverse_column_container) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_in_wrap_reverse_row_container) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -955,6 +984,8 @@ TEST(YogaTest, absolute_layout_in_wrap_reverse_row_container) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_in_wrap_reverse_column_container_flex_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexWrap(root, YGWrapWrapReverse);
|
||||
@@ -998,6 +1029,8 @@ TEST(YogaTest, absolute_layout_in_wrap_reverse_column_container_flex_end) {
|
||||
|
||||
TEST(YogaTest, absolute_layout_in_wrap_reverse_row_container_flex_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1039,3 +1072,153 @@ TEST(YogaTest, absolute_layout_in_wrap_reverse_row_container_flex_end) {
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, percent_absolute_position_infinite_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 300);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child0, 300);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetPositionPercent(root_child1, YGEdgeLeft, 20);
|
||||
YGNodeStyleSetPositionPercent(root_child1, YGEdgeTop, 20);
|
||||
YGNodeStyleSetWidthPercent(root_child1, 20);
|
||||
YGNodeStyleSetHeightPercent(root_child1, 20);
|
||||
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(300, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, absolute_layout_percentage_height_based_on_padded_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPadding(root, YGEdgeTop, 10);
|
||||
YGNodeStyleSetBorder(root, YGEdgeTop, 10);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root_child0, 100);
|
||||
YGNodeStyleSetHeightPercent(root_child0, 50);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, absolute_layout_percentage_height_based_on_padded_parent_and_align_items_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
YGNodeStyleSetPadding(root, YGEdgeTop, 20);
|
||||
YGNodeStyleSetPadding(root, YGEdgeBottom, 20);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root_child0, 100);
|
||||
YGNodeStyleSetHeightPercent(root_child0, 50);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
@@ -1,17 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, align_content_flex_start) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -114,6 +117,8 @@ TEST(YogaTest, align_content_flex_start) {
|
||||
|
||||
TEST(YogaTest, align_content_flex_start_without_height_on_children) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
|
||||
@@ -212,6 +217,8 @@ TEST(YogaTest, align_content_flex_start_without_height_on_children) {
|
||||
|
||||
TEST(YogaTest, align_content_flex_start_with_flex) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
|
||||
@@ -316,6 +323,8 @@ TEST(YogaTest, align_content_flex_start_with_flex) {
|
||||
|
||||
TEST(YogaTest, align_content_flex_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignContent(root, YGAlignFlexEnd);
|
||||
@@ -418,6 +427,8 @@ TEST(YogaTest, align_content_flex_end) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignContent(root, YGAlignStretch);
|
||||
@@ -515,6 +526,8 @@ TEST(YogaTest, align_content_stretch) {
|
||||
|
||||
TEST(YogaTest, align_content_spacebetween) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -618,6 +631,8 @@ TEST(YogaTest, align_content_spacebetween) {
|
||||
|
||||
TEST(YogaTest, align_content_spacearound) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -721,6 +736,8 @@ TEST(YogaTest, align_content_spacearound) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -819,6 +836,8 @@ TEST(YogaTest, align_content_stretch_row) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_row_with_children) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -933,6 +952,8 @@ TEST(YogaTest, align_content_stretch_row_with_children) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_row_with_flex) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1037,6 +1058,8 @@ TEST(YogaTest, align_content_stretch_row_with_flex) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_row_with_flex_no_shrink) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1140,6 +1163,8 @@ TEST(YogaTest, align_content_stretch_row_with_flex_no_shrink) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_row_with_margin) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1246,6 +1271,8 @@ TEST(YogaTest, align_content_stretch_row_with_margin) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_row_with_padding) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1352,6 +1379,8 @@ TEST(YogaTest, align_content_stretch_row_with_padding) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_row_with_single_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1408,6 +1437,8 @@ TEST(YogaTest, align_content_stretch_row_with_single_row) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_row_with_fixed_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1507,6 +1538,8 @@ TEST(YogaTest, align_content_stretch_row_with_fixed_height) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_row_with_max_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1606,6 +1639,8 @@ TEST(YogaTest, align_content_stretch_row_with_max_height) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_row_with_min_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1705,6 +1740,8 @@ TEST(YogaTest, align_content_stretch_row_with_min_height) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignContent(root, YGAlignStretch);
|
||||
@@ -1821,6 +1858,8 @@ TEST(YogaTest, align_content_stretch_column) {
|
||||
|
||||
TEST(YogaTest, align_content_stretch_is_not_overriding_align_items) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignContent(root, YGAlignStretch);
|
@@ -1,16 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, align_items_stretch) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -50,6 +54,8 @@ TEST(YogaTest, align_items_stretch) {
|
||||
|
||||
TEST(YogaTest, align_items_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -91,6 +97,8 @@ TEST(YogaTest, align_items_center) {
|
||||
|
||||
TEST(YogaTest, align_items_flex_start) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
|
||||
@@ -132,6 +140,8 @@ TEST(YogaTest, align_items_flex_start) {
|
||||
|
||||
TEST(YogaTest, align_items_flex_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignFlexEnd);
|
||||
@@ -173,6 +183,8 @@ TEST(YogaTest, align_items_flex_end) {
|
||||
|
||||
TEST(YogaTest, align_baseline) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -230,6 +242,8 @@ TEST(YogaTest, align_baseline) {
|
||||
|
||||
TEST(YogaTest, align_baseline_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -302,6 +316,8 @@ TEST(YogaTest, align_baseline_child) {
|
||||
|
||||
TEST(YogaTest, align_baseline_child_multiline) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -421,6 +437,8 @@ TEST(YogaTest, align_baseline_child_multiline) {
|
||||
|
||||
TEST(YogaTest, align_baseline_child_multiline_override) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -542,6 +560,8 @@ TEST(YogaTest, align_baseline_child_multiline_override) {
|
||||
|
||||
TEST(YogaTest, align_baseline_child_multiline_no_override_on_secondline) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -662,6 +682,8 @@ TEST(YogaTest, align_baseline_child_multiline_no_override_on_secondline) {
|
||||
|
||||
TEST(YogaTest, align_baseline_child_top) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -735,6 +757,8 @@ TEST(YogaTest, align_baseline_child_top) {
|
||||
|
||||
TEST(YogaTest, align_baseline_child_top2) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -808,6 +832,8 @@ TEST(YogaTest, align_baseline_child_top2) {
|
||||
|
||||
TEST(YogaTest, align_baseline_double_nested_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -895,6 +921,8 @@ TEST(YogaTest, align_baseline_double_nested_child) {
|
||||
|
||||
TEST(YogaTest, align_baseline_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
|
||||
@@ -951,6 +979,8 @@ TEST(YogaTest, align_baseline_column) {
|
||||
|
||||
TEST(YogaTest, align_baseline_child_margin) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1031,6 +1061,8 @@ TEST(YogaTest, align_baseline_child_margin) {
|
||||
|
||||
TEST(YogaTest, align_baseline_child_padding) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1111,6 +1143,8 @@ TEST(YogaTest, align_baseline_child_padding) {
|
||||
|
||||
TEST(YogaTest, align_baseline_multiline) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1229,6 +1263,8 @@ TEST(YogaTest, align_baseline_multiline) {
|
||||
|
||||
TEST(YogaTest, align_baseline_multiline_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
|
||||
@@ -1346,6 +1382,8 @@ TEST(YogaTest, align_baseline_multiline_column) {
|
||||
|
||||
TEST(YogaTest, align_baseline_multiline_column2) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
|
||||
@@ -1463,6 +1501,8 @@ TEST(YogaTest, align_baseline_multiline_column2) {
|
||||
|
||||
TEST(YogaTest, align_baseline_multiline_row_and_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1581,6 +1621,8 @@ TEST(YogaTest, align_baseline_multiline_row_and_column) {
|
||||
|
||||
TEST(YogaTest, align_items_center_child_with_margin_bigger_than_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -1639,6 +1681,8 @@ TEST(YogaTest, align_items_center_child_with_margin_bigger_than_parent) {
|
||||
|
||||
TEST(YogaTest, align_items_flex_end_child_with_margin_bigger_than_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -1697,6 +1741,8 @@ TEST(YogaTest, align_items_flex_end_child_with_margin_bigger_than_parent) {
|
||||
|
||||
TEST(YogaTest, align_items_center_child_without_margin_bigger_than_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -1753,6 +1799,8 @@ TEST(YogaTest, align_items_center_child_without_margin_bigger_than_parent) {
|
||||
|
||||
TEST(YogaTest, align_items_flex_end_child_without_margin_bigger_than_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -1809,6 +1857,8 @@ TEST(YogaTest, align_items_flex_end_child_without_margin_bigger_than_parent) {
|
||||
|
||||
TEST(YogaTest, align_center_should_size_based_on_content) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -1879,8 +1929,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetMargin(root, YGEdgeTop, 20);
|
||||
@@ -1952,6 +2004,8 @@ TEST(YogaTest, align_strech_should_size_based_on_parent) {
|
||||
|
||||
TEST(YogaTest, align_flex_start_with_shrinking_children) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 500);
|
||||
@@ -2021,6 +2075,8 @@ TEST(YogaTest, align_flex_start_with_shrinking_children) {
|
||||
|
||||
TEST(YogaTest, align_flex_start_with_stretching_children) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 500);
|
||||
@@ -2089,6 +2145,8 @@ TEST(YogaTest, align_flex_start_with_stretching_children) {
|
||||
|
||||
TEST(YogaTest, align_flex_start_with_shrinking_children_with_stretch) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 500);
|
@@ -1,16 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, align_self_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -52,6 +56,8 @@ TEST(YogaTest, align_self_center) {
|
||||
|
||||
TEST(YogaTest, align_self_flex_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -93,6 +99,8 @@ TEST(YogaTest, align_self_flex_end) {
|
||||
|
||||
TEST(YogaTest, align_self_flex_start) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -134,6 +142,8 @@ TEST(YogaTest, align_self_flex_start) {
|
||||
|
||||
TEST(YogaTest, align_self_flex_end_override_flex_start) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
|
||||
@@ -176,6 +186,8 @@ TEST(YogaTest, align_self_flex_end_override_flex_start) {
|
||||
|
||||
TEST(YogaTest, align_self_baseline) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
294
tests/generated/YGAndroidNewsFeed.cpp
Normal file
294
tests/generated/YGAndroidNewsFeed.cpp
Normal file
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
* 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
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,16 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, border_no_size) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetBorder(root, YGEdgeLeft, 10);
|
||||
@@ -38,6 +42,8 @@ TEST(YogaTest, border_no_size) {
|
||||
|
||||
TEST(YogaTest, border_container_match_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetBorder(root, YGEdgeLeft, 10);
|
||||
@@ -80,6 +86,8 @@ TEST(YogaTest, border_container_match_child) {
|
||||
|
||||
TEST(YogaTest, border_flex_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetBorder(root, YGEdgeLeft, 10);
|
||||
@@ -124,6 +132,8 @@ TEST(YogaTest, border_flex_child) {
|
||||
|
||||
TEST(YogaTest, border_stretch_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetBorder(root, YGEdgeLeft, 10);
|
||||
@@ -167,6 +177,8 @@ TEST(YogaTest, border_stretch_child) {
|
||||
|
||||
TEST(YogaTest, border_center_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
@@ -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,16 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, wrap_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
||||
@@ -49,6 +53,8 @@ TEST(YogaTest, wrap_child) {
|
||||
|
||||
TEST(YogaTest, wrap_grandchild) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
@@ -1,16 +1,20 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
// clang-format off
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
TEST(YogaTest, display_none) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -66,6 +70,8 @@ TEST(YogaTest, display_none) {
|
||||
|
||||
TEST(YogaTest, display_none_fixed_size) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -122,6 +128,8 @@ TEST(YogaTest, display_none_fixed_size) {
|
||||
|
||||
TEST(YogaTest, display_none_with_margin) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -182,6 +190,8 @@ TEST(YogaTest, display_none_with_margin) {
|
||||
|
||||
TEST(YogaTest, display_none_with_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -274,6 +284,8 @@ TEST(YogaTest, display_none_with_child) {
|
||||
|
||||
TEST(YogaTest, display_none_with_position) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -327,3 +339,47 @@ TEST(YogaTest, display_none_with_position) {
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, display_none_with_position_absolute) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root_child0, 100);
|
||||
YGNodeStyleSetHeight(root_child0, 100);
|
||||
YGNodeStyleSetDisplay(root_child0, YGDisplayNone);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
@@ -1,17 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, flex_direction_column_no_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -78,6 +81,8 @@ TEST(YogaTest, flex_direction_column_no_height) {
|
||||
|
||||
TEST(YogaTest, flex_direction_row_no_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -145,6 +150,8 @@ TEST(YogaTest, flex_direction_row_no_width) {
|
||||
|
||||
TEST(YogaTest, flex_direction_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -212,6 +219,8 @@ TEST(YogaTest, flex_direction_column) {
|
||||
|
||||
TEST(YogaTest, flex_direction_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -280,6 +289,8 @@ TEST(YogaTest, flex_direction_row) {
|
||||
|
||||
TEST(YogaTest, flex_direction_column_reverse) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse);
|
||||
@@ -348,6 +359,8 @@ TEST(YogaTest, flex_direction_column_reverse) {
|
||||
|
||||
TEST(YogaTest, flex_direction_row_reverse) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
|
@@ -1,16 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, flex_basis_flex_grow_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -65,6 +69,8 @@ TEST(YogaTest, flex_basis_flex_grow_column) {
|
||||
|
||||
TEST(YogaTest, flex_shrink_flex_grow_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -123,6 +129,8 @@ TEST(YogaTest, flex_shrink_flex_grow_row) {
|
||||
|
||||
TEST(YogaTest, flex_shrink_flex_grow_child_flex_shrink_other_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -182,6 +190,8 @@ TEST(YogaTest, flex_shrink_flex_grow_child_flex_shrink_other_child) {
|
||||
|
||||
TEST(YogaTest, flex_basis_flex_grow_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -237,6 +247,8 @@ TEST(YogaTest, flex_basis_flex_grow_row) {
|
||||
|
||||
TEST(YogaTest, flex_basis_flex_shrink_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -291,6 +303,8 @@ TEST(YogaTest, flex_basis_flex_shrink_column) {
|
||||
|
||||
TEST(YogaTest, flex_basis_flex_shrink_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -346,6 +360,8 @@ TEST(YogaTest, flex_basis_flex_shrink_row) {
|
||||
|
||||
TEST(YogaTest, flex_shrink_to_zero) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeight(root, 75);
|
||||
@@ -416,6 +432,8 @@ TEST(YogaTest, flex_shrink_to_zero) {
|
||||
|
||||
TEST(YogaTest, flex_basis_overrides_main_size) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -487,6 +505,8 @@ TEST(YogaTest, flex_basis_overrides_main_size) {
|
||||
|
||||
TEST(YogaTest, flex_grow_shrink_at_most) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -540,6 +560,8 @@ TEST(YogaTest, flex_grow_shrink_at_most) {
|
||||
|
||||
TEST(YogaTest, flex_grow_less_than_factor_one) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -605,121 +627,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,16 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, wrap_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
|
||||
@@ -96,6 +100,8 @@ TEST(YogaTest, wrap_column) {
|
||||
|
||||
TEST(YogaTest, wrap_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -182,6 +188,8 @@ TEST(YogaTest, wrap_row) {
|
||||
|
||||
TEST(YogaTest, wrap_row_align_items_flex_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -269,6 +277,8 @@ TEST(YogaTest, wrap_row_align_items_flex_end) {
|
||||
|
||||
TEST(YogaTest, wrap_row_align_items_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -356,6 +366,8 @@ TEST(YogaTest, wrap_row_align_items_center) {
|
||||
|
||||
TEST(YogaTest, flex_wrap_children_with_min_main_overriding_flex_basis) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -414,6 +426,8 @@ TEST(YogaTest, flex_wrap_children_with_min_main_overriding_flex_basis) {
|
||||
|
||||
TEST(YogaTest, flex_wrap_wrap_to_child_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
||||
@@ -497,6 +511,8 @@ TEST(YogaTest, flex_wrap_wrap_to_child_height) {
|
||||
|
||||
TEST(YogaTest, flex_wrap_align_stretch_fits_one_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -552,6 +568,8 @@ TEST(YogaTest, flex_wrap_align_stretch_fits_one_row) {
|
||||
|
||||
TEST(YogaTest, wrap_reverse_row_align_content_flex_start) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -653,6 +671,8 @@ TEST(YogaTest, wrap_reverse_row_align_content_flex_start) {
|
||||
|
||||
TEST(YogaTest, wrap_reverse_row_align_content_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -755,6 +775,8 @@ TEST(YogaTest, wrap_reverse_row_align_content_center) {
|
||||
|
||||
TEST(YogaTest, wrap_reverse_row_single_line_different_size) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -856,6 +878,8 @@ TEST(YogaTest, wrap_reverse_row_single_line_different_size) {
|
||||
|
||||
TEST(YogaTest, wrap_reverse_row_align_content_stretch) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -958,6 +982,8 @@ TEST(YogaTest, wrap_reverse_row_align_content_stretch) {
|
||||
|
||||
TEST(YogaTest, wrap_reverse_row_align_content_space_around) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1060,6 +1086,8 @@ TEST(YogaTest, wrap_reverse_row_align_content_space_around) {
|
||||
|
||||
TEST(YogaTest, wrap_reverse_column_fixed_size) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -1162,6 +1190,8 @@ TEST(YogaTest, wrap_reverse_column_fixed_size) {
|
||||
|
||||
TEST(YogaTest, wrapped_row_within_align_items_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -1233,6 +1263,8 @@ TEST(YogaTest, wrapped_row_within_align_items_center) {
|
||||
|
||||
TEST(YogaTest, wrapped_row_within_align_items_flex_start) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
|
||||
@@ -1304,6 +1336,8 @@ TEST(YogaTest, wrapped_row_within_align_items_flex_start) {
|
||||
|
||||
TEST(YogaTest, wrapped_row_within_align_items_flex_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignFlexEnd);
|
||||
@@ -1375,6 +1409,8 @@ TEST(YogaTest, wrapped_row_within_align_items_flex_end) {
|
||||
|
||||
TEST(YogaTest, wrapped_column_max_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -1454,6 +1490,8 @@ TEST(YogaTest, wrapped_column_max_height) {
|
||||
|
||||
TEST(YogaTest, wrapped_column_max_height_flex) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -1539,6 +1577,8 @@ TEST(YogaTest, wrapped_column_max_height_flex) {
|
||||
|
||||
TEST(YogaTest, wrap_nodes_with_content_sizing_overflowing_margin) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 500);
|
||||
@@ -1637,6 +1677,8 @@ TEST(YogaTest, wrap_nodes_with_content_sizing_overflowing_margin) {
|
||||
|
||||
TEST(YogaTest, wrap_nodes_with_content_sizing_margin_cross) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 500);
|
2159
tests/generated/YGGapTest.cpp
Normal file
2159
tests/generated/YGGapTest.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, justify_content_row_flex_start) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -80,6 +83,8 @@ TEST(YogaTest, justify_content_row_flex_start) {
|
||||
|
||||
TEST(YogaTest, justify_content_row_flex_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -149,6 +154,8 @@ TEST(YogaTest, justify_content_row_flex_end) {
|
||||
|
||||
TEST(YogaTest, justify_content_row_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -218,6 +225,8 @@ TEST(YogaTest, justify_content_row_center) {
|
||||
|
||||
TEST(YogaTest, justify_content_row_space_between) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -287,6 +296,8 @@ TEST(YogaTest, justify_content_row_space_between) {
|
||||
|
||||
TEST(YogaTest, justify_content_row_space_around) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -356,6 +367,8 @@ TEST(YogaTest, justify_content_row_space_around) {
|
||||
|
||||
TEST(YogaTest, justify_content_column_flex_start) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 102);
|
||||
@@ -423,6 +436,8 @@ TEST(YogaTest, justify_content_column_flex_start) {
|
||||
|
||||
TEST(YogaTest, justify_content_column_flex_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
|
||||
@@ -491,6 +506,8 @@ TEST(YogaTest, justify_content_column_flex_end) {
|
||||
|
||||
TEST(YogaTest, justify_content_column_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -559,6 +576,8 @@ TEST(YogaTest, justify_content_column_center) {
|
||||
|
||||
TEST(YogaTest, justify_content_column_space_between) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifySpaceBetween);
|
||||
@@ -627,6 +646,8 @@ TEST(YogaTest, justify_content_column_space_between) {
|
||||
|
||||
TEST(YogaTest, justify_content_column_space_around) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifySpaceAround);
|
||||
@@ -695,6 +716,8 @@ TEST(YogaTest, justify_content_column_space_around) {
|
||||
|
||||
TEST(YogaTest, justify_content_row_min_width_and_margin) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -737,6 +760,8 @@ TEST(YogaTest, justify_content_row_min_width_and_margin) {
|
||||
|
||||
TEST(YogaTest, justify_content_row_max_width_and_margin) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -780,6 +805,8 @@ TEST(YogaTest, justify_content_row_max_width_and_margin) {
|
||||
|
||||
TEST(YogaTest, justify_content_column_min_height_and_margin) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -821,6 +848,8 @@ TEST(YogaTest, justify_content_column_min_height_and_margin) {
|
||||
|
||||
TEST(YogaTest, justify_content_colunn_max_height_and_margin) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -863,6 +892,8 @@ TEST(YogaTest, justify_content_colunn_max_height_and_margin) {
|
||||
|
||||
TEST(YogaTest, justify_content_column_space_evenly) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifySpaceEvenly);
|
||||
@@ -931,6 +962,8 @@ TEST(YogaTest, justify_content_column_space_evenly) {
|
||||
|
||||
TEST(YogaTest, justify_content_row_space_evenly) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -998,10 +1031,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignContent(root, YGAlignStretch);
|
||||
@@ -1077,10 +1110,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignContent(root, YGAlignStretch);
|
@@ -1,16 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, margin_start) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -52,6 +56,8 @@ TEST(YogaTest, margin_start) {
|
||||
|
||||
TEST(YogaTest, margin_top) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -92,6 +98,8 @@ TEST(YogaTest, margin_top) {
|
||||
|
||||
TEST(YogaTest, margin_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -134,6 +142,8 @@ TEST(YogaTest, margin_end) {
|
||||
|
||||
TEST(YogaTest, margin_bottom) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
|
||||
@@ -175,6 +185,8 @@ TEST(YogaTest, margin_bottom) {
|
||||
|
||||
TEST(YogaTest, margin_and_flex_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -217,6 +229,8 @@ TEST(YogaTest, margin_and_flex_row) {
|
||||
|
||||
TEST(YogaTest, margin_and_flex_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -258,6 +272,8 @@ TEST(YogaTest, margin_and_flex_column) {
|
||||
|
||||
TEST(YogaTest, margin_and_stretch_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -300,6 +316,8 @@ TEST(YogaTest, margin_and_stretch_row) {
|
||||
|
||||
TEST(YogaTest, margin_and_stretch_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -341,6 +359,8 @@ TEST(YogaTest, margin_and_stretch_column) {
|
||||
|
||||
TEST(YogaTest, margin_with_sibling_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -396,6 +416,8 @@ TEST(YogaTest, margin_with_sibling_row) {
|
||||
|
||||
TEST(YogaTest, margin_with_sibling_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -450,6 +472,8 @@ TEST(YogaTest, margin_with_sibling_column) {
|
||||
|
||||
TEST(YogaTest, margin_auto_bottom) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -507,6 +531,8 @@ TEST(YogaTest, margin_auto_bottom) {
|
||||
|
||||
TEST(YogaTest, margin_auto_top) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -564,6 +590,8 @@ TEST(YogaTest, margin_auto_top) {
|
||||
|
||||
TEST(YogaTest, margin_auto_bottom_and_top) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -622,6 +650,8 @@ TEST(YogaTest, margin_auto_bottom_and_top) {
|
||||
|
||||
TEST(YogaTest, margin_auto_bottom_and_top_justify_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -680,6 +710,8 @@ TEST(YogaTest, margin_auto_bottom_and_top_justify_center) {
|
||||
|
||||
TEST(YogaTest, margin_auto_mutiple_children_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -753,6 +785,8 @@ TEST(YogaTest, margin_auto_mutiple_children_column) {
|
||||
|
||||
TEST(YogaTest, margin_auto_mutiple_children_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -827,6 +861,8 @@ TEST(YogaTest, margin_auto_mutiple_children_row) {
|
||||
|
||||
TEST(YogaTest, margin_auto_left_and_right_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -886,6 +922,8 @@ TEST(YogaTest, margin_auto_left_and_right_column) {
|
||||
|
||||
TEST(YogaTest, margin_auto_left_and_right) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -943,6 +981,8 @@ TEST(YogaTest, margin_auto_left_and_right) {
|
||||
|
||||
TEST(YogaTest, margin_auto_start_and_end_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1002,6 +1042,8 @@ TEST(YogaTest, margin_auto_start_and_end_column) {
|
||||
|
||||
TEST(YogaTest, margin_auto_start_and_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -1059,6 +1101,8 @@ TEST(YogaTest, margin_auto_start_and_end) {
|
||||
|
||||
TEST(YogaTest, margin_auto_left_and_right_column_and_center) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -1117,6 +1161,8 @@ TEST(YogaTest, margin_auto_left_and_right_column_and_center) {
|
||||
|
||||
TEST(YogaTest, margin_auto_left) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -1174,6 +1220,8 @@ TEST(YogaTest, margin_auto_left) {
|
||||
|
||||
TEST(YogaTest, margin_auto_right) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -1229,8 +1277,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1287,8 +1337,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -1346,6 +1398,8 @@ TEST(YogaTest, margin_auto_top_and_bottom_strech) {
|
||||
|
||||
TEST(YogaTest, margin_should_not_be_part_of_max_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 250);
|
||||
@@ -1388,6 +1442,8 @@ TEST(YogaTest, margin_should_not_be_part_of_max_height) {
|
||||
|
||||
TEST(YogaTest, margin_should_not_be_part_of_max_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 250);
|
||||
@@ -1430,6 +1486,8 @@ TEST(YogaTest, margin_should_not_be_part_of_max_width) {
|
||||
|
||||
TEST(YogaTest, margin_auto_left_right_child_bigger_than_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -1473,6 +1531,8 @@ TEST(YogaTest, margin_auto_left_right_child_bigger_than_parent) {
|
||||
|
||||
TEST(YogaTest, margin_auto_left_child_bigger_than_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -1515,6 +1575,8 @@ TEST(YogaTest, margin_auto_left_child_bigger_than_parent) {
|
||||
|
||||
TEST(YogaTest, margin_fix_left_auto_right_child_bigger_than_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -1558,6 +1620,8 @@ TEST(YogaTest, margin_fix_left_auto_right_child_bigger_than_parent) {
|
||||
|
||||
TEST(YogaTest, margin_auto_left_fix_right_child_bigger_than_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -1601,6 +1665,8 @@ TEST(YogaTest, margin_auto_left_fix_right_child_bigger_than_parent) {
|
||||
|
||||
TEST(YogaTest, margin_auto_top_stretching_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -1659,6 +1725,8 @@ TEST(YogaTest, margin_auto_top_stretching_child) {
|
||||
|
||||
TEST(YogaTest, margin_auto_left_stretching_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
@@ -1,17 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, max_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -52,6 +55,8 @@ TEST(YogaTest, max_width) {
|
||||
|
||||
TEST(YogaTest, max_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -91,117 +96,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -244,6 +142,8 @@ TEST(YogaTest, justify_content_min_max) {
|
||||
|
||||
TEST(YogaTest, align_items_min_max) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
@@ -286,6 +186,8 @@ TEST(YogaTest, align_items_min_max) {
|
||||
|
||||
TEST(YogaTest, justify_content_overflow_min_max) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -357,6 +259,8 @@ TEST(YogaTest, justify_content_overflow_min_max) {
|
||||
|
||||
TEST(YogaTest, flex_grow_to_min) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -412,6 +316,8 @@ TEST(YogaTest, flex_grow_to_min) {
|
||||
|
||||
TEST(YogaTest, flex_grow_in_at_most_container) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -468,6 +374,8 @@ TEST(YogaTest, flex_grow_in_at_most_container) {
|
||||
|
||||
TEST(YogaTest, flex_grow_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -508,6 +416,8 @@ TEST(YogaTest, flex_grow_child) {
|
||||
|
||||
TEST(YogaTest, flex_grow_within_constrained_min_max_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetMinHeight(root, 100);
|
||||
@@ -561,6 +471,8 @@ TEST(YogaTest, flex_grow_within_constrained_min_max_column) {
|
||||
|
||||
TEST(YogaTest, flex_grow_within_max_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -616,6 +528,8 @@ TEST(YogaTest, flex_grow_within_max_width) {
|
||||
|
||||
TEST(YogaTest, flex_grow_within_constrained_max_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -671,6 +585,8 @@ TEST(YogaTest, flex_grow_within_constrained_max_width) {
|
||||
|
||||
TEST(YogaTest, flex_root_ignored) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root, 1);
|
||||
@@ -727,6 +643,8 @@ TEST(YogaTest, flex_root_ignored) {
|
||||
|
||||
TEST(YogaTest, flex_grow_root_minimized) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -798,6 +716,8 @@ TEST(YogaTest, flex_grow_root_minimized) {
|
||||
|
||||
TEST(YogaTest, flex_grow_height_maximized) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -868,6 +788,8 @@ TEST(YogaTest, flex_grow_height_maximized) {
|
||||
|
||||
TEST(YogaTest, flex_grow_within_constrained_min_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -922,6 +844,8 @@ TEST(YogaTest, flex_grow_within_constrained_min_row) {
|
||||
|
||||
TEST(YogaTest, flex_grow_within_constrained_min_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetMinHeight(root, 100);
|
||||
@@ -974,6 +898,8 @@ TEST(YogaTest, flex_grow_within_constrained_min_column) {
|
||||
|
||||
TEST(YogaTest, flex_grow_within_constrained_max_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -1043,6 +969,8 @@ TEST(YogaTest, flex_grow_within_constrained_max_row) {
|
||||
|
||||
TEST(YogaTest, flex_grow_within_constrained_max_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -1097,6 +1025,8 @@ TEST(YogaTest, flex_grow_within_constrained_max_column) {
|
||||
|
||||
TEST(YogaTest, child_min_max_width_flexing) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1155,6 +1085,8 @@ TEST(YogaTest, child_min_max_width_flexing) {
|
||||
|
||||
TEST(YogaTest, min_width_overrides_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 50);
|
||||
@@ -1180,6 +1112,8 @@ TEST(YogaTest, min_width_overrides_width) {
|
||||
|
||||
TEST(YogaTest, max_width_overrides_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -1205,6 +1139,8 @@ TEST(YogaTest, max_width_overrides_width) {
|
||||
|
||||
TEST(YogaTest, min_height_overrides_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeight(root, 50);
|
||||
@@ -1230,6 +1166,8 @@ TEST(YogaTest, min_height_overrides_height) {
|
||||
|
||||
TEST(YogaTest, max_height_overrides_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
@@ -1255,6 +1193,8 @@ TEST(YogaTest, max_height_overrides_height) {
|
||||
|
||||
TEST(YogaTest, min_max_percent_no_width_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
|
||||
@@ -1295,82 +1235,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,16 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, padding_no_size) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPadding(root, YGEdgeLeft, 10);
|
||||
@@ -38,6 +42,8 @@ TEST(YogaTest, padding_no_size) {
|
||||
|
||||
TEST(YogaTest, padding_container_match_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPadding(root, YGEdgeLeft, 10);
|
||||
@@ -80,6 +86,8 @@ TEST(YogaTest, padding_container_match_child) {
|
||||
|
||||
TEST(YogaTest, padding_flex_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPadding(root, YGEdgeLeft, 10);
|
||||
@@ -124,6 +132,8 @@ TEST(YogaTest, padding_flex_child) {
|
||||
|
||||
TEST(YogaTest, padding_stretch_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPadding(root, YGEdgeLeft, 10);
|
||||
@@ -167,6 +177,8 @@ TEST(YogaTest, padding_stretch_child) {
|
||||
|
||||
TEST(YogaTest, padding_center_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -212,6 +224,8 @@ TEST(YogaTest, padding_center_child) {
|
||||
|
||||
TEST(YogaTest, child_with_padding_align_end) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
|
@@ -1,16 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, percentage_width_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -52,6 +56,8 @@ TEST(YogaTest, percentage_width_height) {
|
||||
|
||||
TEST(YogaTest, percentage_position_left_top) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -95,6 +101,8 @@ TEST(YogaTest, percentage_position_left_top) {
|
||||
|
||||
TEST(YogaTest, percentage_position_bottom_right) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -138,6 +146,8 @@ TEST(YogaTest, percentage_position_bottom_right) {
|
||||
|
||||
TEST(YogaTest, percentage_flex_basis) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -194,6 +204,8 @@ TEST(YogaTest, percentage_flex_basis) {
|
||||
|
||||
TEST(YogaTest, percentage_flex_basis_cross) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -247,63 +259,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -362,6 +321,8 @@ TEST(YogaTest, percentage_flex_basis_main_max_height) {
|
||||
|
||||
TEST(YogaTest, percentage_flex_basis_cross_max_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -419,6 +380,8 @@ TEST(YogaTest, percentage_flex_basis_cross_max_height) {
|
||||
|
||||
TEST(YogaTest, percentage_flex_basis_main_max_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -477,6 +440,8 @@ TEST(YogaTest, percentage_flex_basis_main_max_width) {
|
||||
|
||||
TEST(YogaTest, percentage_flex_basis_cross_max_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -534,6 +499,8 @@ TEST(YogaTest, percentage_flex_basis_cross_max_width) {
|
||||
|
||||
TEST(YogaTest, percentage_flex_basis_main_min_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -592,6 +559,8 @@ TEST(YogaTest, percentage_flex_basis_main_min_width) {
|
||||
|
||||
TEST(YogaTest, percentage_flex_basis_cross_min_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -647,10 +616,10 @@ 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();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -760,6 +729,8 @@ TEST(
|
||||
|
||||
TEST(YogaTest, percentage_margin_should_calculate_based_only_on_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -818,6 +789,8 @@ TEST(YogaTest, percentage_margin_should_calculate_based_only_on_width) {
|
||||
|
||||
TEST(YogaTest, percentage_padding_should_calculate_based_only_on_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -876,6 +849,8 @@ TEST(YogaTest, percentage_padding_should_calculate_based_only_on_width) {
|
||||
|
||||
TEST(YogaTest, percentage_absolute_position) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
@@ -919,6 +894,8 @@ TEST(YogaTest, percentage_absolute_position) {
|
||||
|
||||
TEST(YogaTest, percentage_width_height_undefined_parent_size) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
||||
@@ -957,6 +934,8 @@ TEST(YogaTest, percentage_width_height_undefined_parent_size) {
|
||||
|
||||
TEST(YogaTest, percent_within_flex_grow) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -1039,6 +1018,8 @@ TEST(YogaTest, percent_within_flex_grow) {
|
||||
|
||||
TEST(YogaTest, percentage_container_in_wrapping_container) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
@@ -1125,6 +1106,8 @@ TEST(YogaTest, percentage_container_in_wrapping_container) {
|
||||
|
||||
TEST(YogaTest, percent_absolute_position) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 60);
|
||||
@@ -1193,81 +1176,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,16 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, rounding_flex_basis_flex_grow_row_width_of_100) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -79,6 +83,8 @@ TEST(YogaTest, rounding_flex_basis_flex_grow_row_width_of_100) {
|
||||
|
||||
TEST(YogaTest, rounding_flex_basis_flex_grow_row_prime_number_width) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -175,6 +181,8 @@ TEST(YogaTest, rounding_flex_basis_flex_grow_row_prime_number_width) {
|
||||
|
||||
TEST(YogaTest, rounding_flex_basis_flex_shrink_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -244,6 +252,8 @@ TEST(YogaTest, rounding_flex_basis_flex_shrink_row) {
|
||||
|
||||
TEST(YogaTest, rounding_flex_basis_overrides_main_size) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -315,6 +325,8 @@ TEST(YogaTest, rounding_flex_basis_overrides_main_size) {
|
||||
|
||||
TEST(YogaTest, rounding_total_fractial) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 87.4f);
|
||||
@@ -386,6 +398,8 @@ TEST(YogaTest, rounding_total_fractial) {
|
||||
|
||||
TEST(YogaTest, rounding_total_fractial_nested) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 87.4f);
|
||||
@@ -491,6 +505,8 @@ TEST(YogaTest, rounding_total_fractial_nested) {
|
||||
|
||||
TEST(YogaTest, rounding_fractial_input_1) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -562,6 +578,8 @@ TEST(YogaTest, rounding_fractial_input_1) {
|
||||
|
||||
TEST(YogaTest, rounding_fractial_input_2) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -633,6 +651,8 @@ TEST(YogaTest, rounding_fractial_input_2) {
|
||||
|
||||
TEST(YogaTest, rounding_fractial_input_3) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPosition(root, YGEdgeTop, 0.3f);
|
||||
@@ -705,6 +725,8 @@ TEST(YogaTest, rounding_fractial_input_3) {
|
||||
|
||||
TEST(YogaTest, rounding_fractial_input_4) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPosition(root, YGEdgeTop, 0.7f);
|
||||
@@ -777,6 +799,8 @@ TEST(YogaTest, rounding_fractial_input_4) {
|
||||
|
||||
TEST(YogaTest, rounding_inner_node_controversy_horizontal) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
@@ -862,6 +886,8 @@ TEST(YogaTest, rounding_inner_node_controversy_horizontal) {
|
||||
|
||||
TEST(YogaTest, rounding_inner_node_controversy_vertical) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeight(root, 320);
|
||||
@@ -946,6 +972,8 @@ TEST(YogaTest, rounding_inner_node_controversy_vertical) {
|
||||
|
||||
TEST(YogaTest, rounding_inner_node_controversy_combined) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
@@ -1,17 +1,20 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
TEST(YogaTest, nested_overflowing_child) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -65,6 +68,8 @@ TEST(YogaTest, nested_overflowing_child) {
|
||||
|
||||
TEST(YogaTest, nested_overflowing_child_in_constraint_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
@@ -120,6 +125,8 @@ TEST(YogaTest, nested_overflowing_child_in_constraint_parent) {
|
||||
|
||||
TEST(YogaTest, parent_wrap_child_size_overflowing_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
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