Files
yoga/tests/generated/grid_aspect_ratio_child_fill_content_width.cpp
Nick Gerlemanandzeekay 70493f5e71 CSS Grid 8/9: Add grid test fixtures and generated tests
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
2026-08-28 11:42:59 -07:00

70 lines
2.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<<296a784cafe1eed3955e4fa7a68ac774>>
* generated by gentest/src/GentestDriver.ts from gentest/fixtures/grid_aspect_ratio_child_fill_content_width.html
*/
#include <gtest/gtest.h>
#include <yoga/Yoga.h>
#include "../util/TestUtil.h"
TEST(YogaTest, grid_aspect_ratio_child_fill_content_width) {
YGConfigRef config = YGConfigNew();
YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
YGNodeStyleSetDisplay(root, YGDisplayGrid);
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetAspectRatio(root_child0, 2);
YGNodeInsertChild(root, root_child0, 0);
YGNodeSetContext(root_child0, (void*)"HHHH");
YGNodeSetMeasureFunc(root_child0, &facebook::yoga::test::IntrinsicSizeMeasure);
YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetHeight(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(40, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(40, 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(40, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
YGNodeFreeRecursive(root);
YGConfigFree(config);
}