Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1503 This diff makes it so that our driver will sign all of the generated files to help ensure that they are not edited by hand. Next I will add CI to actually verify the signature Reviewed By: NickGerleman Differential Revision: D51966201 fbshipit-source-id: f7e3f4fde1c98832212a448b2dcc8e21be0560c4
225 lines
8.6 KiB
C++
225 lines
8.6 KiB
C++
/*
|
|
* 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 SignedSource<<cc1f089d71f647560f06818f63be656c>>
|
|
* generated by gentest/gentest-driver.ts 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);
|
|
|
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
|
YGNodeStyleSetBorder(root, YGEdgeLeft, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeTop, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeRight, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeBottom, 10);
|
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root));
|
|
|
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root));
|
|
|
|
YGNodeFreeRecursive(root);
|
|
|
|
YGConfigFree(config);
|
|
}
|
|
|
|
TEST(YogaTest, border_container_match_child) {
|
|
const YGConfigRef config = YGConfigNew();
|
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
|
|
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
|
YGNodeStyleSetBorder(root, YGEdgeLeft, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeTop, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeRight, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeBottom, 10);
|
|
|
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetWidth(root_child0, 10);
|
|
YGNodeStyleSetHeight(root_child0, 10);
|
|
YGNodeInsertChild(root, root_child0, 0);
|
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root));
|
|
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root));
|
|
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
YGNodeFreeRecursive(root);
|
|
|
|
YGConfigFree(config);
|
|
}
|
|
|
|
TEST(YogaTest, border_flex_child) {
|
|
const YGConfigRef config = YGConfigNew();
|
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
|
|
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
|
YGNodeStyleSetBorder(root, YGEdgeLeft, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeTop, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeRight, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeBottom, 10);
|
|
YGNodeStyleSetWidth(root, 100);
|
|
YGNodeStyleSetHeight(root, 100);
|
|
|
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetFlexGrow(root_child0, 1);
|
|
YGNodeStyleSetWidth(root_child0, 10);
|
|
YGNodeInsertChild(root, root_child0, 0);
|
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
|
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
|
|
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
YGNodeFreeRecursive(root);
|
|
|
|
YGConfigFree(config);
|
|
}
|
|
|
|
TEST(YogaTest, border_stretch_child) {
|
|
const YGConfigRef config = YGConfigNew();
|
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
|
|
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
|
YGNodeStyleSetBorder(root, YGEdgeLeft, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeTop, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeRight, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeBottom, 10);
|
|
YGNodeStyleSetWidth(root, 100);
|
|
YGNodeStyleSetHeight(root, 100);
|
|
|
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetHeight(root_child0, 10);
|
|
YGNodeInsertChild(root, root_child0, 0);
|
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
|
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
|
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
YGNodeFreeRecursive(root);
|
|
|
|
YGConfigFree(config);
|
|
}
|
|
|
|
TEST(YogaTest, border_center_child) {
|
|
const YGConfigRef config = YGConfigNew();
|
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
|
|
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
|
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
|
YGNodeStyleSetBorder(root, YGEdgeStart, 10);
|
|
YGNodeStyleSetBorder(root, YGEdgeEnd, 20);
|
|
YGNodeStyleSetBorder(root, YGEdgeBottom, 20);
|
|
YGNodeStyleSetWidth(root, 100);
|
|
YGNodeStyleSetHeight(root, 100);
|
|
|
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetWidth(root_child0, 10);
|
|
YGNodeStyleSetHeight(root_child0, 10);
|
|
YGNodeInsertChild(root, root_child0, 0);
|
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
|
|
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(35, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
|
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(35, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
YGNodeFreeRecursive(root);
|
|
|
|
YGConfigFree(config);
|
|
}
|