mirror of
https://github.com/hanzoai/yoga.git
synced 2026-10-30 19:34:29 +00:00
Summary: Add HTML fixture files for CSS Grid tests and generated test output for C++, Java, and JavaScript. Includes: - HTML fixture files defining grid layout test cases - Generated C++ tests (YGGridTest.cpp, YGGridTestFlows.cpp, ~150 individual test files) - Generated Java tests (YGGridTest.java, YGGridTestFlows.java, ~150 individual test files) - Generated JavaScript tests (YGGridTest.test.ts, YGGridTestFlows.test.ts, ~150 individual test files) Differential Revision: D93946254
71 lines
2.7 KiB
C++
71 lines
2.7 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<<f8f64f154dabc7f2310d1a36c787f2de>>
|
|
* generated by gentest/src/GentestDriver.ts from gentest/fixtures/grid_percent_item_inside_stretch_item.html
|
|
*/
|
|
|
|
#include <gtest/gtest.h>
|
|
#include <yoga/Yoga.h>
|
|
#include "../util/TestUtil.h"
|
|
|
|
TEST(YogaTest, grid_percent_item_inside_stretch_item) {
|
|
YGConfigRef config = YGConfigNew();
|
|
|
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
|
YGNodeStyleSetDisplay(root, YGDisplayGrid);
|
|
YGNodeStyleSetWidth(root, 100);
|
|
YGNodeStyleSetHeight(root, 100);
|
|
|
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetDisplay(root_child0, YGDisplayGrid);
|
|
YGNodeInsertChild(root, root_child0, 0);
|
|
|
|
YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetDisplay(root_child0_child0, YGDisplayGrid);
|
|
YGNodeStyleSetWidthPercent(root_child0_child0, 50);
|
|
YGNodeInsertChild(root_child0, root_child0_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));
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_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(100, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0));
|
|
|
|
YGNodeFreeRecursive(root);
|
|
|
|
YGConfigFree(config);
|
|
}
|